More R Flashcards

1
Q

What is R

A

a programming language used for data analytics, statistics

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

how is it similar to python

A

it is an interpreted language

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

object names rules

A

letters, names and underscores only

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

data structures in r

A

vector, list one dimension. matrix, dataframe, 2 dimension

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

how to index vectors

A

vector[2]. or vector[c(2,3)]

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

format of matrices

A

mymatrix = matrix(vector, nrow = x, ncol = y, byrow = False, dimnames = list(c(“row names”), c(“column names”)))

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

how to index matrices

A

y[,4] # 4th column of matrix
y[3,] # 3rd row of matrix
y[2:4,1:3] # rows 2,3,4 of columns 1,2,3

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

are lists ordered

A

yes

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

can lists contain elements of different types

A

yes

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

how to index lists

A

thisisalist[[2]]

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

do all columns in the matrix have to have the same mode (numeric, integer, factor, text)

A

Yes

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

can different columns in the data frame have different modes

A

yes

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

what is the code for dataframes

A

mydata = data.frame(vector1, vector2, vector3)

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

how to index dataframes

A

dataframe[1:3, 2:4]
mydata[c(“ID”, “Passed”)] (the column names)
mydata$X1 (the column X1)

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