Skip to content

Instantly share code, notes, and snippets.

@StaffanBetner
Last active March 28, 2022 13:52
Show Gist options
  • Save StaffanBetner/a82813ba219674fe6935192058a10dfe to your computer and use it in GitHub Desktop.
Save StaffanBetner/a82813ba219674fe6935192058a10dfe to your computer and use it in GitHub Desktop.
# Data source: William Harkness, Pennsylvania State University
# README: https://web.archive.org/web/20080426073212if_/http://math.fullerton.edu/mori/Math120/Data/readme%20datasets/readme.html#physical
library(pacman)
p_load(tidyverse, magrittr)
# import("https://web.archive.org/web/20080210005048/http://math.fullerton.edu/mori/Math120/Data/readme%20datasets/ds/physical.txt",
# setclass="tbl") %>%
# clean_names() %>%
# datapasta::tribble_construct() %>% writeLines()
tibble::tribble(
~sex, ~height, ~left_arm, ~rt_arm, ~left_foot, ~rt_foot, ~left_hand, ~rt_hand, ~head_circ, ~nose,
"Male", 69, 25.5, 25.5, 27, 26.5, 9.5, 9, 58.5, 5.5,
"Male", 79, 28, 25, 29, 27.5, 9, 9, 54, 5,
"Male", 75, 27, 27.5, 31, 32, 3.8, 3.8, 62.5, 5,
"Male", 69, 25, 25.5, 25.5, 25.5, 10, 8, 58.5, 5.5,
"Male", 65, 25, 25, 23.5, 23, 9.5, 9.4, 57, 4.4,
"Male", 79, 30.5, 30.5, 28, 28, 8.5, 8.5, 58.5, 4.5,
"Male", 72, 26.5, 26.5, 28.5, 28.5, 9.5, 9.5, 60.5, 4.2,
"Male", 69.5, 26.5, 27, 27, 27, 10, 10.5, 58.5, 5,
"Male", 73, 28, 28.4, 30.6, 31.4, 8.5, 8.9, 57.4, 6.4,
"Male", 71.5, 28.6, 28.1, 27.4, 28.5, 9.8, 9.4, 56.5, 4.1,
"Male", 69.5, 27, 27, 27, 27, 9, 9, 58.5, 5,
"Male", 73, 23, 23, 28.5, 27.5, 8.5, 9, 59.5, 5,
"Male", 71, 28, 27, 29, 27, 8, 8, 59, 6,
"Male", 74, 28, 27, 29, 30, 10, 10, 58.5, 5,
"Male", 75, 31, 28, 28, 29, 8.1, 8.4, 59, 6,
"Male", 71, 23.5, 23, 27, 27.5, 9.5, 10, 57, 5.5,
"Male", 72, 28.5, 28, 26.5, 27.5, 11.5, 11.5, 58, 6.5,
"Male", 66, 24, 25, 25.5, 26, 8, 8.5, 57, 5,
"Male", 71, 26, 26, 29, 28, 9, 9, 55, 5,
"Male", 67, 25.5, 25.5, 27.2, 27, 7.7, 7.7, 54, 5.5,
"Male", 71, 29.5, 28.5, 29, 28.5, 9, 9.5, 57.5, 5.5,
"Male", 72, 25.5, 25, 28, 28, 9.5, 9.5, 56, 5.3,
"Male", 72, 25, 26, 28.5, 29, 8.5, 9, 61, 4.5,
"Male", 73.5, 26, 28.5, 29, 30, 9.5, 9.9, 62, 5,
"Male", 73, 30, 29, 23.5, 24, 9, 9.5, 58, 6,
"Female", 62, 22.5, 23, 21.5, 21, 8.3, 7.3, 56.5, 5.1,
"Female", 66, 24, 25, 24, 25, 8.5, 8.5, 53, 6,
"Female", 64.5, 22.5, 21.5, 23.3, 23, 7.5, 7.5, 56, 4,
"Female", 64.5, 24.5, 24.5, 25, 25.5, 8, 8, 55, 5,
"Female", 67, 25, 25, 25.5, 25, 8, 8, 57, 6.5,
"Female", 72, 28, 28, 26.2, 25.7, 9.1, 8.5, 56.5, 4.3,
"Female", 64, 24, 23.5, 23.5, 23.5, 7.5, 7, 54, 4.5,
"Female", 69, 28, 25.5, 26.5, 26, 7.5, 7.5, 58, 4.5,
"Female", 63, 22, 22, 24, 25, 7, 7, 53, 4,
"Female", 64, 24, 24, 21, 21, 7, 7, 56, 5,
"Female", 67, 26, 27, 22, 22, 7.5, 7.2, 54, 4,
"Female", 63, 25, 26.5, 24, 23, 7, 6.5, 54.5, 5,
"Female", 67, 23, 23, 23, 23, 6.5, 6.5, 56, 5,
"Female", 66, 25.5, 25.5, 24, 25.5, 9.5, 10, 54, 4,
"Female", 66, 25.5, 25.5, 23, 23, 7, 7, 55.9, 5,
"Female", 64, 23.5, 24, 22, 22.6, 7.6, 7.5, 58.2, 4.9,
"Female", 67, 23.3, 24, 24.5, 23.5, 8.2, 8.2, 56, 4.7,
"Female", 71, 25.5, 28, 25.5, 28, 7.5, 8.5, 58, 5,
"Female", 65, 23.5, 23, 24, 23.5, 7.6, 7.6, 58, 5,
"Female", 68, 25, 25, 25, 24.5, 8, 8, 56, 4.5,
"Female", 61.5, 23, 23, 23, 24, 8, 8.5, 56, 4.5,
"Female", 62, 23.5, 23.5, 23.5, 23, 8, 8, 57, 4.5,
"Female", 62.5, 24, 24, 24, 24, 7, 7, 61, 4,
"Female", 68, 25.5, 25, 25.5, 25, 10, 9, 53.5, 4,
"Female", 65, 22.5, 23, 22.9, 23.2, 7.5, 7.4, 57, 4.5,
"Female", 61, 22.2, 22.2, 22, 22.2, 6.9, 6.9, 55.2, 4.7,
"Female", 63, 23, 23, 24, 23, 7.5, 8, 53, 5,
"Female", 71, 25.5, 28, 25.5, 28, 7.5, 7.5, 54.5, 5,
"Female", 68, 24.5, 24.5, 24.5, 25.5, 7, 6.5, 57.8, 4.5,
"Female", 62, 26, 26, 23, 23, 6, 6, 56, 5
) %>%
mutate(height = height %>% multiply_by(2.54) %>% round_half_up()) -> # convert inches into centimeters
physical
@StaffanBetner
Copy link
Author

