r - How to remove certain special character occurrences from some elements in a vector? -
i have vector filled numbers read .csv file, of numbers preceded * ,that is,
12 34 *89 *45 34
i want remove * these elements while retaining types, is
12 34 89 45 34
how do this?
try:
as.integer(stringi::stri_extract_all(x, regex = "[[:digit:]]+", simplify = true))
which gives:
#[1] 12 34 89 45 34
Comments
Post a Comment