-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
100 lines (72 loc) · 2.64 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
---
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(hitchr)
library(tidyverse)
library(cowplot)
random_sample <- iidr(10)
random_NAs <- iidr(10, na_prob = 0.2)
```
<!-- README.md is generated by README.Rmd. Please edit .Rmd file. -->
# hitchr <img src="./README_files/thumb.jpg" align="right" height="139" />
<!-- badges: start -->
[![build status](https://github.com/bbartholdy/hitchr/workflows/R-CMD-check/badge.svg)](https://github.com/bbartholdy/hitchr/actions)
[![Codecov test coverage](https://codecov.io/gh/bbartholdy/hitchr/branch/main/graph/badge.svg)](https://codecov.io/gh/bbartholdy/hitchr?branch=main)
<!-- badges: end -->
Random sample generator based on Douglas Adams' The Hitchhiker's Guide to the Galaxy. It also allows random insertion of NAs in a dataset (inspired by the
[wakefield](https://github.com/trinker/wakefield) package).
:warning: Currently in development. No warranty for deprecated functions as I
come up with names I like better.
To install:
```{r eval=FALSE}
devtools::install_github("bbartholdy/hitchr")
```
## :exclamation:Important Note:exclamation:
This package deals with the concept of 'race' in a strictly biological sense;
i.e., there is no way to biologically distinguish discrete races within the
*Homo sapiens* species (despite claims to the contrary).
This should not distract from the very real concept of social 'race', and the social
injustice that currently persists across the globe.
[BlackLivesMatter](https://blacklivesmatter.com/)
[StopAsianHate](https://www.stopasianhate.info/)
## Examples
```{r eval=FALSE}
hitchr::infinite_improbability_drive(10) # generates a random sample of 10 individuals
# or
hitchr::iidr(10)
```
```{r echo=FALSE}
knitr::kable(random_sample)
```
Missing values can be inserted symmetrically (symm = T): equal number of NAs in
each column, or asymmetrically (symm = F): random distribution in the columns.
To insert missing values, specify the desired proportion of missing values (0 to 1).
```{r eval=FALSE}
hitchr::iidr(10, na_prob = 0.2, symm = T)
```
```{r echo=FALSE}
knitr::kable(random_NAs)
```
Races currently available:
```{r race-index}
hitchr:::race_index()
```
Stats currently available:
```{r stats-index}
hitchr:::stats_index()
```
Sexual dimorphism in the height of males and females of different races:
```{r sex-dim}
hitchr_sample <- hitchr::iidr(1000)
hitchr_sample %>%
filter(sex == "male" | sex == "female") %>%
group_by(race) %>%
ggplot(aes(x = sex, y = height, fill = race)) +
geom_violin() +
theme_minimal() +
scale_fill_viridis_d() +
facet_wrap(~ race) +
theme(legend.position = "none")
```