Nizamuddin Siddiqui has Published 2307 Articles

How to multiply corresponding row values in a data.table object with single row data.table object in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 06:13:14

314 Views

To multiply row values in a data.table object having multiple rows with single row data.table object in R, we can follow the below steps −First of all, create a data.table object with multiple rows and a data.table object with single row.Then, use mapply function to multiply row values in those ... Read More

Change the color of legend element border using ggplot2 in R.

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 06:10:47

3K+ Views

To change the color legend element border using ggplot2, we can use theme function where can put color in legend.key argument to desired color with element_rect.For Example, if we have a data frame called df that contains three columns say X and Y and F where X and Y are ... Read More

How to change the sign of even number rows in column of a data.table object in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 06:10:11

81 Views

To change the sign of even number rows in a data.table object in R, we can follow the below steps −First of all, create a data.table object.Then, use vector multiplication with 1 and minus 1 to change the sign of even number rows.ExampleCreate the data.table objectLet’s create a data.table object ... Read More

How to find the row variance of columns having same name in R matrix?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 06:05:15

73 Views

To find the row variance of columns having same name in R matrix, we can follow the below steps −First of all, create a matrix with some columns having same name.Then, use tapply along with colnames and var function to find the row variance of columns having same name.ExampleCreate the ... Read More

Remove grey color from legend display using ggplot2 in R.

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 06:04:23

3K+ Views

To remove grey color from legend display using ggplot2, we can use theme function where we can fill legend.key argument to white with element_rect.For Example, if we have a data frame called df that contains three columns say X and Y and F where X and Y are numerical and ... Read More

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

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 06:01:24

156 Views

To find the square root 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 square root of each value in columns if some ... Read More

How to cover legend in a box using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

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

2K+ Views

To cover legend in a box using ggplot2 in R, we can use theme function with legend.box.background and legend.box.margin argument. The legend.box.background will have a rectangular element with the help of element_rect and margin values will be set in legend.box.margin.Check out the Example given below to understand how it can ... Read More

How to find the column minimum if some columns are categorical in R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 05:56:37

73 Views

To find the column minimum 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 column minimum if some columns are categorical.ExampleCreate the data frameLet’s create a data frame ... Read More

How to display legend on top using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 05:49:36

116 Views

To display legend on top using ggplot2 in R, we can use theme function with legend.justification argument to top.For Example, if we have a data frame called df that contains three columns say X and Y and F where X and Y are numerical and F is categorical then we ... Read More

How to change the text size of Y-axis title using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 09-Nov-2021 05:45:18

2K+ Views

By default, the text size of axes titles are small but if we want to increase that size so that people can easily recognize them then theme function can be used where we can use axis.title.y argument for Y-axis and axis.title.x argument for X-axis with element_text size to larger value.Check ... Read More

Advertisements