This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Subsetting in R based on row name?

Hello,

So I am trying to take a subset of my data based on row names. When I used one row name it works no problem. When I use a list I get an error.

x <- subset(dataset, rownames(dataset) == names)
Warning message:
In rownames(dataset) == names :
  longer object length is not a multiple of shorter object length

Thanks.

r

2 answers

Hi. . Just replace your == with %in%

help("%in%")

Log in to answer this question.