[R] A basic design question for R

Onur Uncu onuruncu at gmail.com
Sat Jun 16 17:50:29 CEST 2012


Hello R Community,

I have the following design question. I have a data set that looks
like this (shortened for the sake of example).

Gender  Age
 M          70
 F           65
 M          70

Each row represents a person with an age/gender combination. We could
put this data into a data frame.

Now, I would like to do some actuarial analysis on this data set. To
do so, I need to create and store a mortality curve for each person in
the table (a mortality curve is a matrix with 2 columns: date and
survival probability). I can write a function that returns a mortality
curve given gender and age.  The question is the following: In what
data format should I store all these mortality curve objects? Should I
add a column to the data frame and each entry in that column is a
matrix (a mortality curve)? This way, the mortality curve would be
stored next to age/gender data in the data frame. However, I read in
several places that putting vectors/matrices as elements of a data
frame is a bad idea. I do not know why. What is a good design choice
in this instance please? How should I store the mortality curves?

Thank you for your help.



More information about the R-help mailing list