Skip to content

Commit

Permalink
#159 create GFCM Task II.2 aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
abennici committed Mar 6, 2023
1 parent 36eb4ba commit 5f26775
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions shiny/shiny-calipseo/assets/country/LBN/compute_gfcm_task_II_2.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
###compute_gfcm_task_II_2
compute_gfcm_task_II_2<-function(ref_species,data){

data<-data%>%
group_by(EST_YEAR,EST_FS,EST_SPC)%>%
summarise(TOTAL_LANDING= sum(EST_LND_CATCH,na.rm=T),
TOTAL_DISCARDS = 0,
TOTAL_CATCH = sum(EST_LND_CATCH,na.rm=T)
)%>%
ungroup()%>%
mutate(COMMENT="",
GSA="27",
EST_SPC=as.character(EST_SPC))%>%
left_join(ref_species%>%select(ID,ASFIS_CODE)%>%mutate(ID=as.character(ID)),by=c('EST_SPC'='ID'))%>%
rename(FLEET_SEGMENT=EST_FS,
SPECIES=ASFIS_CODE)%>%
select(GSA,FLEET_SEGMENT,SPECIES,TOTAL_LANDING,TOTAL_DISCARDS,TOTAL_CATCH,COMMENT)

return(data)

}

0 comments on commit 5f26775

Please sign in to comment.