taxlist (version 0.1.7)

clean_strings: Cleaning Character Strings

Description

Multiple, leading and trailing white spaces as well as wrong encodings may cause serious problems in information dealing with taxonomic names. The function 'clean_strings' get rid of them.

Usage

# S4 method for character
clean_strings(x, from="utf8", to="utf8")

# S4 method for factor clean_strings(x, from="utf8", to="utf8")

# S4 method for data.frame clean_strings(x, from="utf8", to="utf8")

Arguments

x

Object to be cleaned.

from,to

Arguments passed to iconv.

Value

The same as input 'x'.

Details

This function automatically deletes leading, trailing and multiple white spaces, either in strings (method 'character'), levels (method 'factor') or in single columns (method 'data.frame').

Examples

Run this code
# NOT RUN {
library(taxlist)
clean_strings(" Cyperus    papyrus L.     ")
# }

Run the code above in your browser using DataCamp Workspace