[R] to build a data.frame

Arnaud Michel michel.arnaud at cirad.fr
Wed Jun 19 16:23:25 CEST 2013


I have the following dataframe

df <- data.frame(

Country=c("Zimbabwe","Burkina Faso","South Africa","Madagascar","Tanzania",
"Mali","Mozambique","Madagascar","Ghana","Nigeria","Kenya","Burkina Faso",
  "South Africa","Tanzania","Kenya","Ethiopia" ),


I would like to build a other dataframe with name Country
where column 1 is country,
the column 2 is number of project (in the country)
the column 3 is the code Iso (wich correspond with the country : Ex ZW 
is ISO of Zimbabwe)
       Pays        PaysIso  NbrProj
    Zimbabwe      ZW       1
  Burkina Faso    BF        2

I know associate Country and Number of projets but how associate Iso

Any idea ?
Thank you for your help

Chargé de mission auprès du DRH
DGDRD-Drh - TA 174/04
Av Agropolis 34398 Montpellier cedex 5
tel :
fax :

More information about the R-help mailing list