R Programming commands Flashcards

Understand basic R commands

1
Q

How would you calculate Probabilities in R?

A

Using the “dbinom” function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the command to carry out a Shapiro-Wilks test?

A

shapiro.test(sample(residuals(model_1), N, replace=F))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How would you make a Histogram in R?

A

Hist(x, x-axis-label, y-axis-label, main-title)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How would you make a boxplot in R?

A

boxplot(x1~x2, notch=T/F, col=c(colours of boxplots))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How would you make a scatterplot in R?

A

plot(x=x1, y=x2, xlab= , ylab= )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are squared brackets used for in R?

A

To select or subset data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How might you make an ANOVA table in R?

A

summary(aov(x1~x2, data= ))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does this function;
pt(q, df=30, lower.tail=TRUE)
do?

A

Calculates the probability that a variable is less than or equal to q

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does this function;
qt(p, df=30, lower.tail=TRUE)
do?

A

Returns a quantile q associated with the probability p being in the lower tail

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does “/n” do in R?

A

Wraps text onto a second line in a title/ axis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly