Nizamuddin Siddiqui

Nizamuddin Siddiqui

1,958 Articles Published

Articles by Nizamuddin Siddiqui

Page 133 of 196

How to create a vector of matrices in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 10-Nov-2021 605 Views

As of now it is not possible to create a vector of matrices in R. If we want to do it, we should prefer a list, hence we can create a list with matrices.For Example, if we have matrices say M1, M2, and M3 and we want to create a list of these matrices then we can use the below given command −list(M1,M2,M3)ExampleTo create a vector of matrices in R, use the following snippet −List

Read More

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

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 10-Nov-2021 294 Views

To find the exponent 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 exponent if some columns are categorical.ExampleCreate the data frameLet’s create a data frame as shown below −Level

Read More

How to sort a numerical factor column in an R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 10-Nov-2021 2K+ Views

To sort a numerical factor column in an R data frame, we would need to column with as.character then as.numeric function and then order function will be used.For Example, if we have a data frame called df that contains a numerical factor column say F then we can use sort F by using the below mentioned command −df[order(as.numeric(as.character(df$F))),]Example 1Following snippet creates a sample data frame −Class

Read More

How to convert first letter into capital in R data frame column?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 10-Nov-2021 1K+ Views

To convert first letter into capital in R data frame column, we can follow the below steps −First of all, create a data frame with string column.Then, use sub function to convert first letter into capital in string column.ExampleCreate the data frameLet’s create a data frame as shown below −Names

Read More

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

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 10-Nov-2021 170 Views

To create a column of rounded values 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 rounded valuesin data frames stored in the list.ExampleCreate the list of data framesUsing data.frame function to create data frames and list function to create the list of those data frames −df1

Read More

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

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 10-Nov-2021 319 Views

To create a column of factorial values 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 factorial values in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame function to create data frames and list function to create the list of those data frames −df1

Read More

Find the count of unique group combinations in an R data frame.

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 10-Nov-2021 3K+ Views

To find the count of unique group combinations in an R data frame, we can use count function of dplyr package along with ungroup function.For Example, if we have a data frame called df that contains three grouping columns say G1, G2, and G3 then we can count the unique group combinations in df by using the below given command −count(df,G1,G2,G3)%%ungroup()Example 1Following snippet creates a sample data frame −Grp1

Read More

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

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 10-Nov-2021 297 Views

To create a column of absolute values 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 absolute values in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame function to create data frames and list function to create the list of those data frames −df1

Read More

How to find the cumulative sum of columns if some columns are categorical in R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 10-Nov-2021 284 Views

To find the cumulative sums 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 cumulative sums if some columns are categorical.ExampleCreate the data frameLet’s create a data frame as shown below −Gender

Read More

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

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 10-Nov-2021 205 Views

To create a column of exponent 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 exponent in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame function to create data frames and list function to create the list of those data frames −df1

Read More
Showing 1321–1330 of 1,958 articles
« Prev 1 131 132 133 134 135 196 Next »
Advertisements