Skip to content

All anchored series from a vector?

3 messages · Mark Leeds, Gábor Csárdi, Johannes Graumann

#
lapply(1:length(myvector) function(.length) {
c(myvector[1}:myvector[.length])
})

but test it because i didn't.
#
On Wed, Dec 19, 2007 at 12:01:25AM +0100, Johannes Graumann wrote:
Note that this fails if length(myvector)==0. 
Good to know the corner cases.

Gabor

  
    
#
Debugged version:
lapply(1:length(myvector), function(.length) {
myvector[1:.length]
})

Thanks for showing the direction!

Joh
markleeds at verizon.net wrote: