[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Applying function to vector by index

**From**: |
Iago Mosqueira |

**Subject**: |
Applying function to vector by index |

**Date**: |
Mon, 9 Dec 2002 16:22:17 -0000 |

Hi,
I have a long vector classified in ten bins of different length according to
another vector. I want to estimate the variance, or any other function, of
the values from the first vector for each of the categories described by the
second, without using a loop. Is there any obvious way of doing this I am
overlooking? In R one could do
sapply(split(d,idx),var)
where d is my data vector and idx the index vector.
Many thanks,
iago
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------

**Applying function to vector by index**,
*Iago Mosqueira* **<=**
**Re: Applying function to vector by index**, *Mike Miller*, `2002/12/09`
**Re: Applying function to vector by index**, *Paul Kienzle*, `2002/12/09`
**Re: Applying function to vector by index**, *Iago Mosqueira*, `2002/12/09`
**Re: Applying function to vector by index**, *Paul Kienzle*, `2002/12/09`
**Re: Applying function to vector by index**, *Paul Kienzle*, `2002/12/09`
**Re: Applying function to vector by index**, *Andy Adler*, `2002/12/09`
**Re: Applying function to vector by index**, *Schloegl Alois*, `2002/12/10`
**Re: Applying function to vector by index**, *Paul Kienzle*, `2002/12/12`
**Re: Applying function to vector by index**, *Andy Adler*, `2002/12/12`
**Re: Applying function to vector by index**, *Schloegl Alois*, `2002/12/12`