[R] read.table and column class

From: Johannes Graumann <johannes_graumann_at_web.de>
Date: Tue, 15 Apr 2008 11:10:10 +0200


Hi,
I read in some tabular data using this:

> read.table(file, quote = "\"", header = TRUE, sep = "\t",
> stringsAsFactors > = FALSE, comment.char = "")

One slight problem I have now is that some columns in the data set contain either "" or "+", which means FALSE or TRUE respectively. The command results in those columns being numeric with "NA" corresponding to the empty case and "0" to the "+"-case. Is there any smart way of making read table rendering these columns boolean to start with?

Thanks for any insight, Joh



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. Received on Tue 15 Apr 2008 - 09:13:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 15 Apr 2008 - 11:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive