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

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -