Introduction to R Flashcards
1
Q
Assignment
A
-
2
Q
help(Syntax)
A
- Function with argument that lists all of the operators in R.
3
Q
mode()
A
- Function without argument that revels storage.
4
Q
typeof()
A
- Function without argument that reveals type of object.
- Similar to is(argument) function.
5
Q
setwd()
A
- Function without argument that changes your working directory.
6
Q
getwd()
A
- Function without argument that gets the current file path of your working directory.
7
Q
Object
A
- A storage space with an associated name.
- Everything in R is stored as an object.
8
Q
Object Naming Protocols
A
1) Case sensitive names.
2) Must start with a period or letter.
- If starts with a period, a letter must follow.
3) Periods can be found anywhere in an R name but the underscore cannot start a name.
4) Names cannot have spaces.
5) Names almost never take quotes around them.
9
Q
Functions
A
- A special type of R object that exist / are created to do something.
- Usually take arguments but can also have no arguments.
10
Q
Vectors
A
- An ordered sequence in R.
- No scalars exist in R = a single value is an vector of length 1.
- [1] denotes the first element on a vector in R.
- Two types: atomic and generic vectors.
11
Q
Atomic Vectors
A
- A vector containing only one data type.
12
Q
Generic Vectors (Lists)
A
- A vector that can contain more than one data type.
13
Q
Generating Vectors
A
- Can use two different functions:
1) seq()
2) c()
3) :
14
Q
:
A
- Known as the colon operator.
- Generates a sequence from:to in steps of 1.
- Can be in either increasing or decreasing order.
15
Q
seq()
A
- Known as the sequence function.
- Format of seq(from,to,by).
- Technically constructed as seq (from = a, to = b, by = c) but this is long.
- Can be in either increasing or decreasing order.