strip.spec: Extract Genus Name from Linnean Binomial

Description Usage Arguments Value See Also Examples

View source: R/strip.spec.R

Description

Strips the epitheton from a Linnean binomial and return the genus name.

Usage

1
strip.spec(x, mode = "strsplit")

Arguments

x

A vector of mode "character" containing Linnean binomials. The separating character can be space (" ") or underscore ("_").

mode

A vector of mode "character" chosing between two algorithms: "strsplit" is fast, but has failed on avery large vector (> 170000 element); "regex" is not as fast, but has handled also large vectors successfully.

Value

A vector of mode "character" containing genus names.

See Also

strip.infraspec

Examples

1
2
3
4
5
6
7
strip.spec("Megaptera_novaengeliae")

## separating characters cannot be mixed!
spec <- c("Megaptera_novaengeliae", "Megaptera novaeangliae")
strip.spec(spec) # does not work
strip.spec(gsub("_", " ", spec)) # this works
strip.spec(gsub(" ", "_", spec)) # this works

heibl/megaptera documentation built on Jan. 17, 2021, 3:34 a.m.