[R] function to export data

From: Daniel Pires <dfcpires_at_fc.ul.pt>
Date: Sun, 29 Jun 2008 23:59:11 +0100

 

Hi,  

Im trying to built a simple function that allows me to export automatically some results to a text file. Ive tried the two following approaches but none worked.  

> exportdata<-function(x) {

+ dataexp<-summary(x)

+ export(dataexp,type="ascii",file="dataexp.txt")

+ }

> exportdata(glm.poisson0)

Error in eval(expr, envir, enclos) : object "dataexp" not found      

exportdata2<-function(x) {

sink("exportdata2.txt")

summary(x)

sink()

}  

> exportdata2(glm.poisson0) # the file is created but with no data in it.
   

Can anyone give me some hints on what Im missing here? I would be very grateful for that.  

Thanks.    

Daniel Pires    

Daniel Pires

Faculdade de Cincias da Universidade de Lisboa

Dep. Biologia Animal

Ed. C2, piso 2

Campo Grande 1749-016 Lisboa

Portugal

 <http://ffishgul.fc.ul.pt/> http://ffishgul.fc.ul.pt/  

        [[alternative HTML version deleted]]



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. Received on Sun 29 Jun 2008 - 23:05:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 30 Jun 2008 - 09:30:52 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive