I have a data frame with three columns. The first one is filled with factors,
the second one with numeric values and the third one is an empty vector.
I need fill the third column with the results of the function
tapply(secondcolumn,firstcolumn,mean) so that I have for each row of the
third column
The first column has 331 rows, the number of factors in the second column is
20 repeated in order to have 331 rows too. What I need is to reapeat in the
third column each of the 20 results derived from
tapply(firstcolumn,secondcolumn,mean) as many times as each factor appears
in the second column.
Thank you so much! That's exactly what I needed!
much love
--
View this message in context:
http://r.789695.n4.nabble.com/filling-a-vector-with-a-tapply-function-applied-to-another-vector-tp3039271p3039396.html
Sent from the R help mailing list archive at Nabble.com.
___
Hi guys, I have two data frames: one referred to 2008 and one to 2009. Their
structure is identical except for the different data in them.
I need to create a vector alfa of the same length of the dataframe 2009 and
fill each element with the mean of 2008$var1 conditional to the subgroup
indicated
Thank you very much Josh, I guess you`re right.
So this is an example:
data frame 1 has 2 columns and 10 rows. The first column is "score" a
variable indicating the number of goals scored by a football team
score<-c(1,2,0,2,1,1,3,2,1,0), column 2 contains the football "teams " where
teams<-c(a,b,c
Thank you so much Josh, that's exactly what i needed!
Cheers
alb
--
View this message in context:
http://r.789695.n4.nabble.com/conditional-mean-between-two-data-frames-with-different-levels-tp3049010p3049980.html
Sent from the R help mailing list archive at Nabble.com.
Hi guys.
I have a dataset with 4 columns. In the first and second column I have the
same qualitative variable referred to different teams of people. There are
10 teams in total and they compete against each other to perform a certain
task whose result is stored in the third column for the team rec
7 matches
Mail list logo