View source: R/species_to_latin.R
species_to_italics | R Documentation |
Italicises species names, but not modifiers such as "var."
species_to_italics( x, families = TRUE, modifiers = c("spp", "sp", "fo", "var", "agg"), postfix = c("-type", "-t"), etc = character(0), first_with_dot_only = TRUE, first_capital_only = TRUE, no_numbers = TRUE, no_extra_capitals = TRUE, not_after_capital = TRUE, text = TRUE )
x |
character; one or more species names to be italicised |
families |
logical; should family names be italicised |
modifiers |
character; vector of taxonomic terms not to italicise |
postfix |
character; text appended to species names that should not be italicised |
etc |
character; vector of other words that should not be italicised |
first_with_dot_only |
logical; |
first_capital_only |
logical; if TRUE only the first word starting with a capital letter is italicised |
no_numbers |
logical; if TRUE any words with numbers are not italicised |
no_extra_capitals |
logical; if TRUE any words with capitals other than first letter are not italicised |
not_after_capital |
logical; if TRUE, nothing after first extra capital is capitalised |
text |
logical; TRUE gives output as character vector; FALSE gives list of expressions |
Uses various heuristics to identify which parts of the name should be italicised and which should not. Should identify authority (if present) by the presence of the capital letter. Will probably fail with informal names unless included in 'etc'.
A character vector if “text' is TRUE, otherwise a list of expressions.
species_to_italics(c("Navicula spp.", "Navicula spp", "Poaceae")) library(ggplot2) library(dplyr) library(tidyr) data(SWAP, package = "rioja") SWAP$spec %>% mutate(pH = SWAP$pH) %>% pivot_longer(cols = -pH, names_to = "taxa", values_to = "percent") %>% left_join(as_tibble(SWAP$names), by = c("taxa" = "CODE")) %>% group_by(taxa) %>% filter(sum(percent > 0) > 60, max(percent) > 20) %>% ggplot(aes(x = pH, y = percent)) + geom_point() + facet_wrap(~TaxonName, labeller = as_labeller( species_to_italics, default = label_parsed))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.