Dear helpers,
I'm trying to extract certain rows from a matrix according to the
values the rows have in a certain column. I've been googling for a
while without result.
Here's a reproducible example of a matrix (and the one I was playing
with initially):
[1] "matrix"
I can extract according to rows and column positions:
available.packages(contriburl=contrib.url(myrepo))[2,2]
[1] "0.1"
But how can I extract the rows according to their values in a column,
when $ is not usable for vector matrices? Say I would like all the
rows where the value in the column "Version" is "0.1" (as above). For
a data frame, I would have done it like this:
available.packages(contriburl=contrib.url(myrepo))->avail.pack
avail.pack[avail.pack$Version=="0.1",]
Error in avail.pack$Version : $ operator is invalid for atomic vectors