Nizamuddin Siddiqui has Published 2307 Articles

How to increase the length of an R data frame by repeating the number of rows?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 11-Aug-2020 13:43:01

453 Views

If we strongly believe that new data collection will result in the same type of data then we might want to stretch our data frame in R with more rows. Although, this is not recommended because we lose unbiasedness in the data due to this process but it is done ... Read More

How to find group-wise summary statistics for an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 11-Aug-2020 13:37:38

408 Views

To compare different groups, we need the summary statistics for each of the groups. It helps us to observe the differences between the groups. The summary statistics provides the minimum value, first quartile, median, third quartile, and the maximum values. Therefore, we can compare each of these values for the ... Read More

How to find the sum of column values of an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 11-Aug-2020 13:24:05

402 Views

An R data frame contain columns that might represent a similar type of variables; therefore, we might want to find the sum of the values for each of the columns and make a comparison based on the sum. This can be done with the help of sum function but first ... Read More

How to convert all words of a string or categorical variable in an R data frame to uppercase?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 11-Aug-2020 13:19:16

230 Views

Most of the times the format of the data we get is not we are looking for therefore, we need to change that according to our need. When the levels of categorical variables are represented by words instead of numbers then we can convert those levels to lowercase or to ... Read More

How to select rows with group wise minimum or maximum values of a variable in an R data frame using dplyr?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 11-Aug-2020 13:15:01

1K+ Views

If an R data frame contains a group variable that has many group levels then finding the minimum and maximum values of a discrete or continuous variable based on the group levels becomes difficult. But this can be done with slice function in dplyr package.Consider the below data frame that ... Read More

How to split a data frame in R into multiple parts randomly?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 11-Aug-2020 13:01:29

2K+ Views

When a data frame is large, we can split it into multiple parts randomly. This might be required when we want to analyze the data partially. We can do this with the help of split function and sample function to select the values randomly.ExampleConsider the trees data in base R ... Read More

How to convert empty values to NA in an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 11-Aug-2020 12:58:17

525 Views

When our data has empty values then it is difficult to perform the analysis, we might to convert those empty values to NA so that we can understand the number of values that are not available. This can be done by using single square brackets.ExampleConsider the below data frame that ... Read More

How to remove empty rows from an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 11-Aug-2020 12:54:43

570 Views

During the survey or any other medium of data collection, getting all the information from all units is not possible. Sometimes we get partial information and sometimes nothing. Therefore, it is possible that some rows in our data are completely blank and some might have partial data. The blank rows ... Read More

How to select columns in R based on the string that matches with the column name using dplyr?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 11-Aug-2020 12:48:03

839 Views

Selection of columns in R is generally done with the column number or its name with $ delta operator. We can also select the columns with their partial name string or complete name as well without using $ delta operator. This can be done with select and matches function of ... Read More

How to select the first row for each level of a factor variable in an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 11-Aug-2020 12:37:42

453 Views

Comparison of rows is an influential part of data analysis, sometimes we compare variable with variable, value with value, case or row with another case or row, or even a complete data set with another data set. This is required to check the accuracy of data values and its consistency ... Read More

Advertisements