hadley/lineprof — pull request #28 by saurfang (2014-12-15 23:07:40+00:00)
Title: Fix a bug in contains

There is a bug in `contains` when the `haystack` contains duplicates that is part of `needle`.

For example
```r
lineprof:::contains(c("a","a","b"), c("a","b"))
```
returns 0 where it should return 2

This seems to cause #16. I also encountered similar issues when profiling codes that use `dplyr` where consecutive nested `eval` is quite common with `magrittr`.

I have tested with the following
```r
lineprof:::contains(c("a","a","b"), c("a"))
# 1
lineprof:::contains(c("a","a","b"), c("a", "b"))
# 2
lineprof:::contains(c("a","a","b"), c("a", "c"))
# 0
lineprof:::contains(c("a","a","b"), c("c"))
# 0
lineprof:::contains(c("a","a","b"), character())
# 1
```

Let me know if there is any concerns/suggestions on the implementation logic or code style.