[R] Dplyr question

Dr Eberhard W Lisse e| @end|ng |rom ||@@e@NA
Thu Oct 15 12:41:55 CEST 2020


This is well described in the manual.

Sounds like homework...

el

On 15/10/2020 12:39, Nico Gutierrez wrote:
> Hi All,
> 
> Trying to get familiar with dplyr so I have a basic question:
> 
> How to summarise sum(Values) per species, maintaining Code column (each species has a Code):
> 
>           Species					Values	     Code
> 1        Acanthocybium solandri        33        		LC
> 2        Makaira nigricans        		20        		VU
> 3        Makaira nigricans                 20        		VU
> 4.       Makaira nigricans                 20       		VU
> 5	  Sarda sarda        		         2      		LC
> 4        Lethrinus lentjan                   12        		LC
> 5        Raja pita        			8        		DD
> 6        Raja pita  				2			DD
> 
> I need:
> 
>          Species					Values	     Code
> 1        Acanthocybium solandri        33        		LC
> 2        Makaira nigricans        		60        		VU
> 3	  Sarda sarda        		         2      		LC
> 4        Lethrinus lentjan                   12        		LC
> 5        Raja pita        			10        		DD
> 
> 
> Thanks :)
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
> 

-- 
Dr. Eberhard W. Lisse   \         /       Obstetrician & Gynaecologist 
el using lisse.NA             / *      |  Telephone: +264 81 124 6733 (cell)
PO Box 8421 Bachbrecht  \      /  If this email is signed with GPG/PGP
10007, Namibia           ;____/ Sect 20 of Act No. 4 of 2019 may apply



More information about the R-help mailing list