read_HRV_reports: Read LabChart's HRV Report File

View source: R/HRV_reports.R

read_HRV_reportsR Documentation

Read LabChart's HRV Report File

Description

Read and transform LabChart's HRV report file (.txt) to a tidy tibble with one row per file.

Usage

read_HRV_reports(file, format_cols = TRUE, encoding = "UTF-16LE", ...)

Arguments

file

(Character) Path to LabChart's HRV report (.txt) files to be read. Path can point to an individual text file (.txt) or a folder which contains those files.

format_cols

(Logical) If TRUE formats appropriate output variables as factor, integer, or double, and compute NN50_percent (pNN50) from NN50_count/Normals_count

encoding

(Character) Text encoding of the HRV report files. Default value is set to "UTF-16LE" as it works well with my testing data. If the result seems abnormal, try different text encoding (visit readtext manual to see all available options)

...

extra arguments passed to readtext::readtext()

Details

read_HRV_reports() reads contents of LabChart's HRV report from text file (.txt) into character vector using readtext::readtext() function with default text encoding as "UTF-16LE". Then, each key-value fields of the character vector will be extracted and transform into a tibble by regular expression pattern matching as in parse_HRV_reports().

The result will be a tibble with column names corresponding to "key" in the input file(s), and values in each rows mapped to "value" from the input file(s).

Value

A tibble of HRV report (one row per subject)

Examples

# Path to `HRV/` folder containing example HRV report files (`.txt`)
path <- labChartHRV_example("HRV")
# Read into tibble
read_HRV_reports(path)

Lightbridge-KS/sipsANS documentation built on June 11, 2022, 8:12 a.m.