Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/grepNonStandardCharacters.R
Return the indices of elements of x
containing characters
that are not in standardCharacters
.
1 2 3 4 |
x |
character vector in which it is desired to identfy elements
containing characters not in |
value |
logical: |
standardCharacters |
Characters to overlook in |
... |
optional arguments for |
1. x. <- strsplit(x, ”): convert the input character vector to a
list of vectors of character vectors with nchar(x.[i])
== 1
for i in 1:length(x).
2. sapply(x., ...) to identify all elements for which any element of
x[[i]] is not in standardCharacters
.
an integer vector identifying all elements of x
containing a
character not in standardCharacters
.
Spencer Graves
stringi-package
grep
,
regexpr
,
subNonStandardCharacters
,
showNonASCII
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Names <- c('Raul', 'Ra`l', 'Torres,Raul', 'Torres, Raul')
# confusion in character sets can create
# names like Names[2]
chk <- grepNonStandardCharacters(Names)
all.equal(chk, 2)
chkv <- grepNonStandardCharacters(Names, TRUE)
all.equal(chkv, 'Ra`l')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.