keyRead: Read file after deducing file type from suffix.

View source: R/variableKey.R

keyReadR Documentation

Read file after deducing file type from suffix.

Description

If the input is XLSX, sheets named "key" and "varlab" are imported if the exist. If input is CSV, then the key CSV file is imported and another file suffixed with "-varlab" is imported if it exists.

Usage

keyRead(file, ..., na.strings = c("\\s+"))

Arguments

file

name of file to be imported, including path to file. file name must end in "csv", "xlsx" or "rds"

...

additional arguments for read.csv or read.xlsx.

na.strings

Values to be converted to R missing symbol NA. Default is white space, "\s+".

Details

The variable lables are a named vector saved as an attribute of the key object.

Value

A data frame or matrix.

Author(s)

Paul Johnson <pauljohn@ku.edu>


kutils documentation built on Sept. 17, 2023, 5:06 p.m.