Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles by Nizamuddin Siddiqui
Page 61 of 196
How to find the maximum value of all matrices stored in an R list?
To find the maximum value of all matrices stored in an R list, we can follow the below steps −First of all, create a list of matrices.Then, use max function along with unlist and lapply function to find the maximum of all matrices.Create the list of matricesUsing matrix function to create multiple matrices and stored them in a list using list function − Live DemoM1
Read MoreHow to subset rows that contains maximum depending on another column in R data frame?
To subset rows that contains maximum depending on another column in R data frame, we can follow the below steps −First of all, create a data frame with one numerical and one categorical column.Then, use tapply function with max function to find the rows that contains maximum in numerical column based on another column.Example1Create the data frameLet's create a data frame as shown below − Live Demox
Read MoreHow to create a boxplot using ggplot2 with aes_string in R?
To create a boxplot using ggplot2 with aes_string in R, we can follow the below steps −First of all, create a data frame with one string and one numerical column.Then, use aes_string function of ggplot2 package to create the boxplot.Create the data frameLet's create a data frame as shown below − Live DemoX
Read MoreHow to create a bar chart for single vector using ggplot2 in R?
To create a bar chart for single vector using ggplot2 in R, we can follow the below steps −First of all, create a vector and melt it using melt function of reshape2 package and save the melted data.Then, create the bar chart with melted data using ggplot2.Create the vector and melt itCreating the vector and using melt function of reshape2 to melt the data in vector −x
Read MoreHow to save column means into a data frame in R?
To save column means into a data frame in R, we can follow the below steps −First of all, create a data frame.Then, find column means using colMeans function and save it in an object.After that, use as.data.frame function to save the columns means into a data frame.Create the data frameLet's create a data frame as shown below − Live Demox1
Read MoreHow to find the row that has maximum number of duplicates in an R matrix?
To find the row that has maximum number of duplicates in an R matrix, we can follow the below steps −First of all, create a matrix.Then, convert matrix into data.table then use order function with head function to find the row that has maximum number of duplicates.Create the matrixLet’s create a matrix as shown below − Live DemoM
Read MoreHow to create a scatterplot in base R with points depending on categorical column?
To create a scatterplot in base R with points depending on categorical column, we can follow the below steps −First of all, create a data frame.Then, use plot function to create the scatterplot with col argument and using categorical column with factor function.Create the data frameLet's create a data frame as shown below − Live Demox
Read MoreHow to create horizontal lines with two different colors after a threshold in R?
To create two horizontal lines with different color after a threshold in R, we can follow the below steps −First of all, create a plot in base R.Then, add a line to the plot using abline function.After that, use segments function to partially change the color of the line.Create the plotUsing plot function to create a plot in base R − Live Demoplot(1:5, 1:5, xlim=c(0, 5))OutputAdd a line to the plotUsing abline function to add a line to the plot − Live Demoplot(1:5, 1:5, xlim=c(0, 5)) abline(h=3)OutputPartially color the lineUsing segments function to color the with yellow color starting from 0 to ...
Read MoreHow to limit the length of regression line using ggplot2 in R?
To limit the length of regression line using ggplot2 in R, we can follow the below steps −First of all, create a data frame.Then, create the scatterplot using ggplot2 with regression line.After that, create the scatterplot with regression and add xlim function.Create the data frameLet's create a data frame as shown below − Live Demox
Read MoreHow to add regression residuals to data frame in R?
To add regression residuals to data frame in R, we can follow the below steps −First of all, create a data frame.Then, use lm function to create the regression model and find the residuals using resid function and adding them to the data frame with $ operator.Create the data frameLet's create a data frame as shown below − Live Demox
Read More