Re: [R] A basic design question for R

2012-06-16 Thread Onur Uncu
Thank you all for the useful replies. I will go with the list of matrices idea as suggested multiple times. On Sat, Jun 16, 2012 at 6:50 PM, Jeff Newmiller wrote: > A data frame is a list of vectors all with the same length. Note that vectors > have simple types. Sticking other types of object

Re: [R] A basic design question for R

2012-06-16 Thread Jeff Newmiller
A data frame is a list of vectors all with the same length. Note that vectors have simple types. Sticking other types of objects into it violates the generic constraint stated above, leading to incompatibility with many functions that normally work with data frames. If you want to maintain data

Re: [R] A basic design question for R

2012-06-16 Thread Petr Savicky
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

Re: [R] A basic design question for R

2012-06-16 Thread Rui Barradas
Hello, Follow this example. It uses a list to hold the mortality curves. Since there are only two different gender/age combinations, it first gets all such unique combinations and then creates a list of the appropriate length. Then assigns a matrix to the first list element. DF <- read.table(

Re: [R] A basic design question for R

2012-06-16 Thread Onur Uncu
Thank you. But isn't a data frame already a list? What is wrong with adding a column to the existing data frame (a column with the mortality curve matrices)? Sorry if I am being difficult. Just want to learn good design in R. On Sat, Jun 16, 2012 at 5:49 PM, steven mosher wrote: > use a list.

Re: [R] A basic design question for R

2012-06-16 Thread steven mosher
use a list. or create new class which is a list On Jun 16, 2012 8:52 AM, "Onur Uncu" wrote: > 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

[R] A basic design question for R

2012-06-16 Thread Onur Uncu
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. N