get_data_long: Transform text data (date, key-value pairs) into a...

Description Usage Arguments Value Examples

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

Description

Transform text data (date, key-value pairs) into a long-format data frame.

Usage

1
get_data_long(dat_txt, sep = ";")

Arguments

dat_txt

Character vector that contains date, time, and one or more key-value pairs.

sep

Character vector of length 1 that specifies which separator is used to separate the key-value pairs from each other. Default is ";".

Value

A tibble with three columns: timestamp, key, value. Both key and value columns are of type character, hence for the value to be used as numerical data, filtering all non-numeric data and conversion are still necessary.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
dat <- c(paste0("2001-11-10; 11:00; arzt=OA Dr. Vorname Nachname; ",
                "Anaesthesist=Dr. Vorname Nachname; ",
                "Instrumentarin=DGKS Vorname Nachname, ",
                "DGKP Vorname Nachname; what=some (long) text with ",
                "semicolons; and other stuff / like slashes, commas, ",
                 "question ? marks, etc.;"),
         "2001-10-11; 19:40; weight=92.8kg;",
         "2001-11-12; 19:30; weight=93.1kg;",
         paste0("2001-11-13; 10:00; what=zustand; dauer=5d, ",
                "leicht kraenklich, husten, schnupfen (!), ",
                 "leichte temperatur (37.3)"))
get_data_long(dat)

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