I have a vector filled with some numbers that I read from a .csv file, but some of those numbers are preceded by a * ,that is,
12 34 *89 *45 34
I want to remove the * from these elements while retaining their types, that is
12 34 89 45 34
How do I do this?
Try:
as.integer(stringi::stri_extract_all(x, regex = "[[:digit:]]+", simplify = TRUE))
Which gives:
#[1] 12 34 89 45 34
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.