Hi,

 

I’m trying to built a simple  function that allows me to export
automatically some results to a text file. I’ve 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 I’m missing here? I would be very
grateful for that.

 

Thanks.

 

 

Daniel Pires

 

 

Daniel Pires

Faculdade de Ciências 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@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.

Reply via email to