Nizamuddin Siddiqui

Nizamuddin Siddiqui

1,958 Articles Published

Articles by Nizamuddin Siddiqui

Page 122 of 196

How to select data.table object columns based on their class in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 12-Nov-2021 527 Views

To select data.table object columns based on their class in R, we can follow the below steps −First of all, create a data.table object.Then, use str function to check the structure of the object.After that, use select_if function from dplyr package to select the columns based on their class.Example 1Create the data.table objectLet’s create a data.table object as shown below −library(data.table) x1

Read More

How to remove dollar sign from a column of a data.table object in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 12-Nov-2021 467 Views

To remove dollar sign in data.table object in R, we can follow the below steps −First of all, create a data.table object.Then, use gsub function along with lapply function to remove dollar sign.ExampleCreate the data.table objectLet’s create a data.table object as shown below −library(data.table) Sale_Price

Read More

How to add rows in an R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 12-Nov-2021 461 Views

To add rows in an R data frame, we can follow the below steps −First of all, create a data frame.Then, use rbind function and the vectors that will be added as rows to the data frame.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to find the percent of zeros in each row of an R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 12-Nov-2021 491 Views

To find the percent of zeros in each row of an R data frame, we can follow the below steps −First of all, create a data frame.Then, use rowSums function along with ncol function to find the percent of zeros in each row of the data frame.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to subset an R data frame by ignoring a value in one of the columns?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 12-Nov-2021 798 Views

To subset an R data frame by ignoring a value in one of the columns, we can follow the below steps −First of all, create a data frame.Then, use single square brackets to subset the data frame by ignoring a value in one of the columns.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to remove percentage sign at last position from every value in R data frame column?

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

To remove percentage sign at last position from every value in R data frame column, we can follow the below steps −First of all, create a data frame with a column having percent sign at last position in every value.Then, use gsub function to remove the percent sign at last position from every value in the column.ExampleCreate the data frameLet’s create a data frame as shown below −var

Read More

How to find the absolute maximum of each group in R data frame?

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

To find the absolute maximum of each group in R data frame, we can follow the below steps −First of all, create a data frame.Then, use summarise_each function of dplyr package along with which.max and abs function to find the absolute maximum of each group after grouping with group_by.Example 1Create the data frameLet’s create a data frame as shown below −x

Read More

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

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 12-Nov-2021 142 Views

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

Read More

How to convert values in alternate rows to negative in R data frame column?

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

To convert values in alternate rows to negative in R data frame column, we can follow the below steps −First of all, create a data frame.Then, use vector multiplication with 1 and minus 1 to convert values in alternate rows to negative.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to find the percent of NA's in R data frame rows?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 12-Nov-2021 630 Views

To find the percent of NAs in each row of an R data frame, we can follow the below steps −First of all, create a data frame.Then, use rowSums function and ncol function along with apply function to find the percent of NAs in each row of the data frameExampleCreate the data frameLet’s create a data frame as shown below −v1

Read More
Showing 1211–1220 of 1,958 articles
« Prev 1 120 121 122 123 124 196 Next »
Advertisements