Re: [R] Extracting rows of a data.frame by "identical"

2016-05-03 Thread Ivan Calandra
I'm not sure what you are trying to do... Have you checked what the output of d[c("b","c")] is? And what about the output of identical(d[c("b","c")],c(4,10)) ? As is, I don't see the point of going through identical(). Maybe you're looking for which() or "%in%"? If you just want to subset th

Re: [R] Extracting rows of a data.frame by "identical"

2016-05-02 Thread Ulrik Stervbo
Can you use subset? subset(d, b == 4 & c == 10) Best Ulrik On Tue, 3 May 2016 04:58 jpm miao, wrote: > Is it possible? I am expecting the result to be the second row of the data > frame ... > > > d<-data.frame(a=1:3, b=3:5,c=9:11) > > d > a b c > 1 1 3 9 > 2 2 4 10 > 3 3 5 11 > > d[identic

[R] Extracting rows of a data.frame by "identical"

2016-05-02 Thread jpm miao
Is it possible? I am expecting the result to be the second row of the data frame ... d<-data.frame(a=1:3, b=3:5,c=9:11) > d a b c 1 1 3 9 2 2 4 10 3 3 5 11 > d[identical(d[c("b","c")],c(4,10)),] [1] a b c <0 rows> (or 0-length row.names) [[alternative HTML version deleted]]