readExcelData {exceldata} | R Documentation |
Read Excel Data
Description
This function reads in an excel data table created by the dictionary.xlsm template file according to the specifications in the dictionary
Usage
readExcelData(
excelFile,
dictionary,
dataSheet = "DataEntry",
saveWarnings = FALSE,
setErrorsMissing = FALSE,
use_labels = TRUE,
range,
origin
)
Arguments
excelFile |
path and filename of the data file |
dictionary |
A data frame returned by readDataDict |
dataSheet |
name of the data entry sheet within the file, defaults to 'DataEntry' |
saveWarnings |
Boolean, if TRUE and there are any warnings then the function will return a list with the data frame and the import warnings |
setErrorsMissing |
Boolean, if TRUE all values out of range will be set to NA |
use_labels |
should variable descriptions be added as variable label attributes, default is TRUE |
range |
Optional, Range of Excel sheet to restrict import to (ie. range="A1:F6") |
origin |
Optional, the date origin of Excel dates, defaults to 30 December 1899 |
Details
Prior to reading in the data, the dictionary file must be imported using readDataDict.
Warning: If SetErrorsMissing = TRUE then a subsequent call to checkData will not return any errors, because the errors have been set to missing.
NOTE: This function will only read in those columns present in the dictionary
Value
A data frame containing the imported data
Examples
exampleDataFile <- system.file("extdata", "exampleData.xlsx", package = "exceldata")
dictionary <- readDataDict(exampleDataFile, dictionarySheet = 'DataDictionary')
data <- readExcelData(exampleDataFile,dictionary,dataSheet='DataEntry')