tidyverse / modelr

Helper functions for modelling
https://modelr.tidyverse.org
GNU General Public License v3.0
401 stars 66 forks source link

heights$height is in inches instead of feet #101

Closed burgerga closed 4 years ago

burgerga commented 5 years ago

It is unlikely that people in the US are on average 20 meters tall, reprex for "good measure" (pun intended):

if (!require("pacman")) install.packages("pacman"); library(pacman)
#> Loading required package: pacman
p_load(tidyverse, modelr, measurements)
heights %>% mutate(
  height_in_m_incorrect = conv_unit(height, 'ft', 'm'),
  height_in_m_correct = conv_unit(height, 'inch', 'm'),
  ) %>% 
  summarise(
    mean_height_in_m_incorrect = mean(height_in_m_incorrect),
    mean_height_in_m_correct = mean(height_in_m_correct),
  )
#> # A tibble: 1 x 2
#>   mean_height_in_m_incorrect mean_height_in_m_correct
#>                        <dbl>                    <dbl>
#> 1                       20.5                     1.70

Created on 2019-09-05 by the reprex package (v0.3.0)