Nizamuddin Siddiqui has Published 2307 Articles

How to find the maximum of each row in an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Dec-2020 05:09:58

6K+ Views

Sometimes we need maximum values, it helps us to identify which case or subject occurs at the greatest point hence we can understand the limit for the sample or population under study. If we want to find the maximum of values two or more columns for each row in an ... Read More

How to create a matrix without column and row indices in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Dec-2020 05:07:17

377 Views

To create a matrix without column and row indices, we first need to create the matrix and then prmatrix function can be used to convert that matrix without column and row indices but we would need to provide the number of rows inside the function. For example, if we have ... Read More

How to create a plot of Poisson distribution in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Dec-2020 05:04:31

2K+ Views

The Poisson distribution is a discrete distribution that has only one parameter named as lambda and it is the rate parameter. The rate parameter is defined as the number of events that occur in a fixed time interval. To create a plot of Poisson distribution in R, we can use ... Read More

How to create a plot in base R without margins?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Dec-2020 05:02:02

447 Views

To create a plot without margins, we first need to define that margin in a way that the plot created after that will not have margins and this can be done by using par function. We would need to pass mar function within par function as par(mar=c(0, 0, 0, 0)).Example Live ... Read More

What is the use of pheatmap function in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Dec-2020 05:00:16

83 Views

The pheatmap function is used to create clustered heatmaps but we can change the aesthetics of the plot by using color argument which is one of the main functionalities of pheatmap function. There are many other arguments that differentiate pheatmap from heatmap function.Examplelibrary(pheatmap) M1

How to create a table of sums of a discrete variable for two categorical variables in an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Dec-2020 04:57:36

415 Views

If we want to create a table of sums of a discrete variable for two categorical variables then xtabs function can be used. The output will be a contingency table or cross tabulation table which looks like a matrix. For example, if we have a data frame df with two ... Read More

How to create a rectangle inside boxplot in base R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Dec-2020 04:52:59

197 Views

To create a rectangle inside boxplot in base R, we can use rect function after creating the boxplot. The rect function has many arguments but for the creation of a rectangle only first four are necessary and these are defined as xleft - a vector (or scalar) of left x ... Read More

How to find the mean of three-dimensional array in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 13:27:56

933 Views

A three-dimensional array can have matrices of different size and they are not necessarily to be square or rectangular. Also, all the elements in an array are of same data type. If we want to find the mean of a three-dimensional array then apply function can be used where we ... Read More

How to create a column with the serial number of values in character column of an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 13:25:08

1K+ Views

A group column in an R data frame have duplicate values and we might want to create a column with the serial number based on the values such as first value of the first group gets 1, the same value gets 2 when occurred second time in the same column ... Read More

How to find the absolute maximum of a matrix with sign if it contains negative values in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 05-Dec-2020 13:23:32

318 Views

If we have positive as well as negative values in a matrix then the maximum of the matrix will be a positive number but if we want to ignore the sign then a number represented with negative sign can also be the maximum. If we want to get the maximum ... Read More

Advertisements