Skip to content
Prev 293223 / 398502 Next

Data frame vs matrix quirk: Hinky error message?

The difference is in recycling. If the logical matrix has the same
dimensions, it seems to work:
c(FALSE, TRUE, FALSE, TRUE))
[,1] [,2] [,3]
[1,]    1   NA    9
[2,]   NA    6   NA
[3,]    3   NA   11
[4,]   NA    8   NA
X1 X2 X3
1  1 NA  9
2 NA  6 NA
3  3 NA 11
4 NA  8 NA

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352