read_HRV_report: Read LabChart's HRV Report Text file(s)

Description Usage Arguments Value Examples

View source: R/read_HRV_report.R

Description

Parse LabChart's HRV Report .txt files in to a tidy tibble with one row per file. Internally, this function calls readtext::readtext() and use regular expression to extract information from each variables.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
read_HRV_report(
  file,
  ignore_missing_files = FALSE,
  text_field = NULL,
  docid_field = NULL,
  docvarsfrom = c("metadata", "filenames", "filepaths"),
  dvsep = "_",
  docvarnames = NULL,
  encoding = "UTF-16LE",
  source = NULL,
  cache = TRUE,
  format_cols = TRUE,
  ...
)

Arguments

file

path to .txt files to be read. This is designed to automagically handle a number of common scenarios, so the value can be a "glob"-type wildcard value.

ignore_missing_files

if FALSE, then if the file argument doesn't resolve to an existing file, then an error will be thrown. Note that this can happen in a number of ways, including passing a path to a file that does not exist, to an empty archive file, or to a glob pattern that matches no files.

text_field, docid_field

a variable (column) name or column number indicating where to find the texts that form the documents for the corpus and their identifiers. This must be specified for file types .csv, .json, and .xls/.xlsx files. For XML files, an XPath expression can be specified.

docvarsfrom

used to specify that docvars should be taken from the filenames, when the readtext inputs are filenames and the elements of the filenames are document variables, separated by a delimiter (dvsep). This allows easy assignment of docvars from filenames such as 1789-Washington.txt, 1793-Washington, etc. by dvsep or from meta-data embedded in the text file header (headers). If docvarsfrom is set to "filepaths", consider the full path to the file, not just the filename.

dvsep

separator (a regular expression character string) used in filenames to delimit docvar elements if docvarsfrom="filenames" or docvarsfrom="filepaths" is used

docvarnames

character vector of variable names for docvars, if docvarsfrom is specified. If this argument is not used, default docvar names will be used (docvar1, docvar2, ...).

encoding

vector: either the encoding of all files, or one encoding for each files

source

used to specify specific formats of some input file types, such as JSON or HTML. Currently supported types are "twitter" for JSON and "nexis" for HTML

cache

if TRUE, save remote file to a temporary folder. Only used when file is a URL.

format_cols

If TRUE format appropriate output variables as factor, integer, or double. Compute NN50_percent (pNN50) from NN50_count/Normals_count

...

passed to readtext::readtext()

Value

A data.frame

Examples

1
# read_HRV_report("path/to/folder")

Lightbridge-AI/physiolab documentation built on Feb. 24, 2022, 1:35 a.m.