Learn R Programming

XLConnect (version 0.1-3)

readNamedRegion: Reading named regions from a workbook

Description

Reads named regions from a workbook.

Usage

## S3 method for class 'workbook,character,logical':
readNamedRegion(object,name,header)

Arguments

object
The workbook to use
name
The name of the named region to read
header
The argument header specifies if the first row should be interpreted as column names. The default value is TRUE.

Details

The arguments name and header are vectorized. As such, multiple named regions can be read with one method call. If only one single named region is read, the return value is a data.frame.If multiple named regions are specified, the return value is a (named) list of data.frame's returned in the order they have been specified with the argument name.

References

What are named regions/ranges? http://www.officearticles.com/excel/named_ranges_in_microsoft_excel.htm How to create named regions/ranges? http://www.youtube.com/watch?v=iAE9a0uRtpM

See Also

workbook, readWorksheet, writeNamedRegion, writeWorksheet, readNamedRegionFromFile

Examples

Run this code
# mtcars xlsx file from demoFiles subfolder of package XLConnect
demoExcelFile <- system.file("demoFiles/mtcars.xlsx", package = "XLConnect")

# Load workbook
wb <- loadWorkbook(demoExcelFile)

# Read named region 'mtcars' (with default header = TRUE)
data <- readNamedRegion(wb, name = "mtcars")

Run the code above in your browser using DataLab