On Tue, 18 Dec 2001 olshena@mskcc.org wrote:
Full_Name: Adam B. Olshen Version: 1.3.1 OS: Linux Submission from: (NULL) (140.163.222.233) There appears to be a bug with write.table if the object being written is a matrix. Specifically, the option row.names=F gives an error. I have seen this problem repeated in the Windows implementation. An example is below. Adam Olshen olshena@mskcc.org This works:
write.table(matrix(rnorm(100),10),"blah",row.names=T)
And this works:
write.table(as.data.frame(matrix(rnorm(100),10)),"blah",row.names=F)
This does not work:
write.table(matrix(rnorm(100),10),"blah",row.names=F)
Error in gsub(pattern, replacement, x, ignore.case, extended) :
invalid argument
Actually, this happens only for numerical matrices, so just do X <- matrix(rnorm(100),10) X[] <- as.character(X) write.table(X,"blah",row.names=F) or even write.table(X,"blah",row.names=F, quote=F) Note though that for almost all purposes write.table(format(X), "blah",row.names=F, quote=F) would be better. Nevertheless I'll put in the obvious fix for 1.4.0.
Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._