Skip to contents

Graph Wrappers

These are wrapper functions around common ggplot2 functions. They’re designed to make it easier to make graphs.

adl_bar_plots()
Create bar plots in ADL's style
adl_coef_plots()
Create coefficient plots in ADL's style
stat_density_quant()
Stat for density ridgeline plots

Themes

Full blown ggplot2 themes that affect almost all visual aspects of a graph. These are similar to ggplot2 themes like ggplot2::theme_minimal() or ggplot2::theme_gray().

theme_default()
Default theme
theme_v_bar()
Theme for vertical non-stacked bar plots
theme_h_bar()
Theme for non-stacked horizontal bar plots
theme_h_stack()
Theme for horizontal stacked bar plots
theme_coef()
Theme for coefficient plots
hc_theme_default()
The default theme for hc charts

Other graphing stuff

scale_adl()
ADL color scale
adl_palettes
Complete list of available adl official color palettes

Data transformations

case_match_fct()
case_match with factor levels
case_when_fct()
case_when with factor levels
make_factor()
Convert a labelled vector into a factor
make_quarts()
Create quartiles
make_dicho()
Make dichotomous factors
make_binary()
Make binary variables
num_rev()
Reverse a numeric function
refactor()
Assign or reorder factor levels manually
pct_conv()
Make proper percent labels
make_percent()
Convert a numeric vector to a percent
pivot_longer_values()
Pivot data from wide to long with value labels

Data analysis

These are miscellaneous functions created to help with data analysis.

dunnett()
Run Dunnett's multiple comparisons test with one control.
get_coefficients()
Create a tidied tibble of regression results
get_means()
Calculate means with confidence intervals
get_freqs()
Calculate weighted frequencies
get_freq_table()
Get the frequencies as a GT table
get_all_freqs()
Export frequencies for a set of variables to a word doc.
get_corr()
Calculate weighted correlations
get_all_corr()
Get correlations for a combination of variables
get_loadings()
Calculate the loadings in factor analysis
prettytable()
Make pretty HTML tables
wtd_corr()
Calculate individual weighted correlations

Attribute helpers

attr_var_label()
Get variable label
attr_val_labels()
Get value labels
attr_levels()
Get variable label
attr_note()
Get the note attribute
attr_question_preface()
Get the question_preface attribute
attr_survey_flow()
Get the survey_flow attribute
attr_transformation()
Get the transformation attribute
flatten_labelled_vec()
Flatten a labelled vector

Miscellaneous functions

remove_bot_dupe()
Remove bots and/or duplicates from a data frame
get_bot_dupe()
Get the bots or duplicates from a data frame
export_bot_dupe()
Export data frame with only bots and duplicates
codebook()
Create a data codebook
clean_demos()
Clean up demographic variables
dunnett_helper()
Perform Dunnett's test (mostly internal function)
make_df_oxy()
Automate dataset documentation
stars_pval()
Add stars based on the p-value
write_word_table()
This mainly an internal package but can be used externally
wtd_sd()
Calculate weighted standard deviation

Data

test_data
dataset_title,