1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/textUtils.R
\name{alphaOnly}
\alias{alphaOnly}
\title{Keep only alpha-numeric symbols}
\usage{
alphaOnly(x, also)
}
\arguments{
\item{x}{text string, or vector of strings (each of which is
processed separately)}
\item{also}{A named vector of other symbols that the user wants to
remove, along with replacements. For example, c(" " = "_",
"-" = "", "+" = "") to replace space with underscore and minus
and plus signs with nothing.}
}
\value{
cleaned text string
}
\description{
From a text string, keep ASCII letters, numbers, as well as "'",
" ", "_" "(", ")", "-", and "+". For maximum compatability with
the cross-platform file-naming standard. Obliterates all
characters that migth be mistaken for shell symbols, like "\^",
"\$", "\@" and so forth.
}
\details{
Removes trailing spaces.
This version allows internal spaces in the string, by default. The
also argument can be used to eliminate spaces or other hated symbols.
}
\examples{
x <- c("[]kansas(city) Missouri", "percent\%slash/",
"\\back{squiggle}_under(paren)", "*star-minus+plus")
alphaOnly(x)
alphaOnly(x, also = c(" " = "_", "+" = "_"))
alphaOnly(x, also = c("(" = "[", ")" = "]"))
}
\author{
Paul Johnson <pauljohn@ku.edu>
}
|