Alternative:

qs::decode_source("un]'BAAA@QRtHACAAAAAAA@Q1AAAv7#aT)OCyNNAeqa)ftyxTA80>23DWc:WVRJU2(Xu'S1X?[?nmz}aK*KMFHfo;6d#A2VdEm5myd842{^DNzPTIP;EyKjB
SBNJ1[Mce[P3ip;%0$Gkw<#f>=)SDV.n[6,&1#il#&PyV4}~B'B'hTic$}!l2>,Qbko4YC[@zU*io;ZtBI&!g`tkx[]|uKDo>V;R#~pW20B@S(,}>~wGqOK,
.*ZoAcN/&G)M]?'%EGW!>WIdeUBS@7xfMN^zA|fhk;82^fmP'l.|*>3}c?R|{F}5vS}5tS5u42zl'5`,A|J#H8dr1mP<EVMNxfZ|1{=^8~7c/]}oX(v<e6i2
N.<6Rp^%@fw3u;x;,~}thn);>kF.}uxDRy6;O56;X'6.b'3}_|qX($wRu}OX's+C;iVVzp+&%U_@vLj@qI,Z):?Cjz0w*0Y,<SS5#nB82cD!~d8CB8NQ]o7i
;,yDPiT:&Ztz?M)F.z}kF3++B;WaO)c&r7=H4,xj%U3jCx{fX@''%xBy0uhy$F+0BfmxOVoL:6zQ)9/IzEavstXMMCh?^LS#y*vy+,+DVh>@,>P&:Ty_H#ts
%N2EMhOVeUzAfQAi&QDK,^aa3b?*zY'LUJGYDK6Fg?$AZ7svJVyq7LdXb7,u8E$FOwrV0wc=}|rZV:qVdF{(y5x5!2*BXQ=Jel77bvvBZA+']Qg0Q;5Fe+eE
NCj7Ca8MuGg)SV`hVR2nbD.yIo4se)Qx8;%Gvz4E2$o<eMin%Bzr]z~gSeb5|0&t!hmj6/,7P}MO?>0U|[Hx,H+R$i'7~A#75BmBsN>NblQ~>GT,uNruWFfK
E0p8t9{.r^]F$gjh4e}3EO*D=ji'a{&<Z4:`D.Vt.?Hz6l//&MzJ4.^7`67xkTG?b<@S(e/2a:$#:=n=~<k!mQhhLZL9d+[yJ{x8b(`%J8SUy8l4Too@KO@0
zB|pD(|R#g43j<Gxd(&N9|<)Zhk]mIQr}d0N,{]R]U{=}CF~nruVqo<4aHG_/@9Y[?$90[f6.f}0!%NpK#2JVaf?Q3%2)}k52#i~;IBL|=7wIhY|;:%EJgf")

@StaffanBetner
Copy link
Author

StaffanBetner commented Mar 8, 2022

packages(tidyverse, rio, janitor, units)
# README: https://web.archive.org/web/20080426073212if_/http://math.fullerton.edu/mori/Math120/Data/readme%20datasets/readme.html#physical
"https://web.archive.org/web/20080210005048if_/http://math.fullerton.edu/mori/Math120/Data/readme%20datasets/ds/physical.txt" %>% 
  import(setclass="tbl") %>% 
  clean_names() %>% 
  mutate(height = height %>% set_units("inches"),
         across(height:nose, ~set_units(.x, "cm")),
         sex = factor(sex)) -> 
  physical

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment