2
我有这样一个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查询。
我的预期输出我想了一个小错误。 。时间之间不应该有逗号,但我通过在答案中调整了崩溃参数来修复它。谢谢 ! – vagabond