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
R Programming Articles
Page 14 of 174
How to convert ggplot2 graph into a plotly graph in R?
To convert ggplot2 graph into a plotly graph in R, we can follow the below steps −First of all, create a data frame.Then, create a ggplot2 graph and save it in an object.After that, load plotly package and create the ggplot2 graph using ggplotly function.Create the data frameLet's create a data frame as shown below −x
Read MoreHow to define the number of breaks in base R histogram?
To define the number of breaks in base R histogram, we can use breaks argument along with hist function.Create the histogram with small number of breaksUse a vector with normal distribution and the histogram of the same vector with ten breaks −x
Read MoreHow to display base R plot axes titles in italics?
To display base R plot axes titles in italics, we can follow the below steps −First of all, create two vectors and plot them using plot function.Then, use expression function for ylab and xlab to change the axes titles into italics font.Create the vectors and plot themLet’s create two vectors Rate and Demand and plot them using plot function −Rate
Read MoreHow to convert numeric levels of a factor into string in R data frame?
To convert numeric levels of a factor into string in R data frame, we can follow the below steps −First of all, consider an in-built data set or create new one.Then, use mutate function with ifelse to create string column based numeric column representing a factor.Consider an-inbuilt data setLet’s have a look at mtcars data set in base R −data(mtcars) head(mtcars, 25)On executing, the above script generates the below output(this output will vary on your system due to randomization) −Output mpg cyl disp hp drat wt qsec vs am gear ...
Read MoreHow to create grouped line chart using ggplotly in R?
To create grouped line chart using ggplotly in R, we can follow the below steps −First of all, create a data frame.Then, create the line chart using ggplot2.After that, convert the ggplot2 chart into ggplotly chartCreate the data frameLet’s create a data frame as shown below −x
Read MoreHow to display X-axis labels inside the plot in base R?
To display X-axis labels inside the plot in base R, we can follow the below steps −First of all, create a plot without X-axis labels and ticks.Then, display the labels inside the plot.After that, display the ticks inside the plot.Create the plotUsing plot function, create a plot without X-axis labels and ticks −plot(1:10, 1:10, xaxt="n", type="n")OutputDisplay the axis labels inside the plotUsing text function to display the X-axis labels inside the plot −plot(1:10, 1:10, xaxt="n", type="n") text(1:10, 1, 1:10, cex=0.8)OutputDisplay the axis ticks inside the plotUsing axis function to display the X-axis ticks inside the plot −plot(1:10, 1:10, xaxt="n", type="n") ...
Read MoreHow to convert a row into column names in R?
To convert a row into column names in R, we can follow the below steps −First of all, create a data frame.Convert the row into column names by using colnames function and subsetting the data frame.Create the data frameLet’s create a data frame as shown below −x
Read MoreHow to display count on Y-axis for line chart using ggplot2 in R?
To display count on Y-axis for line chart using ggplot2 in R, we can follow the below steps −First of all, create a data frame.Then, create the line chart using geom_line function of ggplot2 package with fill argument counting the values using count function and binwidth set to 1.Create the data frameLet’s create a data frame as shown below −x
Read MoreHow to create scatterplot by standardizing the columns of a data frame using ggplot2 R?
To create scatterplot by standardizing the columns of a data frame using ggplot2 R, we can follow the below steps −First of all, create a data frame.Then, create the scatterplot using ggplot2 with raw values.After that, create the scatterplot with scale function.Create the data frameLet’s create a data frame as shown below −x
Read MoreHow to print matrix without line numbers in R?
To print matrix without line numbers in R, we can follow the below steps −First of all, create a matrix.Then, print the matrix with as.data.frame and row.names argument set to FALSE.Example1Create the matrixLet’s create a matrix as shown below −M1
Read More