Data Types Flashcards
getwd()
Returns the current working directory
setwd()
sets the current working directory
source()
loads the contents of a file
ls()
lists objects in a given workspace
dir()
lists files in the current working directory
What happens when you try to include elements of multiple classes in a vector?
Certain elements are “coerced”, such that the class of that element is changed to a different type
This can have unexpected results
What object can contain elements of different classes?
A list
What are two functions used to create vectors, and what are their differences?
vector() and c()
With vector(), you have to pass a “mode” (atomic class type or “list”), and the vector length
By default c() combines its arguments to form a vector
How do you force a number to be represented as an integer?
Append an “L” to it, e.g. 1L
How is infinity represented in R
Inf
How is “not a number” represented in R
NaN
How are missing values represented in R?
NA
What is a set of instructions typed at the R prompt called?
An expression
What is the assignment operator?
<-
How is a string represented?
As a character vector