R related Questions and Commands
1. How to change directory in R?
File Change Dir Select the directory
2. How to read a dataset in R?
read.table("value.txt", header = T)
read.table("value.txt", fill = T, header = T)
3. How to use a dataset in R?
A = read.table("value.txt", header = T)
4. How to reproduce the table in R interface?
Use Answer 2. Also, Answer 3. Type A.
5. In R, how to work with header in data set?
See Answers 2 and 3. There should not be any gap in header names.
6. How to find basic statistics in R for a dataset?
summary(A)
summary(A$Obs1)
7. How to calculate average, standard deviation, variance and correlation in R?
mean(A$Obs1) or mean(A[,1])
mean(A[,4], na.rm = T)
sd(A[,1])
var(A[,1])
cor(A$Obs1, A$Obs2) or cor(A[,1],A[,2])
cor(A[1],A[2])
8. What is "Analysis Tool pack" add-in in Excel?
9. How to find basic statistics in Excel for a dataset?
10. How to draw Histogram in R?
Note: for histogram, no package is required
hist(A$Obs1)
Note: if you do not copy the graph, the graph will be deleted when next graph is produced.
11. How to add graph name, x-axis and y-axis names in R?
hist(A$Obs1, main = "Title", sub = "Table 1", xlab = "Horizontal", ylab = "Vertical")
12. How to define ranges for x-axis and y-axis in R?
hist(A$Obs1, xlim = c(0, 10), ylim = c(0, 50) Note: limits can be negative
13. How to draw Histogram in Excel?
14. How to draw Scatter plot in R?
plot(A$Data1,A$Data2)
15. How to draw Scatter plot in Excel?
16. How to install any package in R?
install.packages(qcc) Note: You need to use internet.
Download the package and unzip Go to C:Program files:R:library paste unzipped
package
17. How to call any package in R?
library(qcc)
18. How to draw Pareto chart in R when frequencies are given?
Note: needs package qcc
pareto.chart(A$City)
19. How to draw Pareto chart in R if frequencies are not given?
pareto.chart(table(A$City))
20. How to draw Pareto chart in Excel when frequencies are given?