Re: [R] read.table and column class

2008-04-15 Thread Johannes Graumann
Thanks for your inputs. colClasses will be learned. Joh Prof Brian Ripley wrote: > On Tue, 15 Apr 2008, jim holtman wrote: > >> Define those columns as being character with colClasses and then use >> 'ifelse' to change it to boolean: >> >>> x <- c("", "", "+", "", "+") >>> x >> [1] "" "" "+"

Re: [R] read.table and column class

2008-04-15 Thread Prof Brian Ripley
On Tue, 15 Apr 2008, jim holtman wrote: > Define those columns as being character with colClasses and then use > 'ifelse' to change it to boolean: > >> x <- c("", "", "+", "", "+") >> x > [1] "" "" "+" "" "+" >> y <- ifelse(x == "", FALSE, TRUE) >> y > [1] FALSE FALSE TRUE FALSE TRUE Or defi

Re: [R] read.table and column class

2008-04-15 Thread jim holtman
Define those columns as being character with colClasses and then use 'ifelse' to change it to boolean: > x <- c("", "", "+", "", "+") > x [1] "" "" "+" "" "+" > y <- ifelse(x == "", FALSE, TRUE) > y [1] FALSE FALSE TRUE FALSE TRUE > On Tue, Apr 15, 2008 at 5:10 AM, Johannes Graumann <[EMAIL

[R] read.table and column class

2008-04-15 Thread Johannes Graumann
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