R Programming commands Flashcards
Understand basic R commands
How would you calculate Probabilities in R?
Using the “dbinom” function
What is the command to carry out a Shapiro-Wilks test?
shapiro.test(sample(residuals(model_1), N, replace=F))
How would you make a Histogram in R?
Hist(x, x-axis-label, y-axis-label, main-title)
How would you make a boxplot in R?
boxplot(x1~x2, notch=T/F, col=c(colours of boxplots))
How would you make a scatterplot in R?
plot(x=x1, y=x2, xlab= , ylab= )
What are squared brackets used for in R?
To select or subset data
How might you make an ANOVA table in R?
summary(aov(x1~x2, data= ))
What does this function;
pt(q, df=30, lower.tail=TRUE)
do?
Calculates the probability that a variable is less than or equal to q
What does this function;
qt(p, df=30, lower.tail=TRUE)
do?
Returns a quantile q associated with the probability p being in the lower tail
What does “/n” do in R?
Wraps text onto a second line in a title/ axis