-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
113 lines (78 loc) · 3.7 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
output: github_document
always_allow_html: true
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "80%"
)
```
# gvsu215
Pretty Plots and Charts for Introductory Statistical Concepts
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/gvsu215)](https://CRAN.R-project.org/package=gvsu215)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![Netlify Status](https://api.netlify.com/api/v1/badges/2866996e-ff21-439d-9d53-f79319b52d97/deploy-status)](https://app.netlify.com/sites/transcendent-starlight-07ae23/deploys)
<!-- badges: end -->
Note: Due to the fact that some functions return tables (which are essentially HTML code), the README on GitHub does not display properly. As a result, the output is an image of the resulting table rather than the actual HTML table. These images will not include the table caption at this time.
`gvsu215` contains a series of wrapper functions around select `{mosaic}` and `{ggformula}` functions, with help from `{flextable}` and `{ggplot2}`. The goal is to provide introductory statistics students/learners with an easy way to generate nice-looking plots and tables without focusing on the code used to create them. All tables and plots generated from this package have been doctored and have had themes pre-applied. As such, output will not print in "messy" format to the R console and can be used interactively, including in R Markdown documents.
This package was designed and tailored for Grand Valley State University (course code: STA 215) but can be used by anyone.
## Installation
This package is not on CRAN. You can install the development version of gvsu215 from [GitHub](https://github.com/ian-curtis/gvsu215) with:
``` {r message = FALSE}
# install.packages("devtools")
devtools::install_github("ian-curtis/gvsu215")
```
## Prerequisites
In order to use this package, you will need a basic understanding of R syntax and how to run a function in your preferred working environment. Functions use formula syntax (e.g., `var1 ~ var2`) and thus knowledge of formulas is needed as well.
## Examples
This package is best used for creating simple plots and charts where extensive customization is not necessary. For instance, you may just want to see summary statistics, including one- or two-way tables.
```{r}
library(gvsu215)
```
```{r message=FALSE}
tbl_2var(mtcars, gear~cyl)
```
```{r num-sum}
tbl_num_sum(mtcars, ~wt, na_rm = TRUE)
```
Or maybe you just need percentiles:
```{r pctile}
tbl_pctile(mtcars, ~wt, probs = c(0, .25, .4, .5, .6, .75, 1))
```
There is also support for a variety of plots...
```{r plots}
plot_bar(mtcars, ~cyl, type = "percent")
plot_box(mtcars,
wt~gear,
fill = 'orangered4',
x = "Gear",
y = "Weight",
title = "Boxplot of Weight by Gear")
plot_scatter(mtcars, wt~drat)
```
... and statistical inference.
```{r inference}
infer_1prop(mtcars, ~vs, success = 1)
```
```{r}
infer_paired(mtcars, var1 = ~drat, var2 = ~wt)
```
```{r}
infer_2mean_int(mtcars, wt~vs)
```
```{r}
suppressWarnings(infer_chisq(mtcars, cyl~gear))
```
```{r}
suppressWarnings(infer_chisq(mtcars, cyl~gear, type = "expected"))
```
```{r}
infer_anova(mtcars, cyl~gear, digits = 2)
```
# Help, Bug Reports, and Feature Requests
Errors happen! If you come across an error you don't think you should have, feel free to [create an issue on GitHub](https://github.com/ian-curtis/gvsu215/issues). If you'd like to suggest a change or addition, you can use the issues page for that, too!