[R] Questions on function "readNamedRegionFromFile" in XLConnect pacakge

andrija djurovic
2013-04-23T07:04:51Z

Hi Miao.

1.  "Calendar", "Iris", "IQ" are the named region
in excel file
multiregion.xlsx
(demoFiles/multiregion.xlsx). Open this file (demoFiles/multiregion.xlsx),
go to Formulas tab and click Name manager to see reference regions.

2. Check following functions:
?readWorksheet   #arguments startCol, startRow, endCol, endRow
?idx2col
?col2idx

Example:
> col2idx("AK")
[1] 37
> idx2col(37)
[1] "AK"

Hope this helps.

Andrija


On Tue, Apr 23, 2013 at 8:49 AM, jpm miao <miaojpm@gmail.com> wrote:

> Hi,
>
>    I have two questions on the function "readNamedRegionFromFile"
in
> XLConnect pacakge.
>
> 1.
>
>    In the documentation,
>
> # multiregion xlsx file from demoFiles subfolder of package XLConnect
> demoExcelFile <- system.file("demoFiles/multiregion.xlsx",
>                              package = "XLConnect")
>
> # Load a single named region into a single data.frame.
> df <- readNamedRegionFromFile(demoExcelFile, name="Iris")
>
> # Load multiple regions at once - returns a (named) list
> # of data.frames.
> df <- readNamedRegionFromFile(demoExcelFile,
>                               name=c("Calendar",
"Iris", "IQ"))
>
>    What are the names "Calendar", "Iris",
"IQ"? I just couldn't find them
> from the file.
>
> 2. Since my xlsx file is big, I might want to read data like AK9:AK18, for
> example. If my computation is right, AK is the 37th column. Then I need to
> tell the computer to read the 37th column, row 9 to row 18. Can I ask the
> function (any function in the package) to read the column by the header
> name (say, the name saved in AK1) instead of "37th"?
>
>     Thanks,
>
> Miao
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]