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).
'annotate_monitor()' will read data from the header of a single file and return a data frame with all the metadata contained in that header.
Path to the file containing monitor metadata.
Type of monitor with which the data was recorded. Currently there are two valid types:
* "ecm" or "ecm-full": metadata from ECM.
Any other option will be coerced to "unknown" and return an empty data frame.
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. Use
annotate_monitor in the same way to
read in the header metadata for each file, and then use
tidyr::unnest to extract all the metadata for each file.
A data frame with all columns from the monitor file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
## 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), header = map2(files_col, types_col, annotate_monitor) ) %>% unnest() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.