Nizamuddin Siddiqui has Published 2307 Articles

How to create a scatterplot using five vectors in a single plot window without separating the plots in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 17-Oct-2020 08:10:28

59 Views

To create more than one scatterplot in a single plot window we should create the scatterplot for first vector and then add the point of the remaining vectors by using points function and they can be displayed with different colors so that it becomes easy to differentiate among the points ... Read More

How to convert negative values in an R data frame to positive values?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 17-Oct-2020 08:07:31

7K+ Views

Sometimes we need to use absolute values but few values in the data set are negative, therefore, we must convert them to positive. This can be done by using abs function. For example, if we have a data frame df with many columns and each of them having some negative ... Read More

How to replace one vector elements with another vector elements in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 17-Oct-2020 07:26:30

207 Views

If the data is incorrectly recorded then we need to replace that with the correct. One such case could be reading a vector with values that belong to another vector. In this type of situation, we should replace the vectors appropriate. In R, it can be easily done by using ... Read More

How to create boxplot for multiple categories in base R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 17-Oct-2020 07:20:27

1K+ Views

To create the boxplot for multiple categories, we should create a vector for categories and construct data frame for categorical and numerical column. Once the construction of the data frame is done, we can simply use boxplot function in base R to create the boxplots by using tilde operator as ... Read More

How to find the median for factor levels in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 17-Oct-2020 07:17:00

1K+ Views

The second most used measure of central tendency median is calculated when we have ordinal data or the continuous data has outliers, also if there are factors data then we might need to find the median for levels to compare them with each other. The easiest way to do this ... Read More

How to calculate root mean square error for linear model in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 17-Oct-2020 07:10:35

2K+ Views

To find the root mean square error, we first need to find the residuals (which are also called error and we need to root mean square for these values) then root mean of these residuals needs to be calculated. Therefore, if we have a linear regression model object say M ... Read More

How to remove the first replicate in a vector using another vector that contains similar elements in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 17-Oct-2020 07:02:58

76 Views

To remove the first replicate in a vector using another vector, we can use match function. For example, if we have a vector x that contain values 0, 1, 2, 3, 4, 5 and 0, 1, 2 are repeated in another vector say then the removal of this replicate will ... Read More

How to create a list of matrices in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 17-Oct-2020 06:53:29

2K+ Views

To create a list of matrices, we simply need to find the matrix object inside list function. For example, if we have five matrix objects either of same or different dimensions defined as Matrix1, Matrix2, Matrix3, Matrix4, and Matrix5 then the list of these matrices can be created as −List_of_MatrixRead More

How to create unordered triplets of a vector elements in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 17-Oct-2020 06:43:13

160 Views

To create triplets of a vector elements, we can use combn function. For example, if we have a vector x that contain values 1, 2, 3, 4, 5 then the unordered triplets of x can be created by using combn(x, 3). This will create a matrix where the elements of ... Read More

How to create a data frame with a column having repeated values in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 17-Oct-2020 06:23:46

15K+ Views

To create a data frame with a column having repeated values, we simply need to use rep function and we can repeat the values in a sequence of the values passed or repeating each value a particular number of times. For example, if we have three values 1, 2, 3 ... Read More

Advertisements