Nizamuddin Siddiqui has Published 2303 Articles

How to add a horizontal line to the plot created by ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 08:54:26

308 Views

When we create a plot, it shows the values passed by the function for creating the plot but we might want to display some other values to provide some information through the plot and that information could be a threshold value as a horizontal line or we can also call ... Read More

How to split a string vector that contain strings of equal sizes and have spaces between values then extract only few values in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 08:48:52

189 Views

A string vector can contain any value including spaces. Sometimes a string vector is read with some spaces as well and we want to split the vector then extract few values. For example, if a string has “ABC 123” then we might want to extract the number 123 so that ... Read More

How to find the total of frequency based on the values of a factor column in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 08:46:54

496 Views

Often, we have duplicate values in a factor column that means a factor column has many levels and each of these levels occur many times. In this situation, if we have a frequency column then we want to find the total of that frequency based on the values of a ... Read More

How to convert unit of measurements of a value or a vector in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 08:40:58

787 Views

There are many units of measurements for a single object or item. For example, weight can be measured in milligrams, grams, kilograms, tons, oz, lbs, etc. Now suppose we have two variables that belong to the same unit of measurement as weight of a coca cola cans and weight of ... Read More

How to create vector in R with a sequence of numbers?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 08:38:20

21K+ Views

Creating a numeric vector is the first step towards learning R programming and there are many ways to do that but if we want to generate a sequence of number then it is a bit different thing, not totally different. We can create a vector with a sequence of numbers ... Read More

How to display the legend of a bar plot in a colored box in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 08:38:07

367 Views

When we create a bar plot or any other plot with legend, the background of the legend is white but it can be changed to any color with the help of scales package. We can make changes in the legend of a plot using alpha in legend.background argument of theme ... Read More

How to represent X-axis label of a bar plot with greater than equal to or less than equal to sign using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 08:27:27

899 Views

The values of the categorical variable can be represented by numbers, by characters, by a combination of numbers and characters, by special characters, by numerical signs or any other method. But when we create the bar plot, if the size of a label name is large then we might want ... Read More

How to create a vector with zero values in R Program?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 08:23:48

189 Views

In data analysis, sometimes we need to use zeros for certain calculations, either to nullify the effect of a variable or for some other purpose based on the objective of the analysis. To deal with such type of situations, we need a zero value or a vector of many ways ... Read More

How to find the standardized coefficients of a linear regression model in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 08:22:23

2K+ Views

The standardized coefficients in regression are also called beta coefficients and they are obtained by standardizing the dependent and independent variables. Standardization of the dependent and independent variables means that converting the values of these variables in a way that the mean and the standard deviation becomes 0 and 1 ... Read More

How to select columns of an R data frame that are not in a vector?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 08:17:38

527 Views

An R data frame can have so many columns and we might want to select them except a few. In this situation, it is better to extract columns by deselecting the columns that are not needed instead of selecting the columns that we need because the number of columns needed ... Read More

Advertisements