R codes Flashcards
1
Q
Code for a scatterplot
A
plot(VN, VN, xlab=”VN”, ylab=”VN”)
2
Q
To add a line of best fit to scatterplot
A
Library(readx1)
abline(Lm(VN~VN), col = “red”)
3
Q
code for Z-score
A
codename$codename<-scale(VN, center=TRUE, scale=TRUE)
4
Q
Code to turn off scientific notion for really small p-values
A
options(scipen = 999)
5
Q
regression / ANOVA table
A
Model1 <- Lm(VN~VN)
summary(Model1)
6
Q
code for Pearsons
A
cor.test(VN, VN)
7
Q
code for Spearman’s
A
cor.test(VN, method= “spearman”)