Re: [R] grab values in R

2014-03-11 Thread arun
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 122C  BR   3
#2 122C  FA   1
#3 122C  MO   6
#4 122D  BR   8
#5 122D  MO   2
A.K.




On Tuesday, March 11, 2014 6:04 AM, 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  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  122D MO 2

Thank you very much!


-- 


---
Catalin-Constantin ROIBU
Lecturer PhD, Forestry engineer
Forestry Faculty of Suceava
Str. Universitatii no. 13, Suceava, 720229, Romania
office phone     +4 0230 52 29 78, ext. 531
mobile phone   +4 0745 53 18 01
                       +4 0766 71 76 58
FAX:                +4 0230 52 16 64
silvic.usv.ro

    [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] grab values in R

2014-03-11 Thread David Winsemius
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 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  122D MO 2
> 
> Thank you very much!
> ML
> 
> -- 
> 
> 
> ---
> Catalin-Constantin ROIBU
> Lecturer PhD, Forestry engineer
> Forestry Faculty of Suceava
> Str. Universitatii no. 13, Suceava, 720229, Romania
> office phone +4 0230 52 29 78, ext. 531
> mobile phone   +4 0745 53 18 01
>   +4 0766 71 76 58
> FAX:+4 0230 52 16 64
> silvic.usv.ro
> 
>[[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] grab values in R

2014-03-11 Thread Pascal Oettli
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  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  122D MO 2
>
> Thank you very much!
>
>
> --
>
>
> ---
> Catalin-Constantin ROIBU
> Lecturer PhD, Forestry engineer
> Forestry Faculty of Suceava
> Str. Universitatii no. 13, Suceava, 720229, Romania
> office phone +4 0230 52 29 78, ext. 531
> mobile phone   +4 0745 53 18 01
>+4 0766 71 76 58
> FAX:+4 0230 52 16 64
> silvic.usv.ro
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] grab values in R

2014-03-11 Thread catalin roibu
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  122D MO 2

Thank you very much!


-- 


---
Catalin-Constantin ROIBU
Lecturer PhD, Forestry engineer
Forestry Faculty of Suceava
Str. Universitatii no. 13, Suceava, 720229, Romania
office phone +4 0230 52 29 78, ext. 531
mobile phone   +4 0745 53 18 01
   +4 0766 71 76 58
FAX:+4 0230 52 16 64
silvic.usv.ro

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.