Description Usage Arguments Value Author(s) References Examples
View source: R/promillo-withdoc.R
Applies the formula for total body water according to Whatson, in order to compute the blood-alcohol-level according to Widmark. The individuals attributes as height, weight, age and gender are included, as well as the consumed amount of alcohol and the duration of consumption.
1 2 3 4 5 6 7 8 | tell_me_how_drunk(
age,
sex = c("male", "female"),
height,
weight,
drinking_time,
drinks
)
|
age |
age of the individual in years |
sex |
sex of the individual. Either "male" or "female" |
height |
height of the individual in centimeters |
weight |
weight of the individual in kilograms |
drinking_time |
two element POSIXct-vector with the first element being the start time of drinking and the second element being the end time of drinking |
drinks |
named numeric vector. Names of the vector represent the consumed type of drink, the numbers represent the consumed quantitiy of the corresponding drink. Currently the following drinks are supported: "massn", "hoibe", "wein" and "schnaps" |
a numeric value representing the blood-alcohol-level in per mille
Fabian Scheipl, Marc Johler
https://web.archive.org/web/20150123143123/http://promille-rechner.org/erlaeuterung-der-promille-berechnung/
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 | # This is supposed to work without warnings:
## Not run:
tell_me_how_drunk(
age = 39,
sex = "male",
height = 190,
weight = 87,
drinking_time = as.POSIXct(c("2016-10-03 17:15:00", "2016-10-03 22:55:00")),
drinks = c("massn" = 3, "schnaps" = 4)
)
# Violations of German laws according alcohol consumption will be reported as a warning:
tell_me_how_drunk(
age = 17,
sex = "male",
height = 170,
weight = 65,
drinking_time = as.POSIXct(c("2016-10-03 17:15:00", "2016-10-03 22:55:00")),
drinks = c("wein" = 3, "schnaps" = 4)
)
tell_me_how_drunk(
age = 15,
sex = "female",
height = 165,
weight = 58,
drinking_time = as.POSIXct(c("2016-10-03 17:15:00", "2016-10-03 22:55:00")),
drinks = c("hoibe" = 3)
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.