[R] array of variable length vectors

Giampiero Salvi giampi at speech.kth.se
Mon Feb 2 11:28:44 CET 2004

I'd like to store N vectors of different lengths, and to be able to
access them with an index, and eventually free the memory for one
of them without modifying the indexes to the others.

In C this would be a vector of N pointers that point to memory cells
independently allocated.

For example

int *pv[3];

pv[0] = (int *) malloc(13 * sizeof(int));
pv[1] = (int *) malloc(7 * sizeof(int));
pv[2] = (int *) malloc(110 * sizeof(int));


What is the best data type (or class) in R to do such a thing?

Thank you!
Giampiero Salvi, M.Sc.          www.speech.kth.se/~giampi
Speech, Music and Hearing       Tel:      +46-8-790 75 62
Royal Institute of Technology   Fax:      +46-8-790 78 54
Drottning Kristinasv. 31,  SE-100 44,  Stockholm,  Sweden

More information about the R-help mailing list