Hi,
I try to use write.xls from dataframes2xls inside a function. The
write.xls work normally in console, but inside a function it dont find
the object.
Look this example:
> library(dataframes2xls)
> test <- function(x){
+ a <- data.frame(A=c(1,2),B=c(10,11))
+ write.xls(a,file="a.xls")
+ }
> test()
Erro em get(s[i]) : objeto 'a' não encontrado
Why the write.xls dont find the object a inside a function?
Thanks
Ronaldo
--
9ª lei - Se você ficaria infeliz ao perder seus dados,
faça um back-up (cópia) permanente deles cinco minutos
após adquiri-los.
--Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228.
> Prof. Ronaldo Reis Júnior
| .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional
| : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
| `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
| `- Fone: (38) 3229-8192 | ronaldo.reis@unimontes.br
| http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366
[[alternative HTML version deleted]]
On 18.12.2011 12:58, Ronaldo Reis J?nior wrote:> Hi, > > I try to use write.xls from dataframes2xls inside a function. The > write.xls work normally in console, but inside a function it dont find > the object. > > Look this example: > > > library(dataframes2xls) > > test<- function(x){ > + a<- data.frame(A=c(1,2),B=c(10,11)) > + write.xls(a,file="a.xls") > + } > > test() > Erro em get(s[i]) : objeto 'a' n?o encontrado > > Why the write.xls dont find the object a inside a function?Because at least that part of the function is poorly written. Uwe Ligges> > Thanks > Ronaldo > > > > > ______________________________________________ > R-help at 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.
On 19/12/11 04:29, Uwe Ligges wrote:> > > On 18.12.2011 12:58, Ronaldo Reis J?nior wrote:<SNIP>>> Why the write.xls dont find the object a inside a function? > > Because at least that part of the function is poorly written.Surely this should be a fortune! cheers, Rolf