Nizamuddin Siddiqui has Published 2303 Articles

How to create a vector with names of its elements in one line code in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 12-Aug-2020 12:00:39

886 Views

Vectors are frequently created in R but most of the times we don’t give names to their elements and if we want to give their names then we can use setNames function. This function will help us to name the vector elements in a single line of code, obviously this ... Read More

How to plot a function with ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 12-Aug-2020 11:57:00

5K+ Views

Plotting a function is very easy with curve function but we can do it with ggplot2 as well. Since ggplot2 provides a better-looking plot, it is common to use it for plotting instead of other plotting functions. To plot a function, we should specify the function under stat_function in ggplot.ExampleConsider ... Read More

How to change the color of lines for a line chart using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 12-Aug-2020 11:54:25

887 Views

When we create line chart with each of the lines having different color, we might want to change the color of lines if the colors we used at the first time are not making the chart attractive. This can be done by manually setting the color of the lines in ... Read More

How to view saved Rdata file in windows?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 12-Aug-2020 11:50:46

1K+ Views

We save our data files created in R to use them in the future and these files have an extension .Rdata. To view these files, we can make use of load function that will read the path of the file on your system. Suppose you save the file in Documents ... Read More

How to plot a function in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 12-Aug-2020 10:05:20

522 Views

Plotting a function in R is not a difficult task. We can do it simply with curve function but if the function is very complex then it inside curve function might be difficult. It totally depends on the understand of the person who wants to plot the function, if he ... Read More

How to filter column values for some strings from an R data frame using dplyr?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 12-Aug-2020 10:00:32

307 Views

Filtering data helps us to make desired groups of data than can be further used for analysis. In this way, accuracy can be achieved and computation becomes easy. Suppose, we have a homogeneous group then to partition that group based on some characteristics the filter function of dplyr package can ... Read More

How to find the unique rows based on some columns in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 12-Aug-2020 09:55:01

441 Views

Especially when the experimental conditions are same then we expect some of the row values for some columns to be the same, it is also done on purpose while designing the experiments to check the fixed effect of variables. If we want to determine the unique rows then it can ... Read More

How to remove partial string after a special character in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 12-Aug-2020 09:51:38

639 Views

Sometimes we don’t require the whole string to proceed with the analysis, especially when it complicates the analysis or making no sense. In such type of situations, the part of string which we feel that is not necessary can be removed from the complete string. For example, suppose we have ... Read More

How to convert a string in an R data frame to NA?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 12-Aug-2020 09:42:56

543 Views

We often see mistakes in data collection processes and these mistakes might lead to incorrect results of the research. When the data is collected with mistakes, it makes the job of analyst difficult. One of the situations, that shows the data has mistakes is getting strings in place of numerical ... Read More

How to combine two vectors by separating with different special characters in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 12-Aug-2020 09:33:49

191 Views

The combination of two vectors is used for many purposes such as performing two-way ANOVA, presenting data table, or making visual representation of the data. The combinations can be created with many special characters in R by using paste and rep function.ExampleConsider the below vectors Class and Names.> Class Class ... Read More

Advertisements