Using read.csv.sql to select multiple values from a single column

后端 未结 2 1713
闹比i
闹比i 2020-12-18 14:43

I am using read.csv.sql from the package sqldf to try and read in a subset of rows, where the subset selects from multiple values - these values ar

2条回答
  •  無奈伤痛
    2020-12-18 15:22

    You could use deparse, but I'm not sure it's much cleaner than what you already have:

    read.csv.sql("mtcars.csv",
                 sql = paste("select * from file where carb in ", gsub("c","",deparse(cc)) ))
    

    And note that this is not really a general solution, because deparse will not always give you the right character string. It just happens to work in this instance.

提交回复
热议问题