Following the post about %in% operator, I received this tweet: https://twitter.com/benwhite21/status/510520550553165824
to answer the question I’ve put the two snippets in two functions:
filter(object,object[,column] %in% vector)
object[object[,column] %in% vector,]
Then, thanks to the great package microbenchmark, I made a comparison between those two functions, testing the time of execution of both, for 100.000 times.
comparison = microbenchmark(Rbase_snippet(iris,5,vec),dplyr_snippet(iris,5,vec),times = 100000)
#plot the output
labs(title = "comparison between dplyr_snippet and Rbase_snippet", y="snippet")
And that was the result:
R Base package seems to be the winner, even if just for an handful of microseconds…
Nevertheless, I am really grateful to Ben, it was a great fun!