read_monitor: Single function to call when reading monitor files.

Description Usage Arguments Details Value Examples

Description

Typical output from personal environmental monitors will be plain text files containing either raw data in a readily usable format (e.g. PATS+, UPAS) or raw data in binary format which needs to be pre-processed using the monitor software (e.g. ECM).

'read_monitor()' will read data from a single file and return a data frame with all the columns contained in the file.

Usage

1

Arguments

file

Path to the file containing monitor data.

type

Type of monitor with which the data was recorded. Currently there are five valid types:

* "patsp": data from PATS+ monitors. * "upas": data from UPAS monitors. * "ecm": data from ECM. * "ecm-full": same as "ecm". Use this type to extract more variables when using collect_data * "ecm-raw": raw files from ecm will usually be located among the files, this will return an empty data frame. * "sums": reading data from SUMs is supported, but data is not used.

Any other option will be coerced to "unknown" and return an empty data frame.

...

Additional arguments passed to readr::read_csv

Details

Usually you will be interested in reading data form multiple files, this can be easily achieved by listing in a data frame all files and types you want to read and iterating over it with purrr::map2 as shown in the examples below.

Value

A data frame with all columns from the monitor file.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
# Load required packages
library(package = "pemr")

# Define files and types. This can be any data frame, so composing data in a
# spreadsheet and reading it in works too
data_frame(
 files_col = c("path/to/file1.csv", "path/to/file2.csv"),
 types_col = c("ecm", "upas")
) %>%
mutate(
  data = map2(files_col, types_col, read_monitor)
)

## End(Not run)

odeleongt/pemr documentation built on May 3, 2019, 10:44 p.m.