Nizamuddin Siddiqui has Published 2307 Articles

How to convert year, month, and day of the month into a complete date in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 13-Aug-2021 12:02:40

1K+ Views

To convert year, month, and day of the month into a complete date, we can follow the below steps −Create a data frame with Year, Month and DayOfMonth as separate columns.Use mutate function of dplyr package to create complete date.Create the data frameLet's create a data frame as shown below ... Read More

How to divide data frame rows by number of columns in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 13-Aug-2021 12:01:21

340 Views

To divide data frame rows by number of columns in R, we can follow the below steps −First of all, create a data frame.Then, use apply function to divide the data frame rows by number of columns.Create the data frameLet's create a data frame as shown below − Live DemoxRead More

How to generate the outcome of three throws of a die in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 13-Aug-2021 11:59:36

100 Views

When we roll a die three times, the sample space contains two hundred and sixteen outcomes that is 216. If we want to generate the outcome of three throws of a die then expand.grid function can be used with rep and list function.Generating the outcome of three throws of a ... Read More

How to find the proportion of categories based on another categorical column in R's data.table object?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 13-Aug-2021 11:58:23

125 Views

To find the proportion of categories based on another categorical column in R's data.table object, we can follow the below steps −First of all, create a data.table object.Finding the proportion based on categorical column.Create a data.table objectLoading data.table package and creating a data.table object with two categorical columns −library(data.table) Category1Read More

How to divide the row values by row sum in data.table object in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 13-Aug-2021 11:57:01

118 Views

To divide the row values by row sum in R’s data.table object, we can follow the below steps −First of all, create a data.table object.Then, use apply function to divide the data.table object row values by row sum.Create the data.table objectLet’s create a data.table object as shown below −library(data.table) xRead More

How to create density plot for categories filled with different colors in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 13-Aug-2021 11:55:42

257 Views

To create density plot for categories filled with different colors, we can follow the below steps −Frist of all, create a data frame.Load ggplot2 package and creating the density plot for the categories.Create the density plot for the categories in the data frame by using fill function.Create the data frameLet's ... Read More

How to create density plot for categories in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 13-Aug-2021 11:54:35

536 Views

To create density plot for categories, we can follow the below steps −Frist of all, create a data frame.Load ggplot2 package and creating the density plot for the whole data.Create the density plot for the categories in the data frame by using col function.Create the data frameLet's create a data ... Read More

Why mean is NaN even if na.rm is set to TRUE using dplyr in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 13-Aug-2021 11:53:17

654 Views

If na.rm is set to TRUE using dplyr package then the output for statistical operations returns NaN. To avoid this, we need to exclude na.rm. Follow below steps to understand the difference between the tw −First of all, create a data frame.Summarise the data frame with na.rm set to TRUE ... Read More

How to label points in scatterplot created by using xyplot in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 13-Aug-2021 11:52:25

314 Views

To label points in scatterplot created by using xyplot, we can follow the below steps −First of all, creating two numerical and one categorical vector.Loading lattice package and creating scatterplot.Creating the scatterplot with points labelled using categorical vector by panel.xyplot and ltext function.Creating the vectorsCreate three vectors, one categorical and ... Read More

How to display categorical column name in facet grid in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 13-Aug-2021 11:51:19

364 Views

To display categorical column name in facet grid, we can use the following steps −First of all, creating data frame.Loading ggplot2 package and creating a chart with facetsCreating the chart with facets and labeller function to display categorical column nameCreate the data frameLet's create a data frame as shown below ... Read More

Advertisements