Nizamuddin Siddiqui has Published 2307 Articles

How to split string values that contain special characters in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Oct-2020 14:48:49

822 Views

When we have a single long string or a vector of string values and the values within the string are separated by some special characters then splitting the values can help us to properly understand those strings. This could happen in situations when the string data is recorded with mistakes ... Read More

How to plot all the values of an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Oct-2020 14:46:43

354 Views

To plot all the values of an R data frame, we can use matplot function. This function plots all the values based on the columns of an R data frame and represent them by the column number. For example, if we have five columns in an R data frame then ... Read More

How to find the proportion of row values in an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Oct-2020 14:42:06

411 Views

The proportion of row values can be calculated if we divide each row value with the sum of all values in a particular row. Therefore, the total sum of proportions will be equal to 1. This can be done by dividing the data frame with the row sums and for ... Read More

How to create a transparent polygon using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Oct-2020 14:30:57

559 Views

A transparent polygon just represents the border lines and a hollow area; thus, we can only understand the area covered but it becomes a little difficult to understand the scales. Hence, this visualisation technique is not as useful as others that fills the area with a different color. But it ... Read More

How to subset an R data frame based on string values of a columns with OR condition?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Oct-2020 14:28:08

3K+ Views

We might want to create a subset of an R data frame using one or more values of a particular column. For example, suppose we have a data frame df that contain columns C1, C2, C3, C4, and C5 and each of these columns contain values from A to Z. ... Read More

How to find contingency table of means from an R data frame using cast function?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Oct-2020 14:20:00

191 Views

The contingency table considers the numerical values for two categorical variables. Often, we require contingency table for counts, especially in non-parametric analysis but it is also possible that we want to use means for our analysis. Hence, we can use cast function from reshape package which solves the problem of ... Read More

How to find the number of NA’s in each column of an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Oct-2020 14:19:24

689 Views

Sometimes the data frame is filled with too many missing values/ NA’s and each column of the data frame contains at least one NA. In this case, we might want to find out how many missing values exists in each of the columns. Therefore, we can use colSums function along ... Read More

How to simulate normal distribution for a fixed limit in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Oct-2020 13:26:24

512 Views

To simulate the normal distribution, we can use rnorm function in R but we cannot put a limit on the range of values for the simulation. If we want simulate this distribution for a fixed limit then truncnorm function of truncnorm package can be used. In this function, we can ... Read More

How to create a transparent histogram using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 08-Oct-2020 15:23:20

2K+ Views

When we create a histogram using ggplot2 package, the area covered by the histogram is filled with grey color but we can remove that color to make the histogram look transparent. This can be done by using fill="transparent" and color="black" arguments in geom_histogram, we need to use color argument because ... Read More

How to select values less than or greater than a specific percentile from an R data frame column?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 08-Oct-2020 15:21:21

543 Views

The percentiles divide a set of numeric values into hundred groups or individual values if the size of the values is 100. We can find percentiles for a numeric column of an R data frame, therefore, it is also possible to select values of a column based on these percentiles. ... Read More

Advertisements