R commands y1 Flashcards

1
Q

What is the command to read in a data file?

A

yourname<-read.csv(“filename.txt”,h=T)

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

How to take a random sample of a dataset that you specify?

A

sample(c(“”,””,””),x)
where x is the amount of sample you are pulling out

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

How would you use function x work with dataset Y?

A

x(y)

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

What is the function of adding all of the values in a dataset?

A

sum

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

What is the function of finding the mean of a datset?

A

mean

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

What is the function of finding the maximum value in a dataset?

A

median

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

What is the function of finding the variance in a dataset?

A

var

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

What is the function of finding the standard deviation of a dataset?

A

sd

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

What is the function for a shapiro wilk test for normality of a dataset?

A

shapiro.test(dataset)

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

What happens if the p from a shapiro wilk test is >0.05?

A

The data is not significantly different from a normal distribution thus it is normal

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

What happens if the p from a shapiro wilk test is <0.05?

A

The data is significantly different from a normal distribution thus it is not normal

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

How do you make a bar chart?

A

create a table of the data
barplot(table(dataset))

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

How to make a histogram?

A

hist

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

How do you plot two variables on a scatterplot?

A

plot(varA,varB)

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

How to create a boxplot?

A

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

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

Binomial test where you input the data, and the assumption?

A

binom.test(#successes,#trials)
assumes probabilities are equal

17
Q

Binomial test where you input the data and probabilities?

A

binom.test(120,600,1/6)

18
Q
A