case_names: Change case

Description Usage Arguments Value Examples

View source: R/case_names.R

Description

Change case

Usage

1
2
3
4
5
6
7
case_names(x, what = "onlyfirst")

## S3 method for class 'character'
case_names(x, what = "onlyfirst")

## S3 method for class 'splist'
case_names(x, what = "onlyfirst")

Arguments

x

Input species list, a character vector

what

(character) one of onlyfirst, trim, lower, upper

Value

Same as put in, either list, character vector or data.frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
x <- c("Salmo eperlanus Linnaeus, 1758", 'Oncorhynchus clarkii', 'Salmo',
'Oncorhynchus clarkii', 'Salvelinus fontinalis', 'Salvelinus confluentus')

# capitalize first letter only
case_names(x)

# all lower case
case_names(x, 'lower')

# all upper case
case_names(x, 'upper')

# trim white space
x <- c("Salmo eperlanus Linnaeus, 1758  ", 'Oncorhynchus clarkii', 'Salmo ',
'Oncorhynchus clarkii ', '   Salvelinus fontinalis ', 'Salvelinus confluentus  ')
case_names(x, 'trim')

sckott/splister documentation built on May 26, 2017, 3:49 a.m.