[R] How to search for a sequence(and its combination) inside a vector?
Berend Hasselman
bhh at xs4all.nl
Sat Jul 20 19:38:07 CEST 2013
On 20-07-2013, at 19:11, C W <tmrsg11 at gmail.com> wrote:
> Thanks John.
>
> Why do I get length of 5 and 6? I thought I am only tallying up 1 to 3?
>> table(dd)
> val
> leng TRUE
> 1 5
> 2 4
> 3 81
> 5 1
> 6 4
I wouldn't know. Not same data?
It's completely unclear, to me at least, what you actually are trying to do.
With your initial data, my initial proposal and John's procedure I got
> cc <- data.frame(b[[1]], b[[2]])
> names(cc) <- c("leng", 'val')
> dd <- subset(cc, val ==TRUE )
> table(dd)
val
leng TRUE
1 3
3 12
Berend
More information about the R-help
mailing list