Question: Subsetting in R based on row name?
1
gravatar for hakimelakhrass
4.9 years ago by
hakimelakhrass80 wrote:

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 • 44k views
ADD COMMENTlink modified 4.9 years ago by Devon Ryan98k • written 4.9 years ago by hakimelakhrass80
10
gravatar for vivekbhr
4.9 years ago by
vivekbhr630
Germany
vivekbhr630 wrote:

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

ADD COMMENTlink written 4.9 years ago by vivekbhr630
6
gravatar for Devon Ryan
4.9 years ago by
Devon Ryan98k
Freiburg, Germany
Devon Ryan98k wrote:

help("%in%")

ADD COMMENTlink written 4.9 years ago by Devon Ryan98k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1820 users visited in the last hour
_