R Flashcards
Common functions you can use to preview data
Colname()
Str()
Glimpse()
Head()
Rename()
Rename(dataset, col_name = new col_name, col_name2 = new col_name2
Ggplot
Loaded with tidyverse
Ggplot(data = diamonds, aes(x = carat, y = price)) + geom_point()
Returns graph with carat and price as x and y axes
Facet_wrap()
Separates out components for a less busy visual
Variable
<-
Vector
A group of data elements of the same type stored in a one dimensional sequence in R
Pipe
%>%
Tool for expressing a sequence of multiple operations
Vector
group of data elements of the same type, stored in a sequence in R. You cannot have a vector that contains both logicals and numerics.
Tibble
Tibbles are data. frames that are lazy and surly: they do less (i.e. they don’t change variable names or types, and don’t do partial matching) and complain more (e.g. when a variable does not exist). This forces you to confront problems earlier, typically leading to cleaner, more expressive code.
Skim_without_charts(bookings_df)
Gives summary info (min, max, empty, average, etc) of each variable type
Geom_pount()
Creates scatterplots
Aes
Aesthetics, sets x and y axis, color, how it looks
Aes alpha
Transparent
Changes to all points(not variable dependent)
Do it outside the aes() function