Re: [R] All a column to a data frame with a specific condition

2010-06-25 Thread Joris Meys
merge(sum_plan_a,data,by="plan_a") Cheers Joris On Sat, Jun 26, 2010 at 2:27 AM, Yi wrote: > Hi, folks, > > Please first look at the codes: > > plan_a=c('apple','orange','apple','apple','pear','bread') > plan_b=c('bread','bread','orange','bread','bread','yogurt') > value=1:6 > data=data.frame(p

[R] All a column to a data frame with a specific condition

2010-06-25 Thread Yi
Hi, folks, Please first look at the codes: plan_a=c('apple','orange','apple','apple','pear','bread') plan_b=c('bread','bread','orange','bread','bread','yogurt') value=1:6 data=data.frame(plan_a,plan_b,value) library(plyr) library(reshape) mm=melt(data, id=c('plan_a','plan_b')) sum_plan_a=cast(mm,