Hi everybody !
little question.
I have 2 dataset
TheLittleOne-data.frame(cbind(c(2,3),c(2,3)))
TheBigOne-data.frame(cbind(c(1,1,2),c(1,1,2)))
And I would like to obtain the TheBigOne - TheLittleOne (the row in
TheBigOne not in TheLittleOne
The result should be:
cbind(c(1,1),c(1,1))
Have you
Here's one way, using a function from the plyr package:
TheLittleOne-data.frame(cbind(c(2,3),c(2,3)))
TheBigOne-data.frame(cbind(c(1,1,2),c(1,1,2)))
keys - plyr:::join.keys(TheBigOne, TheLittleOne)
!(keys$x %in% keys$y)
TheBigOne[!(keys$x %in% keys$y), ]
Hadley
On Thu, Jul 29, 2010 at 1:38
Well, here's one way that might work (explanation below):
The ideas is to turn each row into a character vector and then work with the
two character vectors.
bigs - do.call(paste,TheBigOne)
ix - which(bigs %in% setdiff(bigs,do.call(paste,TheLittleOne)))
TheBigOne[ix,]
However, this may not
perfect !
thx
( I found prob::setdiff too.. but not really what i want)
2010/7/29 Hadley Wickham had...@rice.edu
Here's one way, using a function from the plyr package:
TheLittleOne-data.frame(cbind(c(2,3),c(2,3)))
TheBigOne-data.frame(cbind(c(1,1,2),c(1,1,2)))
keys -
Try this also:
TheBigOne[rowSums(!mapply(is.element, TheBigOne, TheLittleOne)) 0,]
On Thu, Jul 29, 2010 at 3:38 PM, BaKaLeGuM bakale...@gmail.com wrote:
Hi everybody !
little question.
I have 2 dataset
TheLittleOne-data.frame(cbind(c(2,3),c(2,3)))
Well, here's one way that might work (explanation below):
The ideas is to turn each row into a character vector and then work with the
two character vectors.
bigs - do.call(paste,TheBigOne)
ix - which(bigs %in% setdiff(bigs,do.call(paste,TheLittleOne)))
TheBigOne[ix,]
However, this may
6 matches
Mail list logo