PWFSLSmoke (version 1.2.100)

generic_parseData: Parse generic air quality files

Description

Given a string of delimited file data, this function will parse the file as a table of data an apply some transformations and augmentations as specified by a given configuration list.

Usage

generic_parseData(fileString = NULL, configList = NULL)

Arguments

fileString

Character string of delimited data to parse.

configList

A R list or JSON file containing key-value pairs which affect how the parsing of fileString is handled. If configList is in JSON format, it can be passed in as a file, string, or URL.

Value

A tibble of the data contined in fileString parsed according to parameters in configList. The data is coerced into a format that is more easily convertable into a ws_monitor object at a later point.

Parsing data

Internally, this function uses read_delim to convert fileString into a tibble. If any lines of data cannot be properly parsed, and error will be thrown anf the problem lines will be printed.

Creating a configList

For more information on how to build a configList, see the Rmarkdown document "Working with Generic Data" in the localNotebooks directory.

Examples

Run this code
# NOT RUN {
filePath <- system.file(
  "extdata", "generic_data_example.csv",
  package = "PWFSLSmoke",
  mustWork = TRUE
)

configPath <- system.file(
  "extdata", "generic_configList_example.json",
  package = "PWFSLSmoke",
  mustWork = TRUE
)

configList <- jsonlite::fromJSON(configPath)
fileString <- generic_downloadData(filePath)
parsedData <- generic_parseData(fileString, configList)
# }

Run the code above in your browser using DataLab