Florian,

There are a number of different ways to handle data like this.  Two that 
come to my mind are shown below.  You could allow each observation to be 
represented by multiple rows in the data frame:

   obs dishes
1    1 saucer
2    2    cup
3    2  plate
4    2 saucer
5    3    cup
6    3  plate
7    4    cup
8    4 saucer
9    6  plate
10   6 saucer
11   7  plate
12   8    cup

Or you could let each level be its own variable:

  obs cup plate saucer
1   1   0     0      1
2   2   1     1      1
3   3   1     1      0
4   4   1     0      1
5   5   0     0      0
6   6   0     1      1
7   7   0     1      0
8   8   1     0      0

The arrangement that you choose will likely depend on what you want to do 
with the data.

Jean



Florian Ahrweiler <florian.ahrweiler@uni-wh.de> wrote on 11/15/2012 
10:10:53 AM:
> 
> In a data frame, I would like to assign two or more factors to one 
> observation. Is it possible? If so, how?
> 
> Example: In the variable $ dishes, there are several levels: "cup", 
> "plate", "saucer". In my first observation, I see a saucer only. But in 
> the second one, I see a cup and a saucer.  In the third, however, there 
> is only a cup, in the fourth a plate only and so forth.
> 
> I'm an R beginner and I'll be grateful for any help.
> 
> Florian

	[[alternative HTML version deleted]]


