Nizamuddin Siddiqui has Published 1958 Articles

How to create a column of log with base 2 in data frames stored in R list?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 07:58:37

263 Views

To create a column of log with base 2 in data frames stored in R list, we can follow the below steps −First of all, create a list of data frames.Then, use lapply function to create a column of log with base 2 in data frames stored in the list.ExampleCreate ... Read More

How to create a column of square in data frames stored in R list?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 07:45:38

229 Views

To create a column of square in data frames stored in R list, we can follow the below steps −First of all, create a list of data frames.Then, use lapply function to create a column of square in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame ... Read More

Replace numerical column values based on character column values in R data frame.

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 07:45:35

1K+ Views

To replace numerical column values based on character column values in R data frame, we can use subsetting with single square brackets and %in% operator and the value will be assigned with

How to split a data frame by column in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 07:44:52

3K+ Views

If we have a data frame column that contains some duplicate values or represent categories then we might want to split the data frame based on that column.For example, if we have a data frame called df that contains a column say Col then we can split the data frame ... Read More

How to create a column of division in data frames stored in R list?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 07:43:19

175 Views

To create a column of division in data frames stored in R list, we can follow the below steps −First of all, create a list of data frames.Then, use lapply function to create a column of division in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame ... Read More

How to write text outside plot using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 07:40:59

11K+ Views

To write text outside plot using ggplot2, we can use annotate function and coord_cartesian function. The annotate function will define the text value and the coord_cartesian function will define the position of the text outside the plot area.Check out the below example to understand how it works.ExampleFollowing snippet creates a ... Read More

Find the mean of multiple columns based on multiple grouping columns in R data frame.

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 07:38:44

5K+ Views

To find the mean of multiple columns based on multiple grouping columns in R data frame, we can use summarise_at function with mean function.For Example, if we have a data frame called df that contains two grouping columns say G1 and G2 and two numerical columns say Num1 and Num2 ... Read More

How to cut a data frame column with minimum value in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 07:38:12

582 Views

To cut a data frame column with minimum value, we need to specify the minimum value withing cut function with the help of min function and set the include.lowest argument to TRUE. We can also specify the maximum value so that the maximum value is also taken into account while ... Read More

How to create a column of difference in data frames stored in R list?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 07:37:26

166 Views

To create a column of difference in data frames stored in R list, we can follow the below steps −First of all, create a list of data frames.Then, use lapply function to create a column of difference in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame ... Read More

How to create a matrix with only one row in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 07:36:31

1K+ Views

To create a matrix with only one row in R, we can set the nrow argument of matrix function to 1.For example, if we want to create a matrix say M with only one row then it can be done by using the command given below −M

Advertisements