Hi,
Use ?aggregate(), ?ddply() from library(plyr) etc.
dat <- read.table(text="ua ELM PRP
122C MO 5
122C BR 3
122C FA 1
122C MO 1
122D BR 7
122D MO 2
122D BR 1",sep="",header=TRUE,stringsAsFactors=FALSE)
library(plyr)
ddply(dat,.(ua,ELM),summarize,PRP=sum(PRP))
# ua ELM PRP
#1 122
if you post in HTML you loose the line-ends and create confusion. Please learn
to post in plain text.
--
David.
> On Mar 11, 2014, at 5:02 PM, catalin roibu wrote:
>
> Hello all!
>
> I have a problem with R. How can I do this assemble the ELM PRP for each ua.
> My data is like this:
>
> ua
Hello,
To me, and maybe for others, it is beyond understanding. Please clarify.
Regards,
Pascal
On Tue, Mar 11, 2014 at 7:02 PM, catalin roibu wrote:
> Hello all!
>
> I have a problem with R. How can I do this assemble the ELM PRP for each ua.
> My data is like this:
>
> ua ELM PRP 122C MO 5
Hello all!
I have a problem with R. How can I do this assemble the ELM PRP for each ua.
My data is like this:
ua ELM PRP 122C MO 5 122C BR 3 122C FA 1 122C MO 1 122D BR 7 122D MO 2
122D BR 1
and I want to obtain something like this:
ua ELM PRP 122C MO 6 122C BR 3 122C FA 1 122D BR 8
4 matches
Mail list logo