Skip to contents

Greetings and welcome to gvsu215!

I’ve tried to keep function names simple and required arguments to a minimum to help students focus on the statistical content rather than the R code. That being said, there are some more advanced features and capabilities built into the package that you as the instructor may take advantage of if you so choose.

Different R Markdown Export Formats

This package should be able to be used in any output format using R Markdown, including HTML1, PDF2, and Word. If this is not the case, reach out to Dr. John Gabrosek or submit an issue on GitHub.

output:
  pdf_document:
    latex_engine: xelatex

If you are exporting to Word documents, it is recommended to name your variables wisely (i.e., short but understandable). Sometimes, line breaks in table headers can be a little funky with Word documents. All static headers have forced line breaks that will break in between words; however, if variable names are too long or if there are too many columns in the table, the table will appear too squished and might add line breaks in places that are not ideal. You may also wish to force a page break for a table, which can be done by piping the table code into the flextable::paginate() function.

Extra Function Arguments

Many functions in this package have extra arguments that aren’t necessary for basic function features but can allow for a little customization depending on your pedagogical approach and preferences, such as if you are focusing on data literacy or proper axis labeling. Each of the functions listed below have extra arguments, which are detailed after the function name.

  • tbl_1var(), tbl_corr(), tbl_num_sum()
    • The digits argument can be specified with an integer value for the number of digits to round to. Defaults to 3.
    • The caption argument can be used to override the default caption.
    • The with_prop argument (defaults to “no”) can be set to “yes” to replace the percent column with the corresponding proportions.
    • The na_rm argument can be used to NOT remove missing values from the table (note that these functions remove missing values by default)
  • tbl_2var()
    • The row_pct argument can be used to add in row percentages in each cell.
    • The digits argument can be specified with an integer value for the number of digits to round to. Defaults to 3.
    • The caption argument can be used to override the default caption.
    • The na_rm argument can be used to NOT remove missing values from the table (note that missing values are removed by default)
  • tbl_pctile()
    • The probs argument can be used to specify which percentiles are to be given. Simply pass in a vector of values between 0 and 1.
    • The digits argument can be specified with an integer value for the number of digits to round to. Defaults to 3.
    • The caption argument can be used to override the default caption.
  • plot_bar()
    • The type argument can be used to specify if a plot with percents or counts is desired.
    • The fill argument can be used to choose a fill color (for a single variable plot).
    • The layout argument can be used to swap between side-by-side (sbs, the default) and stacked bar plots (stack).
    • The orient argument can be used to flip the axis. Choose either “vertical” (the default) or “horizontal”.
    • The dodge argument can be used to create more rows on the x-axis labels. This can help if your labels are overlapping. Use an integer to tell how many row to create (more than 2 is not recommended for interpretability).
    • The title argument can be used to override the default title.
    • The ... is used for other labels on the plot, namely, the x- and y-axis labels.
  • plot_box()
    • The fill argument can be used to choose a fill color.
    • The breaks argument can be used to specify x-axis breaks. Use seq(start, stop, jump).
    • The orient argument can be used to flip the axis. Choose either “vertical” (the default) or “horizontal”.
    • The title argument can be used to override the default title.
    • The ... is used for other labels on the plot, namely, the x- and y-axis labels.
  • plot_hist()
    • The group_cols argument can be used with a grouped histogram to specify how many columns the faceted output should take up.
    • The fill argument can be used to choose a fill color.
    • The breaks can be used to specify how the x-axis labels should be broken. Use seq(_START_, _STOP_, _JUMP_). Accuracy is not guaranteed.
    • The title argument can be used to override the default title.
    • The ... is used for other labels on the plot, namely, the x- and y-axis labels.
  • plot_scatter()
    • The fill argument can be used to choose a fill color (for a non-grouped plot).
    • The title argument can be used to override the default title.
    • The legend_title argument can be used to override the default legend title.
    • The axis_lines argument can be used to draw axis gridlines on the plot (both).
    • The ls_line argument can be set to TRUE to draw in a least squares line.
    • The ... is used for other labels on the plot, namely, the x- and y-axis labels.
  • infer_*()
    • The digits argument can be specified with an integer value for the number of digits to round to. Defaults to 3.
    • The caption argument can be used to override the default caption.
    • The conf_lvl argument can be used to choose a different confidence level other than 0.95. (Not applicable to infer_anova().)
  • infer_1mean_test() and infer_paired()
    • The mu0 argument can be used to specify the null hypothesis value, if different from 0.
  • infer_1prop_test()
    • The p0 argument can be used to specify the null hypothesis value, if different from 0.5.
  • inter_2prop_test()
    • This is an extra function should you be interested. It does not appear in the student cheatsheet.

Useful Features that are Part of Another Function / Package