Skip to content
Prev 76963 / 398502 Next

how to do something like " subset(mat, ("col1">4 & "col2">4)) "

Florence Combes <fcombes at gmail.com> writes:
Well, subset has methods for vectors and data frames, so what happens
for matrices is basically that they get converted to vectors. I don't
know what gave you the idea of quoting the names, but 

"colb">4

is TRUE because numbers sort before letters!

Try something like

as.matrix(subset(as.data.frame(mat),colb>4 & colc>4))