splitBy {Jmisc} | R Documentation |
Split a vector by a sequence of length
Description
Split a vector by a sequence of length This function will
split the vector x
into length(x)
subvector.
The length of each subvector is given by by
.
Usage
splitBy(x, by)
Arguments
x |
A vector to be splitted |
by |
A vector of length |
Value
a list of subvector
Author(s)
TszKin Julian Chan ctszkin@gmail.com
Examples
splitBy((1:10)*10,c(2,2))
splitBy((1:10)*10,c(2,3,4))
## Not run:
expect_equivalent(splitBy((1:10)*10,c(2,2)) , list(c(10,20),c(30,40)))
expect_equivalent(splitBy((1:10)*10,c(2,3,4)) , list( c(10,20), c(30,40,50) ,c(60,70,80,90) ))
## End(Not run)
[Package Jmisc version 0.3.1.1 Index]