calc_bodyfat: Calculate body fat from caliper measurements.

Description Usage Arguments Value References Examples

View source: R/health-parse-functions.R

Description

Using the 3-Falten-Formel by Jackson & Pollock, for men.

Usage

1
2
calc_bodyfat(value, age, key_sep = ",", keyvalue_sep = ":",
  vec_sep = "/", ...)

Arguments

value

The value extracted from the original key-value pair.

age

Age of the person that the caliper measurements were taken of (at the time of taking the measurements).

key_sep

The separator that separates the subkey-value-pairs from each other. Needs to be a valid regular expression (e.g., '|' needs to be escaped as '\|')

keyvalue_sep

The separator that separates the subkey from the value(s) of that subkey. Needs to be a valid regular expression (e.g., '|' needs to be escaped as '\|')

vec_sep

The separator that separates the individual values for each subkey value. Needs to be a valid regular expression (e.g., '|' needs to be escaped as '\|')

...

parameters passed to calc_bodyfat_mean and in turn to mean function.

Value

Body fat percentage between 0 and 100 percent, or NA.

References

https://de.wikipedia.org/wiki/Calipometrie Jackson, Pollock: Generalized equations for predicting body density of women. In: British Journal of Nutrition. Nr.40, Oktober 1978, S.497<e2><80><93>504 (englisch)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
dat_bodyfat_tmp <- c(paste0("2018-03-23; 20:30; note = line just to test vectorization"),
                     paste0("2018-03-23; 20:30; caliper = ",
                            "(brust-li: 14/12/11, brust-re: 12/13/one-missing, ",
                            " bauch-li: 25/25/25, bauch-re: 26/26/25, ",
                            " bein-li:  15/15/15, bein-re:  24/23/26);"),
                     paste0("2018-03-23; 20:30; caliper = ",
                            "(brust-li: 20/20/20, brust-re: 20/two/missing, ",
                            " bauch-li: 30/30/30, bauch-re: 30/30/30, ",
                            " bein-li:  20/20/20, bein-re:  20/20/20);"),
                     paste0("2018-03-23; 20:30; caliper = ",
                            "(brust-li: 20/two/and, brust-re: 20/two/missing, ",
                            " bauch-li: 30/30/30, bauch-re: 30/30/30, ",
                            " bein-li:  20/20/20, bein-re:  20/20/20);"),
                     paste0("2018-03-23; 20:30; caliper = ",
                            "(brust-li: all-missing, brust-re: all-missing, ",
                            " bauch-li: 20/20/20, bauch-re: 20/20/20, ",
                            " bein-li:  10/10/10, bein-re:  10/10/10);"))
calc_bodyfat(get_value_text(dat_bodyfat_tmp, key = "caliper"), age = 39, na.rm = TRUE)

ingonader/tskeyvalparser documentation built on May 5, 2019, 4:50 p.m.