使用RPostgreSQL包我必须在vector
中使用string
进行查询:
dbGetQuery(con, "select from id_table where id_user in tmp")
tmp
应该是列表或长度为10k的向量,我该怎么做?感谢。
答案 0 :(得分:0)
您可以使用paste0。以下是我使用state.abb数据集
的示例valid_state_logic=paste0("(",paste0("'",state.abb,"'", collapse=","),")")
print(valid_state_logic)
[1] "('DC','AL','AK','AZ','AR','CA','CO','CT','DE','FL','GA','HI','ID','IL','IN','IA','KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VT','VA','WA','WV','WI','WY')"
答案 1 :(得分:0)
试试这个:
success: function (data) {
self.Panel(data.PanelDetails[0].Panel);
self.Source(data.PanelDetails[0].Source);
},
希望这有帮助。