with.workbook

0th

Percentile

Evaluate an R expression in a workbook environment

Evaluate an R expression in an environment constructed from the named regions of an Excel workbook.

Keywords
IO
Usage
# S3 method for workbook
with(data, expr, ...)
Arguments
data

A workbook object, as returned by loadWorkbook.

expr

expression to evaluate

...

Additional arguments passed to readNamedRegion

Details

This method will read all named regions from the workbook when creating the environment. Names in the workbook will be processed through make.names to obtain the variable names.

Changes to the variables representing named regions will not affect the workbook contents and need to be saved explicitly using writeNamedRegion and saveWorkbook. If the workbook contains names that do not map to R identifiers,

See Also

getDefinedNames, readNamedRegion,

Aliases
  • with.workbook
Examples
# NOT RUN {
# multiregion xlsx file from demoFiles subfolder of package XLConnect
demoExcelFile <- system.file("demoFiles/multiregion.xlsx",
                             package = "XLConnect")

# load workbook
wb <- loadWorkbook(demoExcelFile)

# named regions: Calendar, IQ, Iris
print(getDefinedNames(wb))

# named regions as variables
with(wb, { 
  print(Calendar)
  summary(IQ)
  summary(Iris)
})
# }
Documentation reproduced from package XLConnect, version 0.2-15, License: GPL-3

Community examples

Looks like there are no examples yet.