Lab Quiz 5 Study Guide Flashcards

1
Q

Assign variables

A

y = 2
x = 4
etc

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

Assign multiple values to a variable

A

variable = c()
Inside add as many values separated by commas

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

Loading datasets

A

Environment, import dataset, choose dataset to load
or
data(dataset name) for stuff in the R dataset package

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

Subset a portion of data

A

Variable = subset(filename, dataset == “data”)

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

Take mean of data

A

mean(x)
mean(variable$data)
Second one for if you already made a variable to be more specific

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

How to make a plot

A

hist(x)
boxplot(x)
plot(x,y)

Make sure the inside of the parenthesis is dataset$data

For plot, you need to have two dataset$data, the first one being the x-axis

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

How to label axes in a plot

A

After dataset$data, add:
xlab = “<name>"
ylab = "<name>"
main = "<name>"
Separate everything with commas if you want to have these on a graph</name></name></name>

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

How to find slope and y-intercept for a plot

A

lm(y ~ x)
This is similar to the plot(,) except with lm instead of ‘plot’, ~ instead of a comma, and reverse the order of y and x. This will give you the slope and intercept of the trendline for the plot

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

How to make a trendline from slope and y-intercept

A

abline(intercept,slope)
Use the intercept and slope from lm(dataset$data ~ dataset$data)

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

Use dataset from RStudio

A

data(datasetname)

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