If you want to 'cut' the vector into equal lengths of 4, for example,
then the following would work:
split(x, as.integer((seq_along(x) - 1) / 4))
On Nov 22, 2007 9:44 AM, Dani Valverde <[EMAIL PROTECTED]> wrote:
> Hello,
> That's very useful. I think the cut() function is the key. However, in
>
Hello,
That's very useful. I think the cut() function is the key. However, in
my real vector I have 13112 points. I would like the function to cut the
vector every certain number of points (ie 4). Is there a way to specify
this without the need of writing each cutting point? For example, I do
n
Hi
you shall be more specific. Do you want to split your vector according
some pionts
split(x, findInterval(x, c(6,12,16)))
if you want to make a factor from your x vector, then you can use
findInterval or cut
cut(x, breaks = c(0,6,12,17, +Inf))
Or something else?
Regards
Petr
[EMAIL PROTEC
3 matches
Mail list logo