Skip to content
Back to formatted view

Raw Message

Message-ID: <CAP01uRnDEA0s+SSKC4FiJhJk4W6G2xusaWazqbAaYCBVrACyOA@mail.gmail.com>
Date: 2012-05-20T12:30:36Z
From: Gabor Grothendieck
Subject: write.xls
In-Reply-To: <4FB849B1.3010400@structuremonitoring.com>

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