[R] Cannot be coerced to logical?

From: Tova Fuller <suprtova_at_ucla.edu>
Date: Mon 30 Oct 2006 - 02:34:04 GMT

Hello all,

So I am having a puzzling problem. I am working with a 534 x 1065 data frame entitled LocalMaxExpBlue.COR which is completely full of logical values "TRUE" and "FALSE." However, when I attempt to manipulate this data frame, R does not recognize it as logical. Strangely enough, it will identify individual columns (but not rows) as logical. It will also identify all of the individual elements of each row as logical. Here are some examples:

> is.logical(LocalMaxExpBlue.COR)

> is.logical(LocalMaxExpBlue.COR[,1])

[1] TRUE
> is.logical(LocalMaxExpBlue.COR[1,])

[1] FALSE # If we look at the first five values of the first row, we notice that each value is indeed logical:
> LocalMaxExpBlue.COR[1,c(1:5)]

      X1 X2 X3 X4 X5
1 FALSE FALSE FALSE FALSE FALSE # However, it does not recognize this!:
> is.logical(LocalMaxExpBlue.COR[1,c(1:5)])
[1] FALSE # It does recognize that individual values of each row are logical:
> is.logical(LocalMaxExpBlue.COR[1,1])
[1] TRUE
> is.logical(LocalMaxExpBlue.COR[1,2])
[1] TRUE
# etc.

Thank you in advance for your help. Perhaps I have made some small obvious mistake.

R-help@stat.math.ethz.ch 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 Mon Oct 30 19:18:04 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 30 Oct 2006 - 08:30:15 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.