View source: R/with.workbook.R
with.workbook | R Documentation |
Evaluate an R expression in an environment constructed from the named regions of an Excel workbook.
## S3 method for class 'workbook' with(data, expr, ...)
data |
A workbook object, as returned by loadWorkbook. |
expr |
expression to evaluate |
... |
Additional arguments passed to readNamedRegion |
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,
Martin Studer
Mirai Solutions GmbH https://mirai-solutions.ch
getDefinedNames
,
readNamedRegion
,
## 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) }) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.