Intro to R Flashcards
Differentiate between:
1) R Script
2) Environment
3) R Console
4) Directory
script: top left. write code.
environment: top right. lists objects created
r console: output
directory: bottom right. help and plot tabs and where files stored.
What 3 things will we do with R?
1) calculations
2) make objects
3) use functions that interact with data
How to make code easier to read?
add space between operations or objects
How to create an object.
What is object
<- or =
boxes that hold other things
Rules for the name of an object
Cannt begin with number, no spaces, no special characters $%
What does an R function do? 3things
Takes in one or more input
Performs one or more actions with the input
Produces one or more output
Syntax of functions.
functionname(argument1,2)
How to set working directory
Session, set wd, source file location
or setwd()
What are in quotes? What aren’t
Quotes is text.
Not quotes is function name, object, argument, or special value
Csv full name
Comma separated value files
How to read csv
read.csv(“name”)
save contents in an object
2 things can do to view dataset
Type object into console
View()
Vectors
Objects that hold multiple data values of a datatype
How to make vector
Name <- c(“”)
Why use statistics?
Human reason or common sense can be misleading or contradictory