Nizamuddin Siddiqui has Published 2307 Articles

How to find the sample size for two sample proportion tests with given power in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 03-Nov-2021 07:01:21

687 Views

To find the sample size for two sample proportion tests with given power, we can use the function power.prop.test where we need to at least pass the two proportions and power.By default the significance level will be taken as 0.05 and if we want to change it then sig.level argument ... Read More

How to remove rows that have NA in R data frames stored in a list?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 03-Nov-2021 06:58:36

854 Views

To remove rows that have NA in R data frames stored in a list, we can use lapply function along with na.omit function.For example, if we have a list called LIST that contains some data frames each containing few missing values then the removal of rows having missing values from ... Read More

How to remove first character from column name in R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 03-Nov-2021 06:53:53

3K+ Views

To remove first character from column name in R data frame, we can use str_sub function of stringr package.For Example, if we have a data frame called df that contains two columns say XID and XDV then we can remove X from both the column names by using the below ... Read More

How to create boxplots based on two factor data in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 03-Nov-2021 06:52:32

2K+ Views

To create boxplots based on two factor data, we can create facets for one of the factors, where each facet will contain the boxplots for the second factor.For example, if we have a data frame called df that contains two factor columns say F1 and F2 and one numerical column ... Read More

How to increase the width of the X-axis line for a ggplot2 graph?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 03-Nov-2021 06:38:19

4K+ Views

To increase the width of the X-axis line for a ggplot2 graph in R, we can use theme function where we can set the axis.line.x.bottom argument size to desired size with element_line.Check out the below Example to understand how it can be done.ExampleFollowing snippet creates a sample data frame −xRead More

Change the color of X-axis line for a graph using ggplot2.

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 03-Nov-2021 06:32:41

5K+ Views

To change the color of X-axis line for a graph using ggplot2, we can use theme function where we can set the axis.line.x.bottom argument color to desired color with element_line.Check out the below Example to understand how it can be done. This might be required when we want to highlight ... Read More

How to find the row wise mode of strings in an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 03-Nov-2021 06:26:36

360 Views

To find the row wise model of strings in an R data frame, we can use apply function along with custom function for mode, if ties will be there then first value will be chosen based on alphabetical ordering.For Example, if we have a data frame called df that contains ... Read More

How to deal with error 'height' must be a vector or a matrix while creating barplot?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 03-Nov-2021 06:13:32

3K+ Views

The error 'height' must be a vector or a matrix while creating barplot occurs when we provide data frame name instead of column names or read it with as.matrix. If we want to create bar plot for columns in a data frame then the data frame needs to be read ... Read More

How to find bootstrap confidence interval in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 03-Nov-2021 06:03:48

5K+ Views

The bootstrap confidence interval can be found by using the boot function. The bootstrapping is a method of finding inferential statistics with the help of sample data. It is done by drawing a large number of samples with replacement from the same values. Check out the Examples given below to ... Read More

How to find the frequency based on intervals in R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 03-Nov-2021 05:52:56

1K+ Views

To create intervals, we can use cut function with seq function and if we want to find the frequency based on these intervals then we just need to use table function along with cut function. We need to properly define the values for interval inside cut function. To understand how ... Read More

Advertisements