Juan Antonio Balbuena
2012-Jan-26 15:17 UTC
[R] Error in ifelse(append, "a", "w") : , (list) object cannot be coerced to type 'logical'
Hello I will appreciate your help with the following. Running a script in R 2.14.1 under windows vista I get the following error message: Error in ifelse(append, "a", "w") : (list) object cannot be coerced to type 'logical' However, the very same script runs perfectly well under Ubuntu. My understanding is that this type of error is associated to writing data to disk. So the problem is likely caused by the following statements, which are inside a loop: P.vector <- c(P1, P2, P3) write (P.vector, file = "Type2_simul3_2012.txt", sep ="\t ", append =T). I have read that including "\" in such statements can be problematic, because it is a scape character in R, but trying sep=" " instead of "\t" did not solve the problem. Any help will be much appreciated. Thanks in advance. Juan A. Balbuena -- Dr. Juan A. Balbuena Marine Zoology Unit Cavanilles Institute of Biodiversity and Evolutionary Biology University of Valencia [1]http://www.uv.es/~balbuena P.O. Box 22085 [2]http://www.uv.es/cavanilles/zoomarin/index.htm 46071 Valencia, Spain [3]http://cetus.uv.es/mullpardb/index.html e-mail: [4]j.a.balbuena at uv.es tel. +34 963 543 658 fax +34 963 543 733 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NOTE! For shipments by EXPRESS COURIER use the following street address: C/ Catedr??tico Jos?? Beltr??n 2, 46980 Paterna (Valencia), Spain. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ References 1. http://www.uv.es/%7Ebalbuena 2. http://www.uv.es/cavanilles/zoomarin/index.htm 3. http://cetus.uv.es/mullpardb/index.html 4. mailto:j.a.balbuena at uv.es
David Winsemius
2012-Jan-26 16:32 UTC
[R] Error in ifelse(append, "a", "w") : , (list) object cannot be coerced to type 'logical'
On Jan 26, 2012, at 10:17 AM, Juan Antonio Balbuena wrote:> > Hello > I will appreciate your help with the following. > Running a script in R 2.14.1 under windows vista I get the > following error > message: > Error in ifelse(append, "a", "w") : > (list) object cannot be coerced to type 'logical' > However, the very same script runs perfectly well under Ubuntu. > My understanding is that this type of error is associated to > writing data to > disk. So the problem is likely caused by the following statements, > which are > inside a loop: > P.vector <- c(P1, P2, P3) > write (P.vector, file = "Type2_simul3_2012.txt", sep ="\t ", > append =T).> I have read that including "\" in such statements can be > problematic, > because it is a scape character in R, but trying sep=" " instead > of "\t" did > not solve the problem.Isn't it much more likely that your failure to use TRUE and instead taking the lazy and failure-prone shortcut of using only "T" that is the root of the problem.> Any help will be much appreciated. Thanks in advance. > Juan A. Balbuena > > -- > > Dr. Juan A. Balbuena > Marine Zoology Unit > Cavanilles Institute of Biodiversity and Evolutionary Biology > University of > Valencia > [1]http://www.uv.es/~balbuena > P.O. Box 22085 > [2]http://www.uv.es/cavanilles/zoomarin/index.htm > 46071 Valencia, Spain > [3]http://cetus.uv.es/mullpardb/index.html > e-mail: [4]j.a.balbuena at uv.es tel. +34 963 543 658 fax +34 > 963 543 733 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > NOTE! For shipments by EXPRESS COURIER use the following street > address: > C/ Catedr??tico Jos?? Beltr??n 2, 46980 Paterna (Valencia), Spain. > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > References > > 1. http://www.uv.es/%7Ebalbuena > 2. http://www.uv.es/cavanilles/zoomarin/index.htm > 3. http://cetus.uv.es/mullpardb/index.html > 4. mailto:j.a.balbuena at uv.es > ______________________________________________ > 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.David Winsemius, MD West Hartford, CT