R commands y1 Flashcards
What is the command to read in a data file?
yourname<-read.csv(“filename.txt”,h=T)
How to take a random sample of a dataset that you specify?
sample(c(“”,””,””),x)
where x is the amount of sample you are pulling out
How would you use function x work with dataset Y?
x(y)
What is the function of adding all of the values in a dataset?
sum
What is the function of finding the mean of a datset?
mean
What is the function of finding the maximum value in a dataset?
median
What is the function of finding the variance in a dataset?
var
What is the function of finding the standard deviation of a dataset?
sd
What is the function for a shapiro wilk test for normality of a dataset?
shapiro.test(dataset)
What happens if the p from a shapiro wilk test is >0.05?
The data is not significantly different from a normal distribution thus it is normal
What happens if the p from a shapiro wilk test is <0.05?
The data is significantly different from a normal distribution thus it is not normal
How do you make a bar chart?
create a table of the data
barplot(table(dataset))
How to make a histogram?
hist
How do you plot two variables on a scatterplot?
plot(varA,varB)
How to create a boxplot?
boxplot(data1$x~data1$y)
data1 = name of file you are calling data from
$ = allows you to extract elements by name from a list or data file