[R] A basic design question for R
Petr Savicky
savicky at cs.cas.cz
Sat Jun 16 19:36:50 CEST 2012
On Sat, Jun 16, 2012 at 06:14:38PM +0100, Onur Uncu wrote:
> Thank you. But isn't a data frame already a list?
Data frame is a list of columns. The suggestion was to use a list,
whose length is the number of rows and which contains a matrix
for each row.
> What is wrong with
> adding a column to the existing data frame (a column with the
> mortality curve matrices)?
The elements of a data frame cannot be matrices. If the matrices
may be unfolded to vectors, then these vectors can be included
into the rows. Something like
Gender Age x1 x2 x3 y1 y2 y3
M 70 ...
F 65 ...
M 70 ...
where ... represent six numbers in each row, which form a matrix
x1 y1
x2 y2
x3 y3
However, i think, a list of matrices is more flexible.
Petr Savicky.
More information about the R-help
mailing list