Arguments Flashcards

1
Q

How do you create a vector?

A

c (…)

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

How do you calculate the sum of all elements in a vector?

A

Sum (any_vector)

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

How do you create a matrix?

A

matrix(…)

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

How do you fill in the data by row in a matrix?

A

byrow = TRUE

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

How do you indicate the number of rows in a matrix?

A

nrow =

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

How do you calculate the totals for each row of a matrix?

A

rowSums (any_matrix)

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

How do you had a column or multiple columns to a matrix?

A

cbind( any matrix or vector)

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

How do you check the contents of a workspace?

A

ls ( )

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

How do you select all elements of a row or column?

A

any_matrix [1,] or any_matrix [,1]

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

What is a factor?

A

A factor refers to a statistical data type used to store categorical variables.

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

What is a categorical variable?

A

A variable that can belong to a limited number of categories.

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

What is a continuous variable?

A

A variable that can belong to an infinite number of values.

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

What is a nominal variable?

A

A variable without an implied order

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

What is a nominal variable?

A

A variable with an implied order. (High, Medium, Low)

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

How do you tell a vector that it is nominal or ordered?

A

factor( any_vector, order = TRUE, levels = c (“High”, “Medium”, “Low”)

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

How do you specify the levels when creating a vector?

A

levels ( )

17
Q

How do you get the sum total of each factor in the data set?

A

summary(any vector or matrix)

18
Q

how do you show only the first observations in a data frame?

A

head ( any matrix or vector)

19
Q

how do you get the last observations in a data set?

A

tail (any vector or matrix)

20
Q

What does str( ) do?

A
Tells you: 
Total number of observations
Total number of variables
Full list of variable names
Data type of each variable
The first observations
21
Q

Vectors

A

(one dimensional array): can hold numeric, character or logical values. The elements in a vector all have the same data type

22
Q

Matrices

A

(two dimensional array): can hold numeric, character or logical values. The elements in a matrix all have the same data type.

23
Q

Data Frames

A

(two-dimensional objects): can hold numeric, character or logical values. Within a column all elements have the same data type, but different columns can be of different data type.

24
Q

A list in R

A

allows you to gather a variety of objects under one name (that is, the name of the list) in an ordered way. These objects can be matrices, vectors, data frames, even other lists, etc. It is not even required that these objects are related to each other in any way.

25
Q

what does == do?

A

checks the equality of two variables and outputs TRUE or FALSE

26
Q

trim = x/y

A

trim =, takes whatever fraction you input and applies it to the number of data inputs, and then removes that number from both the beginning and ending or highest and lowest points of the data inputs.