Skip to content

Sample generator based on the hitchhiker's guide to the galaxy

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

bbartholdy/hitchr

Repository files navigation

hitchr

build status Codecov test coverage

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).

⚠️ Currently in development. No warranty for deprecated functions as I come up with names I like better.

To install:

devtools::install_github("bbartholdy/hitchr")

❗Important Note❗

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

StopAsianHate

Examples

hitchr::infinite_improbability_drive(10) # generates a random sample of 10 individuals
# or
hitchr::iidr(10)
race sex age height weight IQ occupation
human female 46 169.7442 70.94837 106 Loan Interviewers and Clerks
dentrassi female 11 241.9265 195.88013 128 Sauce Chef
human female 48 166.6719 68.93619 104 Retail Store Manager
golgafrinchan female 43 162.0785 57.60543 111 Hairdresser
golgafrinchan female 64 162.8788 61.95010 104 Telephone Sanitiser
human male 20 168.3627 79.99588 92 Animal Kennel Supervisor
vogon male 82 227.1756 344.21806 111 Budget Accountant
golgafrinchan female 54 154.0327 47.33048 102 Lawyer
vogon female 69 234.0460 357.10865 118 Certified Public Accountant (CPA)
human female 44 170.4220 69.74436 111 Cost Analysis Engineer

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)
race sex age height weight IQ occupation
golgafrinchan male 60 162.7905 78.49136 82 Telephone Sanitiser
vogon male 155 229.3018 356.81475 NA Court Clerk
NA male 41 NA 139.65722 103 Relief Cook
golgafrinchan female NA 167.8633 70.90681 103 Telephone Sanitiser
dentrassi NA 71 249.7311 201.64804 121 NA
vogon other 132 NA 362.72088 122 Administrative Assistant
dentrassi male 57 232.3380 NA NA Catering Specialist
human male 19 165.4532 78.66801 NA Recreational Vehicle Mechanic
vogon female NA NA 366.07988 126 Catering Administrator
vogon other 33 NA NA 118 Radio & TV Station Administrator

Races currently available:

hitchr:::race_index()
## [1] "humans"         "vogons"         "golgafrinchans" "dentrassi"

Stats currently available:

hitchr:::stats_index()
## [1] "race"       "sex"        "age"        "height"     "weight"    
## [6] "IQ"         "occupation"

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")

About

Sample generator based on the hitchhiker's guide to the galaxy

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages