p_population <- function(x, se, p) { exp(qnorm(p = p, mean = x, sd = se)) } results %>% filter(ModelType == "yearly imputed index: Total ~ Year + Month") %>% transmute( LocationGroup, genus = str_replace(scientific_name, "([[:alpha:]]*) .*", "\\1"), species = str_replace(scientific_name, "[[:alpha:]]* (.*)", "\\1") %>% str_replace(" ", "\n"), year = as.integer(as.character(Parameter)), p05 = p_population(Estimate, SE, 0.05), p10 = p_population(Estimate, SE, 0.1), p30 = p_population(Estimate, SE, 0.3), p50 = p_population(Estimate, SE, 0.5), p70 = p_population(Estimate, SE, 0.7), p90 = p_population(Estimate, SE, 0.9), p95 = p_population(Estimate, SE, 0.95), Order ) %>% arrange(LocationGroup, Order) %>% group_by(LocationGroup, genus) %>% nest() %>% mutate( id = str_replace(LocationGroup, " ", "-") %>% interaction(genus, sep = "-") %>% as.character(), Previous = lag(LocationGroup), Title = ifelse( is.na(Previous) | Previous != LocationGroup, sprintf("## %s\n\n### %s", LocationGroup, genus), sprintf("### %s", genus) ) ) -> monthly_population monthly_population %>% pull(id) %>% sapply( function(id) { knit_expand("_area_genus_montly_total.Rmd", id = id) } ) %>% paste(collapse = "\n\n") -> rmd knit(text = rmd, quiet = TRUE) %>% cat()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.