Skip to content

Commit

Permalink
fixing publisher table R script
Browse files Browse the repository at this point in the history
  • Loading branch information
John Waller committed Sep 12, 2024
1 parent ee8df86 commit cac6fda
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build-table-script/R/table.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ glimpse()

gbif_country = rgbif::enumeration_country() %>% select(Country=title,iso2) %>% glimpse()


pp = ss %>%
dplyr::filter(pd == "publisher") %>%
select(key,`Activity sector`) %>%
Expand All @@ -35,10 +36,11 @@ mutate(`Occurrence records` = map_dbl(key,~ rgbif::occ_search(publishingOrg = .x
mutate(Datasets = map_dbl(key,~rgbif::dataset_search(publishingOrg= .x,limit=0)$meta$count)) %>%
mutate(`Data citations` = map_dbl(key,~rgbif::lit_count(publishingOrg = .x))) %>%
mutate(Company = paste0("https://www.gbif.org/publisher/",key,"[",name,"]")) %>%
mutate(iso2 = map_chr(key,~rgbif::dataset_search(publishingOrg=.x,limit=1)$data$publishingCountry)) %>%
mutate(iso2 = map_chr(key,~rgbif::organizations(uuid=.x,limit=1)$data$country)) %>%
merge(gbif_country,by="iso2") %>%
glimpse()


dd = ss %>%
dplyr::filter(pd == "dataset") %>%
select(key,`Activity sector`) %>%
Expand All @@ -59,6 +61,8 @@ tt = rbind(pp,dd) %>%
arrange(name) %>%
select(Company, `Activity sector`, Country = iso2, Datasets, `Occurrence records`, `Data citations`)

# stop("for debugging stop before writing csv to prevent infitinite github actions loop")

# save csv and clean up
tt %>%
mutate(`Datasets` = trimws(format(`Datasets`, nsmall=0, big.mark="\u202F"),which ="left")) %>%
Expand Down

0 comments on commit cac6fda

Please sign in to comment.