我的输入向量是
'salesman snow "rain check" "Radio shack"'
我正在寻找的答案是
"salesman" "snow" "rain check" "Radio shack"
尝试
strsplit(vector, " ")
答案 0 :(得分:0)
喜欢这个?
> gsub('"', '', regmatches(vector, gregexpr('"[^\\"]*"|(\\S+)', vector))[[1]])
[1] "salesman" "snow" "rain check" "Radio shack"