Learn R Programming

megaptera (version 1.0-0)

strip.infraspec: Truncation of Species Names

Description

Delete infraspecific names and epithets form species names.

Usage

strip.spec(x)
strip.infraspec(x, force.underscore = FALSE)

Arguments

x
a character string
force.underscore
logical, if TRUE, white space will be replaced by underscore

Value

a character string

Details

strip.spec and strip.infraspec try to guess the separating character used; both " " and "_" are possible.

Examples

Run this code

(name <- "Vipera aspis aspis")
(name2 <- strip.infraspec(name))
(name3 <- strip.spec(name2))

names.set <- c("Vipera aspis aspis",
               "Vipera_aspis_atra")       
sapply(names.set, strip.infraspec)
sapply(names.set, strip.infraspec, force.underscore = TRUE)

Run the code above in your browser using DataLab