Conditional line break in space

My input vector

'salesman snow "rain check" "Radio shack"' 

The answer I'm looking for

 "salesman" "snow" "rain check" "Radio shack" 

tried to

  strsplit(vector, " ") 
+6
source share
1 answer

Like this?

 > gsub('"', '', regmatches(vector, gregexpr('"[^\\"]*"|(\\S+)', vector))[[1]]) [1] "salesman" "snow" "rain check" "Radio shack" 
0
source

Source: https://habr.com/ru/post/973283/


All Articles