Nizamuddin Siddiqui has Published 2307 Articles

Change the starting point of bars in bar plot for a ggplot2 graph in R.

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 10-Nov-2021 06:45:15

2K+ Views

To change the starting point of bars in bar plot for a ggplot2 graph in R, we can use coord_cartesian function of ggplot2 package with ylim argument where we can change the starting and ending point for the bar plot values.Check out the Example given below to understand how it ... Read More

How to find the log10 of each value in columns if some columns are categorical in R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 10-Nov-2021 06:43:41

102 Views

To find the log10 of each value if some columns are categorical in R data frame, we can follow the below steps −First of all, create a data frame.Then, use numcolwise function from plyr package to find the log10 if some columns are categorical.ExampleCreate the data frameLet’s create a data ... Read More

How to increase the length of Y-axis values for ggplot2 graph in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 10-Nov-2021 06:41:28

5K+ Views

To increase the length of Y-axis for ggplot2 graph in R, we can use scale_y_continuous function with limits argument.For Example, if we have a data frame called df that contains two columns say X and Y and we want to have the length of Y-axis starting from 1 to 10 ... Read More

How to separate two values in single column in R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 10-Nov-2021 06:40:30

1K+ Views

To separate two values in single column in R data frame, we can follow the below steps −First of all, create a data frame.Then, use separate function from tidyr package to separate the values in single column.ExampleCreate the data frameLet’s create a data frame as shown below −dfRead More

How to standardize columns if some columns are categorical in R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 10-Nov-2021 06:37:31

128 Views

To standardize columns if some columns are categorical in R data frame, we can follow the below steps −First of all, create a data frame.Then, use numcolwise function from plyr package to standardize columns if some columns are categorical.ExampleCreate the data frameLet’s create a data frame as shown below −LevelRead More

Find the frequency of unique values and missing values for each column in an R data frame.

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 10-Nov-2021 06:36:06

364 Views

To find the frequency of unique values and missing values for each column in an R data frame, we can use apply function with table function and useNA argument set to always.For Example, if we have a data frame called df then we can find the frequency of unique values ... Read More

How to convert first letter into capital in single column R data frame using a function?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 10-Nov-2021 06:34:13

1K+ Views

To convert first letter into capital in single column data frame in R, we can follow the below steps −First of all, create a data frame with string column.Then, use capitalize function from R.utils package to convert first letter into capital in single column.ExampleCreate the data frameLet’s create a data ... Read More

How to convert first letter into capital in single column data.table object in R using dplyr?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 10-Nov-2021 06:31:27

88 Views

To convert first letter into capital in single column data.table object in R, we can follow the below steps −First of all, create a data.table object with string column.Then, use sub function along with mutate function of dplyr package to convert first letter into capital in string column.ExampleCreate the data.table ... Read More

Find the frequency of unique values for each column in an R data frame.

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 10-Nov-2021 06:31:12

572 Views

To find the frequency of unique values for each column in an R data frame, we can use apply function with table function.For Example, if we have a data frame called df then we can find the frequency of unique values for each column in df by using the below ... Read More

How to find the row median of columns having same name in data.table object in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 10-Nov-2021 06:29:47

72 Views

To find the row median of columns having same name in data.table object in R, we can follow the below steps −First of all, create a data.table with some columns having same name.Then, use tapply along with colnames and median function to find the row median of columns having same ... Read More

Advertisements