Arguments Flashcards
How do you create a vector?
c (…)
How do you calculate the sum of all elements in a vector?
Sum (any_vector)
How do you create a matrix?
matrix(…)
How do you fill in the data by row in a matrix?
byrow = TRUE
How do you indicate the number of rows in a matrix?
nrow =
How do you calculate the totals for each row of a matrix?
rowSums (any_matrix)
How do you had a column or multiple columns to a matrix?
cbind( any matrix or vector)
How do you check the contents of a workspace?
ls ( )
How do you select all elements of a row or column?
any_matrix [1,] or any_matrix [,1]
What is a factor?
A factor refers to a statistical data type used to store categorical variables.
What is a categorical variable?
A variable that can belong to a limited number of categories.
What is a continuous variable?
A variable that can belong to an infinite number of values.
What is a nominal variable?
A variable without an implied order
What is a nominal variable?
A variable with an implied order. (High, Medium, Low)
How do you tell a vector that it is nominal or ordered?
factor( any_vector, order = TRUE, levels = c (“High”, “Medium”, “Low”)