* Uwe Ligges <lig...@statistik.tu-dortmund.de> [2009-03-03 15:27]:

> Rafael Laboissiere wrote:
>> Is there a way to prevent write.csv to transform the column names a la
>> make.names?  I mean, if I write the code:
>>
>>     x <- structure (NULL)
>>     x [["a+b"]] <- c (1,2)
>>     write.csv (x, file = "foo.csv", row.names = FALSE, quote = FALSE)
>
>
> your x is not a data.frame, hence write.csv() (or better, write.table())  
> converts your *list* x to a data.frame implicitly by using as.data.frame  
> (and this tries to convert names to more regular names by make.names()).  
> You can avoid it by either working on data.frames or stop the  
> make.names() conversion by forcing the data.frame in advance as in:
>
>      write.csv (as.data.frame(x, optional=TRUE), file = "foo.csv",  
>                 row.names = FALSE, quote = FALSE)

Great, it works.  Thanks!

-- 
Rafael Laboissiere

______________________________________________
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