[R] write.xls
Gabor Grothendieck
ggrothendieck at gmail.com
Sun May 20 14:30:36 CEST 2012
On Sat, May 19, 2012 at 9:32 PM, Spencer Graves
<spencer.graves at structuremonitoring.com> wrote:
> Hello, All:
>
>
> The "writeFindFn2xls" function in the "sos" package tries to write an
> Excel file with 3 sheets ('PackageSum2', 'findFn', 'call'). Unfortunately,
> it is often unable to do this because of configuration problems that are not
> easy to fix. I've found 3 contributed packages that provide facilities to
> write Excel files with multiple sheets. Unfortunately, I can't get any of
> them to work consistently for me. Below please find test cases that
> illustrate the problems. Any suggestions for how to solve this problem will
> be appreciated.
>
>
> Thanks,
> Spencer
>
>
> library(dataframes2xls)
>
> df1 <- data.frame(c1=1:2, c2=3:4, c3=5:6)
> df2 <- data.frame(c21=c(10.10101010101,20, 3), c22=c(50E50,60, 3) )
> outFile <- 'df12.xls'
>
> write.xls(c(df1,df2), outFile)
> # works
>
> do.call(write.xls, list(c(df1, df2), outFile))
> # Error in get(s[i]) : object 'structure(list(c1=1:2' not found
>
Try this:
dd <- list(df1 = df1, df2 = df2)
do.call("WriteXLS", list("dd", outFile))
or this:
do.call("WriteXLS", list(c("df1", "df2"), outFile)
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-help
mailing list