Thank you a ton - this simplifies my work considerably.- Shankar
Rolf Turner wrote:
On 24/03/2010, at 9:50 AM, shan...@bios.unc.edu wrote:
Hello,
I am working multiple simulated data sets with missing values, I would
like to store these data sets in either tab delimited format for .csv
format with missing values marked as NaN's instead of NA's.
I read the import/export document which mentions that write.table
command converts NaN's to NA. Is there any other way I can store the
NaN's. I tried the write syntax it gives me error codes.
Each data files are of dimensions 1000 x 21 .
I would appreciate any help in this regard.
A feasible workaround is to convert your data to character before writing them.
Suppose that your data are in a data frame called ``clyde''. Set
mung <- as.data.frame(lapply(clyde,as.character))
write.csv(mung,"mung.csv",row.names=FALSE,quote=FALSE)
# Check:
gorp <- read.csv("mung.csv")
all.equal(gorp,clyde)
[1] TRUE
HTH
cheers,
Rolf Turner
######################################################################
Attention:
This e-mail message is privileged and confidential. If you are not the
intended recipient please delete the message and notify the sender.
Any views or opinions presented are solely those of the author.
This e-mail has been scanned and cleared by MailMarshal
www.marshalsoftware.com
######################################################################
______________________________________________
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.