Nizamuddin Siddiqui has Published 2307 Articles

How to cut the elements of a numeric vector into multiple intervals in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 10:45:49

322 Views

A numeric vector may contain a large number of elements; therefore, we might want to convert that vector into a vector of intervals. For example, if we have 1 to 10 values in a vector then we might want to convert that vector into a vector of intervals such as ... Read More

How to find the cumulative sums if a vector contains NA values in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 10:31:35

586 Views

The cumulative sums are the sum of consecutive values and we can take this sum for any numerical vector or a column of an R data frame. But if there exits an NA, then we need to skip it and therefore the size of the cumulative sums will be reduced ... Read More

How to convert a decimal value or a vector of decimal values to fractional form in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 09:32:04

3K+ Views

A fraction form of a decimal value is the form of the value represented with division sign. For example, representing 0.5 as 1 / 2. In R, we can use fractions function of MASS package to convert a decimal value or a vector of decimal values to fractional form. To ... Read More

How to change the angle of annotated text in plot created by using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 09:30:28

188 Views

To annotate the text inside a plot created by ggplot2, we can use annotate function. It is used to give some explanation about the plot or add any useful information that will help readers to understand the plot in a better way. Sometimes, we might want to change the angle ... Read More

How to create a dot plot using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 09:28:00

426 Views

A dot plot is a type of histogram that display dots instead of bars and it is created for small data sets. In ggplot2, we have geom_dotplot function to create the dot plot but we have to pass the correct binwidth which is an argument of the geom_dotplot, so that ... Read More

How to determine the percentiles of a vector values in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 09:26:13

182 Views

Percentile helps us to determine the values that lie at a certain percent in a data set. For example, if we have a vector of size 100 with containing any values and suppose that the tenth-percentile of the vector is 25, which means there are ten percent values in the ... Read More

How to delete different rows and columns of a matrix using a single line code in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 09:24:37

1K+ Views

Deletion or addition of rows and columns in a matrix of any size is mostly done by using single square brackets and it is also the easiest way. To delete rows and columns, we just need to use the column index or row index and if we want to delete ... Read More

How to extract p-values for intercept and independent variables of a general linear model in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 09:19:37

378 Views

General linear model does not assume that the variables under consideration are normally distributed, therefore, we can use other probability distributions to create a general linear model. We should actually say that if the data does not follow normal distribution then we can try different distributions using general linear model ... Read More

How to create two vertical lines on a plot with shaded area in-between using R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 09:09:03

250 Views

Sometimes we want to place a vertical rectangle on a plot that has different color as compared to the rest of the plot area. This vertical rectangle is created based on the conditional values of x axis and represent the pivot area or unimportant area depending on the characteristics of ... Read More

How to create a plot in R with gridlines using plot function?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 04-Sep-2020 09:06:54

374 Views

Any plot created by using plot function does not display the plot with gridlines. On the other hand, if we create a plot using ggplot2 package then the plot has gridlines. Therefore, if we want to have gridlines on our plot then either we should create the plot using ggplot2 ... Read More

Advertisements