nameAlnum | R Documentation |
Utility functions, mostly for character manipulation.
pasteDate(..., sep = " ", collapse = NULL, sep.date = sep) paste0date(..., collapse = NULL) nameAlnum(x, capitalize=c("asis", "first", "none", "all", "mixed"), collapse=" ") normalizeNames(x, pattern = list(" "), replacement = list("_"), alnum = FALSE, ...)
x |
caharacter. |
... |
one or more R objects, to be converted to character vectors.
For |
sep |
a character string to separate the terms. |
collapse |
an optional character string to separate the results.
For |
sep.date |
a character string to separate the terms from the data itself. |
capitalize |
character, which letter of each words should be capitalized.
|
pattern |
a list of character vectors that are replaced.
Must match argument |
replacement |
a list of character vectors that are the replacements for |
alnum |
logical, if |
Character vector with desired changes.
Peter Solymos <solymos@ualberta.ca>
paste
, paste0
,
strsplit
, gsub
paste0(pasteDate("file", "name", sep="-", sep.date="_"), ".csv") paste0(paste0date("file", "name", sep.date="_"), ".csv") data(abmibirds) x <- data.frame(Name=levels(abmibirds[["Common.Name"]]), NameAlnum=nameAlnum(levels(abmibirds[["Common.Name"]])), stringsAsFactors = TRUE) x[grep("'", x$Name),] data.frame(out=sapply(c("asis", "first", "none", "all", "mixed"), function(z) nameAlnum("Olive-sided Flycatcher", z)), stringsAsFactors = TRUE) z <- data.frame(Name=levels(abmibirds[["Common.Name"]]), NameNormalized=normalizeNames(levels(abmibirds[["Common.Name"]]), pattern=list("'", "-", " "), replacement=list("", "_", "_")), stringsAsFactors = TRUE) z[grepl("'", z$Name) & grepl("-", z$Name),]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.