Nizamuddin Siddiqui has Published 2307 Articles

How to remove everything before values starting after underscore from column values of an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 19-Oct-2020 14:42:05

1K+ Views

If a column in an R data frame contain string values that are separated with an underscore and stretches the size of the column values that also contain common values then it would be wise to remove underscore sign from all the values at once along with the values that ... Read More

How to remove rows from data frame in R based on grouping value of a particular column?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 19-Oct-2020 14:34:53

2K+ Views

If we have a grouping column in an R data frame and we believe that one of the group values is not useful for our analysis then we might want to remove all the rows that contains that value and proceed with the analysis, also it might be possible that ... Read More

How to make all the elements in a list of equal size in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 19-Oct-2020 14:26:35

357 Views

We know that a list can multiple elements of different types as well as of different size. For example, a list that contains two elements then one element may contain fifteen elements and the other might have twenty-five elements. In this situation, we might want to fill the first element ... Read More

How to generate Bernoulli random variable in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 19-Oct-2020 14:23:16

5K+ Views

Each value in Bernoulli random variable represents success or a failure for a single trial that makes it different from Binomial random variable because a Binomial random variable represents number of success or failure for a number of trials. To generate a Bernoulli random variable, we can use rbinom function ... Read More

How to count the number of occurrences of all unique values in an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 19-Oct-2020 14:17:05

692 Views

A data frame in R can have infinite number of unique values and it can also contain many repeated values. Therefore, finding the number of all unique values in the data frame can help us to understand the diversity in the data but this most done in situations where we ... Read More

How to perform homogeneity of variance test for two-way anova in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 19-Oct-2020 13:53:02

1K+ Views

In general, we can say that the homogeneity of variance test is the type of test that compares the variance of two or more variables and finds the significant difference between or among them if exists. For a two-way anova, one of the most commonly used homogeneity of variance test ... Read More

How to calculate the number of elements greater than a certain value in a vector in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 19-Oct-2020 13:50:16

8K+ Views

In data analysis, sometimes we need to count the number of values that are greater than or less than a certain value, and this certain value could be a threshold. For example, we might have a vector that contain values for blood pressure of people and we might want check ... Read More

How to create a graph in R using ggplot2 with all the four quadrants?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 18-Oct-2020 14:38:34

2K+ Views

The default graph created by using ggplot2 package shows the axes labels depending on the starting and ending values of the column of the data frame or vector but we might want to visualize it just like we do in paper form of graphs that shows all of the four ... Read More

How to create a subset of matrix in R using greater than or less than a certain value of a column?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 18-Oct-2020 14:37:17

1K+ Views

Subsetting can be required in many different ways, we can say that there might be infinite number of ways for subsetting as it depends on the objective of the bigger or smaller analysis. One such way is subsetting a matrix based on a certain value of column of the matrix. ... Read More

How to find the sum of anti-diagonal elements in a matrix in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 18-Oct-2020 14:36:02

460 Views

The anti-diagonal elements in a matrix are the elements that form straight line from right upper side to right bottom side. For example, if we have a matrix as shown below −1 2 3 4 5 6 7 8 9then the diagonal elements would be 1, 5, 9 and the ... Read More

Advertisements