- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2038 Articles for R Programming
![Nizamuddin Siddiqui](https://www.tutorialspoint.com/assets/profiles/218290/profile/60_42434-1594357075.jpg)
86 Views
To draw concentric circles, we can use draw.circle function of plotrix package where we can put lwd argument but firstly we would need to create a blank graph with plot function as shown below.For Example, we can create three concentric circles at position X=5 and Y=5 having radius of 1, 2, and 3 by using the below command −draw.circle(5, 5, c(1.5, 1, 0.5), col=c("yellow", "green", "orange"), lwd=2)ExampleConsider the following snippet −plot(1:10, type="n")OutputIf you execute the above given snippet, it generates the following Output −Add the following code to the above snippet −plot(1:10, type="n") library(plotrix) draw.circle(5, 5, c(1.5, 1, 0.5), col=c("yellow", ... Read More
![Nizamuddin Siddiqui](https://www.tutorialspoint.com/assets/profiles/218290/profile/60_42434-1594357075.jpg)
267 Views
To create matrix diagram, we can use corrplot function of corrplot function. For this purpose, we would need to set is.corr argument to FALSE so that the matrix values will be plotted in the diagram. Otherwise, the corrplot function requires correlation matrix instead of a matrix.Check out the Example given below to understand how it works.ExampleFollowing snippet creates a sample matrix −M
![Nizamuddin Siddiqui](https://www.tutorialspoint.com/assets/profiles/218290/profile/60_42434-1594357075.jpg)
207 Views
To create a random sample by excluding missing values of a data frame column, we can use sample function and the negation of is.na with the column of the data frame.For Example, if we have a data frame called df that contains a column X which has some NAs then we can create a random sample of size 100 of X values by using the following command −sample(df$X[!is.na(df$X)],100,replace=TRUE).Example 1Following is the code snippet to create dataframe −x
![Nizamuddin Siddiqui](https://www.tutorialspoint.com/assets/profiles/218290/profile/60_42434-1594357075.jpg)
846 Views
To create line chart for mean covered with minimum and maximum in R, we first need to create columns for row means, row minimum, and row maximum after that geom_line function can be used along with geom_ribbon function of ggplot2 package as shown in the below example.ExampleFollowing snippet creates a sample dataframe.x
![Nizamuddin Siddiqui](https://www.tutorialspoint.com/assets/profiles/218290/profile/60_42434-1594357075.jpg)
196 Views
To convert a correlation matrix into a logical matrix based on correlation coefficient in R, we can follow the below steps −First of all, create a matrix.Then, find the correlation matrix.After that, convert the correlation matrix into logical matrix based on coefficient value using greater than or less than sign.Example 1Let’s create a matrix as shown below − Live DemoM1
![Nizamuddin Siddiqui](https://www.tutorialspoint.com/assets/profiles/218290/profile/60_42434-1594357075.jpg)
406 Views
To find confidence interval for binomial distribution in R, we can use binom.confint function of binom package. This will result in confidence intervals based on many different methods. Check out the below examples to understand how it can be done.Example 1Loading Binom package and finding 95% confidence interval for a binomial distribution with sample of size 20 in which 5 outcomes are favourable −library(binom) binom.confint(5, 20, conf.level=0.95)Output method x n mean lower upper 1 agresti-coull 5 20 0.2500000 0.10808718 0.4724754 2 asymptotic 5 20 0.2500000 0.06022730 0.4397727 3 bayes ... Read More
![Nizamuddin Siddiqui](https://www.tutorialspoint.com/assets/profiles/218290/profile/60_42434-1594357075.jpg)
366 Views
To find the table of mean of a numerical column based on two factors in R data frame, we can follow the below steps −First of all, create a data frame with two factor and one numerical column.Then, find the table of mean of numerical column based on factor columns using tapply function.Example1Let’s create a data frame as shown below − Live DemoGroup1
![Nizamuddin Siddiqui](https://www.tutorialspoint.com/assets/profiles/218290/profile/60_42434-1594357075.jpg)
419 Views
To align the text horizontally in a bar plot created by using ggplot2 in R, we can follow the below steps −First of all, create a data frame.Then, create the bar plot using ggplot2 with text displayed on each bar.After that, create the same bar plot with text aligned horizontally.Create the data frameLet’s create a data frame as shown below − Live DemoCategory
![Nizamuddin Siddiqui](https://www.tutorialspoint.com/assets/profiles/218290/profile/60_42434-1594357075.jpg)
359 Views
To assign a value to a base R plot, we can follow the below steps −First of all, create a vector and its histogram then record it with recordPlot function in an object.Then, use dev.off function to remove the plot.After that, read the plot with object name.Create the vector and histogram then save it in an objectLet’s create a vector of normal distribution and create its histogram then save it in an object called Histogram using recordPlot as shown below − Live Demox
![Nizamuddin Siddiqui](https://www.tutorialspoint.com/assets/profiles/218290/profile/60_42434-1594357075.jpg)
1K+ Views
To display mean per group in facetted graph using ggplot2 in R, we can follow the below steps −First of all, create a data frame.Then, create the facetted scatterplot between two columns.After that, create the facetted scatterplot and add geom_line with mean calculated for y values.Create the data frameLet’s create a data frame as shown below − Live Demox