r - Using gsub instead of strsplit or scan -


are there other possibilities split string instead of?

unlist(strsplit("1.2.3", "[.]")) scan(text="1.2.3", what="", sep=".") 

out of r's pattern matching functions base package (see ?gsub), gregexpr right 1 use here. identify start , end positions of chunks of characters not ., can reconstruct them using regmatches:

x <- "1.2.3.4as.zz2.zzxd3"  regmatches(x, gregexpr("[^.]+", x))[[1]] # [1] "1"     "2"     "3"     "4as"   "zz2"   "zzxd3" 

but really, don't see gain on using strsplit. if tell not it, maybe of more help.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -