Nizamuddin Siddiqui has Published 2307 Articles

How to find the less than probability using normal distribution in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 11:36:10

1K+ Views

The less than probability using normal distribution is the cumulative probability which can be found by using cumulative distribution function of the normal distribution. In R, we have pnorm function that directly calculates the less than probability for a normally distributed random variable that takes Z score, mean and standard ... Read More

How to change legend values in a bar plot created by using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 11:33:08

578 Views

How to change legend values in a bar plot created by using ggplot2 in R?By default, the legend values are taken as the different levels of the categorical variable for which a bar plot is created using ggplot2 package and if we want to change those values then scale_color_manual function ... Read More

How to check the difference between plot generation time in base R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 11:28:33

53 Views

One of the mostly used time measurement function in R is microbenchmark function of microbenchmark package. We can pass the function to create the plot inside microbenchmark function and this will result in the processing time for each of the plots then a comparison can be done for the difference.Example1Loading ... Read More

How to change the resolution of a plot in base R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 11:22:07

3K+ Views

In base R, we can save a plot as a png and pass the resolution in the same stage. The procedure to do this is creating the png image with resolution with res argument then creating the plot and using dev.off() to create the file. Check out the below examples ... Read More

How to create a point chart with point size increment based on the position of the point in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 11:16:14

191 Views

The cex argument is used to increase or decrease the point size in a point chart created in base R. If we want to create a point chart with points of size in increment manner then we can pass a vector of the same size as the vector for which ... Read More

How to create a point chart in R with alternative points having different shape?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 11:12:18

246 Views

How to create a point chart in R with alternative points having different shape?The pch argument is used to create different points in a base R chart and if we want to have alternative points of different shape then we can use rep function with pch argument but we need ... Read More

How to fix the coefficient of an independent variable in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 11:09:08

538 Views

While doing the analysis we might know the variation in an independent variable or we might want to understand how other independent variables behave if we fix a certain variable. Therefore, we can fix the coefficient of an independent variable while creating the model and this can be done by ... Read More

How to create a barplot with gaps on Y-axis scale in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 11:03:03

499 Views

If we want to have gaps on Y-axis scale in a barplot then it cannot be done in base R. For this purpose, we can make use of gap.barplot function of plotrix package. The gap.barplot function is very handy, we just need to pass the vector for which we want ... Read More

How to set the diagonal elements of a matrix to 1 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 10:58:04

1K+ Views

First thing we need to understand is diagonal elements are useful only if we have a square matrix, otherwise it would not make sense to set diagonal elements, this is known to almost all mathematicians but some freshman might get confused because we can create diagonal in a non-square matrix ... Read More

How to add a horizontal line in a boxplot created in base R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 10:49:01

3K+ Views

A boxplot in base R already consists three horizontal lines that represents minimum, median, and the maximum but we might to create an extra horizontal to showcase some threshold value. For example, we might to create a horizontal line at 2 to understand the variation in values that are greater ... Read More

Advertisements