Skip to contents

Split vector of names into two-column data frame

Usage

SplitNames(x, delim = " - ")

Arguments

x

Vector of species names, in the format "Common Name - Scientific name".

delim

Character separator that delimits common from scientific names.

Value

A data.frame of two columns, Common and Scientific.

Details

Names from eBird are returned in a single column as: "Snow Goose - Anser caerulescens". This function provides a means of separating the common name ("Snow Goose") from the scientific name ("Anser caerulescens") into two separate columns.

Examples

# Read in data downloaded from eBird
user_file <- system.file("extdata", "example-list.csv", package = "lifeR")
user_list <- read.csv(file = user_file)
# Retrieve a two-column data frame with common names and scientific names
species_seen <- SplitNames(x = user_list$Species)
# If only common names are required, refer to \code{Common} column
species_seen <- SplitNames(x = user_list$Species)$Common