[R] write.table

lauramorgana at bluewin.ch lauramorgana at bluewin.ch
Fri Feb 20 10:38:17 CET 2009


Sorry, I'm using R 2.8.1 on Microsoft Windows XP professional 2002 Service Pack 2.
The error I get is 
 Error in write.table(x, file, nrow(x), p, rnames, sep, eol, 
> na, dec, as.integer(quote),  : 
    'list' type not implemented in 'EncodeElement'
The problem is that I can' t manage to save the dataframe...
With other dataframe I usually have no problems!!!

> 
> Hello,
> I tried to turn lists into vectors and then bind them 
> together in order to create a dataframe but if, after this, I 
> try to use the function write.table I get the following error message:
> Error in write.table(x, file, nrow(x), p, rnames, sep, eol, 
> na, dec, as.integer(quote),  : 
>    'list' type not implemented in 'EncodeElement'
>  
> Here is what I've done:
> as.vector(c(unique(portate$Anno)))->anno
> as.vector(loadListPO4)->loadPO4
> as.vector(loadListPTG)->loadPTG
> as.vector(loadListNT)->loadNT
> as.vector(loadListNH4)->loadNH4
> as.vector(loadListNO3)->loadNO3
> as.vector(loadListBOD5)->loadBOD5
> as.vector(loadListSiO2)->loadSiO2
> cbind(anno,loadPTG,loadPO4,loadNT,loadNH4,loadNO3,loadBOD5,loa
> dSiO2)->carichi
> as.data.frame(carichi)->carichi.annui
> 
> #if I type  
> carichi.annui
> #I get
>  anno   loadPTG   loadPO4   loadNT  loadNH4  loadNO3 loadBOD5 loadSiO2
> 1 2002  3.399518  1.382235 390.6959 22.07992 256.2244 
> 492.9177 150.6505
> 2 2003  1.559606 0.6271712 202.9181 6.198592 145.9498 
> 63.07578 68.08632
> 3 2004  2.363862 0.9493779 292.0841 12.21207 200.2545 
> 141.0533 105.2409
> 4 2005  1.655554 0.6570313 217.2192  6.58045 155.7393 
> 66.44154  73.0394
> 5 2006  1.827174 0.7290634 235.7914 7.858396 166.8327  
> 79.2474 80.92576
> 6 2007  1.742629 0.6891045 228.0253 7.130082 162.6692 
> 71.91434 77.22507
> 7 2008 0.8382246 0.3612176 110.9079 2.024197 86.60459 
> 25.46127  32.9733
> 
> #which looks lika a data frame
> #And if I type
> is.data.frame(carichi.annui)
> # I get this:
> [1] TRUE
> 
> #but if I try 
> write.table(carichi.annui, "carichi.annui.lav")
> #It doesn't work?!?!?!
> Does someone have an explanation?
> Thanks a lot for any help!!
> Laura
> 
Laura,

What do you mean by "It doesn't work"?  Do you get error messages?  Or, do
you just not get what you want?  And if so, what is that you want?

Dan

Daniel Nordlund
Bothell, WA USA

______________________________________________
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.




More information about the R-help mailing list