Basic R Notation/Functions Flashcards
<-
assignment like = in python
x assigned 10 (x <- 10)
~
operator to separate left and right sides of equation
#
used to comment out things
attach()
attaches data frame to a search path
makes it to where you don’t have to state path with a variable, can just say variable name
boxplot()
creates box and whisker plots
c()
combines values into a vector
c(“app”, “ban”, “ora”)
cor()
computes correlation coefficient between 2 variables
cor(x, y)
dir()
lists all of the files in a directory
head()
shows first few rows of a data frame
hist()
creates a histogram
hist(data, main =, xlab =)
ls()
lists the names of objects in the environment
if you’ve created x, y, and z variables, it will list those out
names()
outputs field headers in a table
plot()
could create scatter, line, or histogram
rm(list=ls())
deletes all objects in the current workspace like variables, functions, or objects
summary()
basic descriptive stats