Cheat sheet of functions used in the lessons
sqrt()
# calculate the square rootround()
# round a numberargs()
# find what arguments a function takeslength()
# how many elements are in a particular vectorclass()
# the class (the type of element) of an objectstr()
# an overview of the object and the elements it containsc()
# create vector; add elements to vector[ ]
# extract and subset vector%in%
# to test if a value is found in a vectoris.na()
# test if there are missing valuesna.omit()
# Returns the object with incomplete cases removedcomplete.cases()
# elements which are complete cases
download.file()
# download files from the internet to your computerread.csv()
# load CSV file into R memoryhead()
# shows the first 6 rowsView()
# invoke a spreadsheet-style data viewerread.table()
# load a file in table format into R memorystr()
# check structure of the object and information about the class, length and content of each columndim()
# check dimension of data framenrow()
# returns the number of rowsncol()
# returns the number of columnstail()
# shows the last 6 rowsnames()
# returns the column names (synonym of colnames() for data frame objects)rownames()
# returns the row namessummary()
# summary statistics for each columnfactor()
# create factorslevels()
# check levels of a factornlevels()
# check number of levels of a factoras.character()
# convert an object to a character vectoras.numeric()
# convert an object to a numeric vectoras.numeric(as.character(x))
# convert factors where the levels appear as characters to a numeric vectoras.numeric(levels(x))[x]
# convert factors where the levels appear as numbers to a numeric vectorplot()
# plot an objectdata.frame()
# create a data.frame objectymd()
# convert a vector representing year, month, and day to a Date vectorpaste()
# concatenate vectors after converting to character
read_csv()
# load a csv formatted file into R memorystr()
# check structure of the object and information about the class, length and content of each columnView()
# invoke a spreadsheet-style data viewerselect()
# select columns of a data framefilter()
# allows you to select a subset of rows in a data frame%>%
# pipes to select and filter at the same timemutate()
# create new columns based on the values in existing columnshead()
# shows the first 6 rowsgroup_by()
# split the data into groups, apply some analysis to each group, and then combine the results.summarize()
# collapses each group into a single-row summary of that groupmean()
# calculate the mean value of a vector!is.na()
# test if there are no missing valuesprint()
# print values to the consolemin()
# return the minimum value of a vectorarrange()
# arrange rows by variablesdesc()
# transform a vector into a format that will be sorted in descending ordercount()
# counts the total number of records for each categoryspread()
# reshape a data frame by a key-value pair across multiple columnsgather()
# reshape a data frame by collapsing into a key-value pairn_distinct()
# get a count of unique valueswrite_csv()
# save to a csv formatted file
read_csv()
# load a csv formatted file into R memoryggplot2(data= , aes(x= , y= )) + geom_point( ) + facet_wrap () + theme_bw() + theme()
aes()
# by selecting the variables to be plotted and the variables to define the presentation such as plotting size, shape color, etc.geom_
# graphical representation of the data in the plot (points, lines, bars). To add a geom to the plot use + operatorfacet_wrap()
# allows to split one plot into multiple plots based on a factor included in the datasetlabs()
# set labels to plottheme_bw()
# set the background to whitetheme()
# used to locally modify one or more theme elements in a specific ggplot objectgrid.arrange()
# combine and arrange multiple ggplots into a single figureggsave()
# save a ggplot
dir.create()
# create a directorydownload.file()
# download files from the internet to your computerdbConnect()
# create a connection to a databaseSQLite()
# connect to a SQLite databasesrc_dbi()
# connect dplyr to a DBI-compatible database filetbl
# connect to a table within a databasesql()
# combine character vectors into a single SQL expressionshow_query()
# show which SQL commands are sent to the databasecollect()
# retrieve all the results from the databaseinner_join()
# perform an inner join between two tablessrc_sqlite()
# connect dplyr to a SQLite database filecopy_to()
# copy a data frame as a table into a database