5 Flashcards

1
Q

List in R?

A

A vector like thing where the elements can be anything in the same list.

list()

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

Sublist in R?

A

x[c(x, b)]

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

Extracting value from a list?

A

x$name_of_element or x[[1]] where first square brackets get the name of element place and the second extract the value of it.

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

Dataframe in R?

A

data.frame(vector1, vector2, vector3, vector4, vector5, stringsAsFactors = FALSE), since we don’t want our strings to be turned into factors, where the vectors get turned into columns.

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

What do the rows of a data frame mean?

A

The characteristics

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

Combine the rows/characteristics of two the same data frames to one?

A

rbind(dataframe1, dataframe2)

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

How to add a new vectors/columns to a dataframe?

A

cbind(dataframe, vector)

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

Extract column from dataframe?

A

dataframe$column_name, dataframe[rows,columns]

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

Scatterplot?

A

plot(x, y, xlab = “x label”, ylab = “y label”, main = “title”)

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

qqplot?

A

qqplot(x, y)

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

Mosaic plot?

A

mosaicplot(~y+z, data = dataframe, xlab, ylab, main, col=c())

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

Boxplot?

A

boxplot(dataframe$column, horizontal = TRUE/FALSE, )

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

Comparing box plots?

A

boxplot(numerical_vector/column1~categorical_vector/column2, data = dataframe)

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

Barplot?

A

barplot(table(vector)) so it can give you the counts/frequencies of each categorical variable.

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

Which must be equal lengths of the two vectors: scatter plot or qqplot?

A

Scatter plot

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

x grouped by y?

A

x~y