Nizamuddin Siddiqui

Nizamuddin Siddiqui

1,958 Articles Published

Articles by Nizamuddin Siddiqui

Page 65 of 196

How to convert a row into column names in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Aug-2021 3K+ Views

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 − Live Demox

Read More

How to display X-axis labels inside the plot in base R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Aug-2021 1K+ Views

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 − Live Demoplot(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 − Live Demoplot(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 − Live Demoplot(1:10, ...

Read More

How to display base R plot axes titles in italics?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Aug-2021 2K+ Views

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 − Live DemoRate

Read More

How to create grouped line chart using ggplotly in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Aug-2021 564 Views

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 − Live Demox

Read More

How to convert numeric levels of a factor into string in R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Aug-2021 1K+ Views

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 − Live Demodata(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 ...

Read More

How to define the number of breaks in base R histogram?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Aug-2021 4K+ Views

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 − Live Demox

Read More

How to check the data frame structure without using str function in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Aug-2021 252 Views

To check the data frame structure without using str function in R, we can follow the below steps −First of all, load the data or create new data or use an in-built data set.Then, use glimpse function of tibble package.Example 1Use in-built data setConsider the mtcars data set, load the tibble package and use glimpse function to look at the structure of mtcars data −library(tibble) glimpse(mtcars)OutputRows: 32 Columns: 11 $ mpg   21.0, 21.0, 22.8, 21.4, 18.7, 18.1, 14.3, 24.4, 22.8, 19.2, 17.8, ~ $ cyl   6, 6, 4, 6, 8, 6, 8, 4, 4, 6, 6, 8, 8, ...

Read More

How to convert ggplot2 graph into a plotly graph in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Aug-2021 3K+ Views

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 − Live Demox

Read More

How to display NA group values in scatterplot created with ggplot2 using color brewer in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Aug-2021 520 Views

To display NA group values in scatterplot created with ggplot2 using color brewer in R, we can follow the below steps −First of all, create a data frame.Then, create the scatterplot with default colors.After that, use scale_color_brewer function to create the scatterplot with color of points (including NA) based on color palette given in scale_color_brewer.Create the data frameLet's create a data frame as shown below − Live Demox

Read More

How to combine multiple columns into one in R data frame without using column names?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 10-Aug-2021 3K+ Views

To combine multiple columns into one in R data frame without using column names, we can follow the below steps −First of all, create a data frame.Then, convert the data frame into a single column data frame.Again, convert the data frame into a single column without column names displayed in rows using row.names function.Create the data frameLet's create a data frame as shown below −Example Live Demox

Read More
Showing 641–650 of 1,958 articles
« Prev 1 63 64 65 66 67 196 Next »
Advertisements