Re: [R] build matrix with the content of one column of a data frame in function of two factors

2008-07-10 Thread VinceD
So the solution is : tapply(content, list(factor1, factor2), mean) An example of what it does : > my.data name item vote 1 Ricardo Coke 20 2 Ricardo Fanta 60 3 Ricardo Pepsi 100 4 Marie Pepsi 40 5 Marie Coke 60 6 Julia

[R] build matrix with the content of one column of a data frame in function of two factors

2008-07-09 Thread VinceD
Hello, First, thanks for your help (and sorry for my english !) I have a data frame in which each row represents a vote (in percent, only 20,40, 60,80,100) of one person on one content, with three columns : name (the name of the voters), content_id, vote : str(votesredac) 'data.frame': 1000 o

Re: [R] build matrix with the content of one column of a data frame in function of two factors

2008-07-09 Thread VinceD
Seems that the following makes what I want : attach(votesredac) tapply(value, list(name, content_id), mean) Only thing is, I don't need to make a mean - there is only one or no value. VinceD wrote: > > Hello, > > First, thanks for your help (and sorry for my english !) &