Ugh, typo:

On Mon, Oct 8, 2012 at 10:04 AM, Steve Lianoglou
<mailinglist.honey...@gmail.com> wrote:

> R> x <- c(NA,  1, NA,  1,  1,  1,  1,  1,  1, NA,  1)
> R> e <- embed(x, e) ## Take a look at this matrix
> R> r <- apply(e, 1, rle)
> R> sapply(r, function(rr) rr$lengths[1])
> ## [1] 1 1 2 3 3 3 3 1 1

The 2nd param to embed should be 3, so:

R> x <- c(NA,  1, NA,  1,  1,  1,  1,  1,  1, NA,  1)
R> e <- embed(x, 3) ## Take a look at this matrix
R> r <- apply(e, 1, rle)
R> sapply(r, function(rr) rr$lengths[1])
## [1] 1 1 2 3 3 3 3 1 1

Sorry for the confusion ... e and 3 are so close ;-)

-st3v3

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to