Skip to content

Instantly share code, notes, and snippets.

@jhnwllr
Created December 22, 2021 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhnwllr/598afb4b49db1ab3e26500487f010d29 to your computer and use it in GitHub Desktop.
Save jhnwllr/598afb4b49db1ab3e26500487f010d29 to your computer and use it in GitHub Desktop.
make an html table for pasting into outlook
library(dplyr)
library(purrr)
library(xtable)
d = readr::read_tsv("C:/Users/ftw712/Desktop/Legume/data/legume_unmatched.tsv") %>%
arrange(-count) %>%
glimpse() %>%
head(30) %>%
mutate(n_suggestions = map_int(v_scientificname,~nrow(rgbif::name_suggest(.x)$data))) %>%
mutate(n_suggestions = format(n_suggestions, nsmall = 0)) %>%
mutate(n_occ = format(count, nsmall = 0)) %>%
mutate(link = paste0('<a href=https://www.gbif.org/species/search?q=',gsub(" ","%20",v_scientificname),'>search</a>')) %>%
select(v_scientificname,n_occ,n_suggestions,link) %>%
glimpse()
print(xtable(d), type = "html", file = "C:/Users/ftw712/Desktop/html_table.html",sanitize.text.function = force,include.rownames=FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment