Programming with R Part 2 Flashcards
How do you simulate data with R?
rnorm
Why is setting the seed important?
So that you have the same randomness every time (repeatability)
Why is it important to sample?
In the event that you have a large dataset, you can just work on a sample to test your algorithms
How do you set matrices?
matrix(c(vector), nrow, ncol)
if you want to do algebra, what symbol do you need in order to signify that?
%
for example, %*% will allow you to multiply
How do you run a function?
apply(m, dimcode, function, functionArgs)
What is a list?
A vector that can contain elements of different modes/classes/data types
What are factors
Factors represent nominal/categorical data
> x x
[1] yes yes no yes no
Levels: no yes
What are data frames?
Stores tabular data
Basically a 2D list (a list of lists)