validate characters

I want to search in the variable perdl, special characters (it is a variable with names). But I don't understand how to look for them, it only looks for the points since I want all the special characters

example:
analysis <- descrip%>%
select (anali1, year2, perdl)%>%
filter (grepl ("\.", perdl))
if (nrow (analysis)> 0) {
saveExcel ('analysis', 'records with special characters', analysis)}

This grepl finds elements with characters other than letters and numbers. Will that work for you?

X <- c("ABDC", "R2F5", "R$GS", "R.s", "#@!", "ait")
grepl("[^a-zA-Z0-9]", X)
#> [1] FALSE FALSE  TRUE  TRUE  TRUE FALSE

Created on 2020-05-04 by the reprex package (v0.3.0)

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.