Functions used in Lectures
This document provides a running list of all packages and functions introduced in the lecture slides. I will try to update it each Tuesday, just before class. If I forget, please email me.
To get additional information:
-
learn about a package by typing
help(package = "PACKAGE_NAME")into the R console. -
find package tutorials by typing
browseVignettes(package = "PACKAGE_NAME") -
learn about a function by typing
??function_name(two question marks) into the R console.-
if you already have the package loaded into memory, you can just type
?function_name(one question mark) -
or, if you know the name of the package, you can type
?package_name::function_name -
or you can search for the function at
rdocumentation.org
-
if you already have the package loaded into memory, you can just type
Week 1: Introduction
Packages Used
- tibble
Functions Used
-
function() -
sum() -
exp() -
log() -
sqrt() -
library() -
tibble() -
runif() -
str() -
list() -
diag() -
try() -
c() -
mena() -
Mean() -
mean()
Week 2: Getting-To-Know-Your-Data
Packages Used
- tidyverse
- readr
Functions Used
-
library() -
theme_set() -
theme_grey() -
url() -
read_csv() -
str() -
summary() -
quantile() -
c() -
table() -
summarize() -
group_by() -
n() -
arrange() -
desc() -
count() -
mutate() -
ifelse() -
na() -
ggplot() -
aes() -
geom_col() -
ungroup() -
factor() -
geom_text() -
ggtitle() -
ylab() -
xlab() -
theme_minimal() -
theme() -
element_blank() -
element_rect() -
expand_limits() -
scale_fill_viridis_d() -
scale_y_continuous() -
unique() -
facet_wrap() -
element_text() -
scale_fill_brewer() -
select() -
hms() -
dmy() -
geom_histogram() -
scale_x_time() -
hours() -
seq() -
hour() -
case_when() -
summarise() -
across() -
gather() -
theme_gray()
Week 3: Importing-Data
Packages Used
- tidyverse
- janitor
Functions Used
-
library() -
read_csv() -
c() -
clean_names() -
print() -
names() -
parse_number() -
mutate() -
across() -
str_remove() -
str_remove_all() -
str_replace() -
str_replace_all() -
stri_replace_all_regex() -
fix_replacement() -
summary() -
filter() -
na() -
pivot_longer() -
ggplot() -
aes() -
geom_point() -
geom_smooth() -
facet_wrap() -
full_join() -
rename() -
ungroup() -
left_join() -
inner_join() -
anti_join() -
_join()
Week 4: Vizualize-Your-Data
Packages Used
- tidyverse
- choroplethr
- scales
Functions Used
-
library() -
mutate() -
select() -
where() -
filter() -
tibble() -
mean() -
default() -
str() -
table() -
all() -
seq() -
data() -
starts_with() -
pivot_longer() -
dim() -
theme_minimal() -
facet_wrap() -
theme() -
labs() -
str_to_title() -
str_remove() -
ggplot() -
aes() -
geom_point() -
geom_smooth() -
scale_x_continuous() -
dollar_format() -
scale_y_continuous() -
percent_format()
Week 5: Survey-Stats
Packages Used
- tidyverse
Functions Used
-
library() -
attach() -
ggplot() -
aes() -
geom_point() -
geom_smooth() -
data() -
tibble() -
dim() -
pivot_longer() -
pivot_wider() -
names() -
all() -
group_by() -
mutate() -
ungroup() -
filter() -
arrange() -
sum() -
desc() -
fct_reorder() -
coord_flip() -
theme_minimal() -
ggtitle() -
sqrt() -
round() -
read_csv() -
str() -
table() -
select() -
column() -
case_when() -
summary() -
mean() -
______() -
summarize() -
sd() -
na() -
nrow() -
c()
Week 6: Cause-And-Effect
Packages Used
- tidyverse
- ggdag
- choroplethr
- usmap
- haven
Functions Used
-
library() -
seed() -
runif() -
tibble() -
rep() -
group_by() -
summarise() -
mean() -
geom_col() -
ggplot() -
aes() -
read_tsv() -
filter() -
c() -
select() -
arrange() -
data() -
as_tibble() -
pivot_wider() -
mutate() -
slice() -
fips() -
numeric() -
left_join() -
inner_join() -
scale_x_continuous() -
dollar_format() -
scale_y_continuous() -
percent_format() -
xlab() -
ylab() -
ggtitle() -
theme_minimal() -
geom_point() -
geom_smooth() -
factor() -
ntile() -
scale_color_viridis_d() -
guide_legend() -
read_sav() -
zap_labels() -
case_when() -
between() -
integer() -
na_if() -
geom_jitter() -
geom_boxplot() -
ylim() -
scale_color_brewer() -
theme()
Week 7: Better-Plots
Packages Used
- tidyverse
- tidycensus
- fs
Functions Used
-
library() -
ntile() -
c() -
tibble() -
mutate() -
get_acs() -
select() -
pivot_wider() -
ggplot() -
aes() -
geom_point() -
geom_smooth() -
theme_gray() -
theme() -
theme_minimal() -
labs() -
scale_x_continuous() -
label_percent() -
scale_y_continuous() -
label_dollar() -
scale_size_continuous() -
guides() -
guide_legend() -
read_rds() -
count() -
print() -
top_n() -
fct_reorder() -
geom_col() -
coord_flip() -
xlab() -
ylab() -
geom_linerange() -
geom_text() -
expansion() -
element_blank() -
function() -
parse() -
list() -
seq_along() -
call() -
deparse() -
length() -
unlist() -
unique() -
possibly() -
get() -
environment() -
environmentName() -
dir_ls() -
filter() -
str_detect() -
str_remove() -
path_file() -
separate() -
group_by() -
distinct() -
map() -
ungroup() -
unnest() -
map_chr() -
coalesce()
Week 8: Presenting-Your-Work
Packages Used
character(0)
Functions Used
character(0)
Week 9: Midterm-Presentations
Packages Used
character(0)
Functions Used
-
c() -
setdiff() -
seed() -
sample() -
length() -
tibble() -
seq_along()
Week 10: Regression-1
Packages Used
- tidyverse
- moderndive
- broom
Functions Used
-
library() -
select() -
str() -
summary() -
cor() -
summarize() -
ggplot() -
aes() -
geom_point() -
labs() -
geom_jitter() -
seed() -
geom_smooth() -
lm() -
Pr() -
tidy() -
mean() -
table()
Week 11: Regression-2
Packages Used
- tidyverse
- lubridate
- modelsummary
- kableExtra
Functions Used
-
library() -
function() -
add_ten() -
tibble() -
map() -
c() -
map_df() -
files() -
read_tsv() -
str() -
if_else() -
mutate() -
create_dummy_var() -
lm() -
list() -
modelsummary() -
kable_styling() -
summary()
Week 12: Prediction
Packages Used
- tidyverse
- broom
Functions Used
-
library() -
case_when() -
seed() -
tibble() -
runif() -
round() -
mutate() -
c() -
between() -
summary() -
cor() -
pivot_longer() -
starts_with() -
ggplot() -
aes() -
geom_point() -
geom_line() -
facet_wrap() -
theme_minimal() -
scale_y_continuous() -
geom_linerange() -
group_by() -
summarise() -
mean() -
sd() -
n() -
sqrt() -
qt() -
factor() -
geom_col() -
geom_hline() -
geom_text() -
ifelse() -
position_dodge() -
coord_fixed() -
theme() -
element_blank() -
seq_len() -
scale_color_viridis_d() -
lm() -
I() -
function() -
augment() -
sum() -
pull() -
get_rmse() -
predict() -
ggtitle()
Week 13: Missing-Data
Packages Used
- haven
- tidyverse
- labelled
- knitr
- kableExtra
- janitor
- broom
Functions Used
-
library() -
read_sav() -
glimpse() -
tabyl() -
adorn_pct_formatting() -
mutate() -
as_factor() -
case_when() -
numeric() -
if_else() -
between() -
integer() -
na() -
median() -
labelled() -
val_labels() -
lm() -
summary() -
Pr() -
predict() -
round() -
select() -
starts_with() -
filter() -
pivot_longer() -
group_by() -
count() -
ungroup() -
complete() -
list() -
ggplot() -
aes() -
factor() -
geom_tile() -
facet_wrap() -
theme_minimal() -
scale_fill_gradient() -
xlab() -
ylab() -
theme() -
function() -
zap_labels() -
double() -
valid_to_na() -
c() -
seed() -
sample_frac() -
anti_join() -
join_by() -
nrow() -
coef() -
length() -
augment() -
drop_na() -
summarise() -
sum() -
n() -
sqrt() -
pull() -
get_rmse()
Most frequently used functions so far
| Function | Times Used |
|---|---|
| mutate() | 56 |
| aes() | 50 |
| c() | 44 |
| library() | 38 |
| ggplot() | 32 |
| I() | 30 |
| lm() | 30 |
| geom_point() | 24 |
| tibble() | 22 |
| ntile() | 20 |
| theme_minimal() | 20 |
| case_when() | 19 |
| summary() | 19 |
| filter() | 18 |
| group_by() | 18 |
| theme() | 18 |
| factor() | 16 |
| select() | 16 |
| table() | 16 |
| mean() | 15 |
| round() | 15 |
| geom_smooth() | 12 |
| get_rmse() | 11 |
| str() | 11 |
| clean_names() | 10 |
| geom_col() | 10 |
| element_blank() | 9 |
| facet_wrap() | 9 |
| ungroup() | 9 |
| across() | 8 |
| anti_join() | 8 |
| count() | 8 |
| function() | 8 |
| between() | 7 |
| nrow() | 7 |
| parse_number() | 7 |
| predict() | 7 |
| scale_y_continuous() | 7 |
| seed() | 7 |
| sum() | 7 |
| arrange() | 6 |
| labs() | 6 |
| left_join() | 6 |
| na() | 6 |
| names() | 6 |
| pivot_longer() | 6 |
| read_csv() | 6 |
| runif() | 6 |
| sqrt() | 6 |
| starts_with() | 6 |
| summarise() | 6 |
| summarize() | 6 |
| tabyl() | 6 |
| create_dummy_var() | 5 |
| dim() | 5 |
| full_join() | 5 |
| geom_jitter() | 5 |
| if_else() | 5 |
| list() | 5 |
| map_df() | 5 |
| numeric() | 5 |
| pivot_wider() | 5 |
| quantile() | 5 |
| xlab() | 5 |
| ylab() | 5 |
| Pr() | 4 |
| cor() | 4 |
| data() | 4 |
| desc() | 4 |
| geom_linerange() | 4 |
| ggtitle() | 4 |
| hour() | 4 |
| inner_join() | 4 |
| integer() | 4 |
| n() | 4 |
| str_remove() | 4 |
| add_ten() | 3 |
| as_factor() | 3 |
| coord_flip() | 3 |
| element_text() | 3 |
| fct_reorder() | 3 |
| geom_histogram() | 3 |
| geom_text() | 3 |
| length() | 3 |
| map() | 3 |
| scale_color_viridis_d() | 3 |
| scale_x_continuous() | 3 |
| str_detect() | 3 |
| str_replace() | 3 |
| str_replace_all() | 3 |
| ______() | 2 |
| _join() | 2 |
| adorn_pct_formatting() | 2 |
| all() | 2 |
| augment() | 2 |
| coord_fixed() | 2 |
| default() | 2 |
| diag() | 2 |
| dollar_format() | 2 |
| element_rect() | 2 |
| exp() | 2 |
| files() | 2 |
| geom_boxplot() | 2 |
| geom_line() | 2 |
| guide_legend() | 2 |
| hms() | 2 |
| ifelse() | 2 |
| labelled() | 2 |
| log() | 2 |
| median() | 2 |
| na_if() | 2 |
| percent_format() | 2 |
| possibly() | 2 |
| print() | 2 |
| pull() | 2 |
| read_sav() | 2 |
| read_tsv() | 2 |
| scale_fill_brewer() | 2 |
| scale_fill_viridis_d() | 2 |
| scale_x_time() | 2 |
| sd() | 2 |
| separate() | 2 |
| seq() | 2 |
| seq_along() | 2 |
| slice() | 2 |
| str_remove_all() | 2 |
| str_to_title() | 2 |
| theme_gray() | 2 |
| tidy() | 2 |
| top_n() | 2 |
| unique() | 2 |
| val_labels() | 2 |
| valid_to_na() | 2 |
| where() | 2 |
| ylim() | 2 |
| zap_labels() | 2 |
| Mean() | 1 |
| as_tibble() | 1 |
| attach() | 1 |
| call() | 1 |
| coalesce() | 1 |
| coef() | 1 |
| column() | 1 |
| complete() | 1 |
| deparse() | 1 |
| dir_ls() | 1 |
| distinct() | 1 |
| dmy() | 1 |
| double() | 1 |
| drop_na() | 1 |
| environment() | 1 |
| environmentName() | 1 |
| expand_limits() | 1 |
| expansion() | 1 |
| fips() | 1 |
| fix_replacement() | 1 |
| gather() | 1 |
| geom_hline() | 1 |
| geom_tile() | 1 |
| get() | 1 |
| get_acs() | 1 |
| glimpse() | 1 |
| guides() | 1 |
| hours() | 1 |
| join_by() | 1 |
| kable_styling() | 1 |
| label_dollar() | 1 |
| label_percent() | 1 |
| map_chr() | 1 |
| mena() | 1 |
| modelsummary() | 1 |
| parse() | 1 |
| path_file() | 1 |
| position_dodge() | 1 |
| qt() | 1 |
| read_rds() | 1 |
| rename() | 1 |
| rep() | 1 |
| sample() | 1 |
| sample_frac() | 1 |
| scale_color_brewer() | 1 |
| scale_fill_gradient() | 1 |
| scale_size_continuous() | 1 |
| seq_len() | 1 |
| setdiff() | 1 |
| stri_replace_all_regex() | 1 |
| theme_grey() | 1 |
| theme_set() | 1 |
| try() | 1 |
| unlist() | 1 |
| unnest() | 1 |
| url() | 1 |