Learn R Programming

SchemaOnRead (version 1.0.2)

simpleProcessors: Automated Schema on Read Simple Processors

Description

Provides a simple list of extensions for custom processing.

Usage

simpleProcessors()

Arguments

See Also

simpleProcessors.

Examples

Run this code
## Load the needed library.
library(SchemaOnRead)

## Define a new processor.
newProcessor <- function(path, ...) {

  # Check the file existance and extensions.
  if (!SchemaOnRead::checkExtensions(path, c("xyz"))) return(NULL)

  ## As an example, attempt to read an XYZ file as a CSV file.
  read.csv(path, header = FALSE)

}

## Define a new processors list.
newProcessors <- c(newProcessor, SchemaOnRead::simpleProcessors())

# Use the new processors list.
schemaOnRead(path = "../inst/extdata", processors = newProcessors)

Run the code above in your browser using DataLab