【发布时间】:2017-01-29 15:19:58
【问题描述】:
我有一个这样的data.frame:
df = data.frame(str_col = c("when xyz = 'some_string' then 'this_string'",
"when xyz = 'some_string2' then 'this_string'"))
我想将 str_col 转换为不带双引号的逗号分隔向量,例如:
c(when xyz = 'some_string' then 'this_string', when xyz = 'some_string2' then 'this_string')
我正在尝试这个:
str_vec <- paste(shQuote(df$str_col), collapse=",")
但我明白了:
[1] "\"when xyz = 'some_string' then 'this_string'\",\"when xyz = 'some_string2' then 'this_string'\""
我不想要反斜杠或双引号。我正在尝试构建一个 SQL 查询。
【问题讨论】: