Skip to content
Prev 295112 / 398506 Next

write.xls

On 5/20/2012 5:52 AM, Gabor Grothendieck wrote:
Hi, Gabor:  Thanks.  I think we're gaining on it, but I'm still not 
quite there.  Consider the following extension of my previous toy example:

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(quote(c(df1, df2)), outFile))
# works

df2x <- function(x, file)
     do.call(write.xls, list(x, file))
df2x(quote(c(df1, df2)), outFile)
# works

df2 <- function(x1, x2, file){
     x23 <- quote(c(x1, x2))
     do.call(write.xls, list(x23, file))
}
df2(df1, df2, outFile)
# Error in get(s[i]) : object 'x1' not found


       This is closer to what I need.  The answer may lie in getting the 
right "envir" argument for "do.call".  However, I haven't yet found 
something that works there.


       Thanks,
       Spencer