knitr::opts_chunk$set(echo = TRUE) library(hitchr) library(tidyverse) library(cowplot) random_sample <- iidr(10) random_NAs <- iidr(10, na_prob = 0.2)
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 package).
:warning: Currently in development. No warranty for deprecated functions as I come up with names I like better.
To install:
devtools::install_github("bbartholdy/hitchr")
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.
hitchr::infinite_improbability_drive(10) # generates a random sample of 10 individuals # or hitchr::iidr(10)
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).
hitchr::iidr(10, na_prob = 0.2, symm = T)
knitr::kable(random_NAs)
Races currently available:
hitchr:::race_index()
Stats currently available:
hitchr:::stats_index()
Sexual dimorphism in the height of males and females of different races:
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.