Subtract a string in R -


i have string this:

phrase <- "this_is.//the_first?the_second" 

and result want subtract string based on ? , take result this

>phrase_new[1]  "this_is.//the_first?" >phrase_new[2]   "the_second" 

i try not working. please there idea this?

phrase_new <- sub("[:?:]", "", phrase) 

if want split character, better use strsplit:

> strsplit(phrase, "?", fixed = true) [[1]] [1] "this_is.//the_first" "the_second" 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -