Description Usage Arguments Value Examples
View source: R/health-parse-functions.R
Takes the (vector of) values that contain subkey-value-pairs
of the (default) form:
(subkey1: val1/val2/val3, subkey2: val1/val2/val3)
and extracts the mean value for a specified subkey.
1 2 | get_subkey_value_mean(value, subkey, key_sep = ",", keyvalue_sep = ":",
vec_sep = "/", ...)
|
value |
The value extracted from the original key-value pair. |
subkey |
The subkey for which the data should be extracted. |
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 |
A mean value for all values of the subkey, or NA
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #value <- get_value_text(dat_txt, key = "caliper")
#value <- value[357:360]
#subkey <- "brust-li"
dat <- c(paste0("2018-03-23; 20:30; caliper = (brust-li: 14/12/11, ",
"brust-re: 12/13/13, bauch-li: 25/25/25, ",
"bauch-re: 26/26/25, bein-li: 15/15/15, ",
"bein-re: 24/23/26);"),
paste0("2018-03-29; 19:00; weight = 90.1kg;", "2018-03-30; 21:00; ",
"weight = 89.3kg; note = nach Laufen;"),
paste0("2018-03-30; 21:00; caliper = (brust-li: 12/13/12, ",
"brust-re: 12/13/13, bauch-li: 28/29/29, bauch-re: 24/21/28, ",
"bein-li: 14/16/14, bein-re: 22/22/21);"))
get_subkey_value_mean(
get_value_text(dat, key = "caliper"),
subkey = "brust-re")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.