Nizamuddin Siddiqui

Nizamuddin Siddiqui

1,958 Articles Published

Articles by Nizamuddin Siddiqui

Page 124 of 196

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

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 12-Nov-2021 632 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

How to change the sign of even number rows in an R data frame column?

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

To change the sign of even number rows in an 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 change the sign of even number rows.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to multiply row values in a data frame having multiple rows with single row data frame in R?

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

To multiply row values in a data frame having multiple rows with single row data frame in R, we can follow the below steps −First of all, create a data frame with multiple rows and a data frame with single row.Then, use mapply function to multiply row values in the data frame having multiple rows with single row data frame.ExampleCreate the first data frameLet’s create a data frame as shown below −x

Read More

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

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

To find the row standard deviation of columns having same name in data.table object in R, we can follow the below steps −First of all, create a data.table object with some columns having same name.Then, use tapply along with colnames and sd function to find the row standard deviation of columns having same name.ExampleCreate the data.table objectLet’s create a data.table object as shown below −library(data.table) DT

Read More

How to find the percentage of zeros in each column of a data frame in R?

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

To find the percentage of zeros in each column of a data frame in R, we can follow the below steps −First of all, create a data frame.Then, use colSums function along with nrow function to find the percentage of zeros in each column.Example 1Create the data frameLet’s create a data frame as shown below −x

Read More

How to multiply corresponding values from two data frames in R?

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

To multiply corresponding values from two data frames in R, we can follow the below steps −First of all, create two data frames.Then, use mapply function to multiply corresponding values from those two data frames.ExampleCreate the first data frameLet’s create a data frame as shown below −df1

Read More

How to create a column of first non-zero value in each row of an R data frame?

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

To create a column of first non-zero value in each row of an R data frame, we can follow the below steps −First of all, create a data frame with some zero values.Then, use apply function and a custom function to find the first non-zero in each row of the data frame.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to unsplit a split data.table object in R?

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

To unsplit a split data.table object in R, we can follow the below steps −First of all, create a data.table object.Then, use split function to split the data.table object.After that, use do.call function along with rbind function unsplit the data frame.ExampleCreate the data.table objectLet’s create a data.table object as shown below −library(data.table) Grp

Read More

Create ggplot2 graph with reversed Y-axis and X-axis on top in R.

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

To create ggplot2 graph with reversed Y-axis and X-axis on top, we can use scale_y_reverse and scale_x_continuous function of ggplot2 package.For Example, if we have a data frame called df that contains two columns say X and Y and we want to create the scatterplot between X and Y with reversed Y-axis and X-axis on top then we can use the below command −ggplot(df,aes(X,Y))+geom_point()+scale_y_reverse()+scale_x_continuous(position="top")ExampleFollowing snippet creates a sample data frame −x

Read More

How to create correlation matrix plot without variables labels in R?

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

To create correlation matrix plot without variables labels in R, we can use tl.pos argument set to n.For Example, if we have a correlation matrix say M then we can create the correlation matrix plot without variables labels by using the below command −corrplot(M,tl.pos='n')ExampleFollowing snippet creates a sample data frame −x

Read More
Showing 1231–1240 of 1,958 articles
« Prev 1 122 123 124 125 126 196 Next »
Advertisements