在 R 中打包 sqldf

package sqldf in R

是否可以在sqldf中的字符串中添加注释?

类似于:

sqldf('select ProductID,   
      count(distinct SalePrice) as num_regPz  
      from MYDF  
      where SalesFlag=0   # coded value to identify regular prizes  
      group by ProductID')

此处“# coded value to identify regular prizes”是作为注释,而不是 select 声明的一部分。

SQL 中的评论使用此格式:

/* 此处为评论 */

如果您将代码更改为以下内容,那么它应该可以工作

sqldf('select ProductID,   
      count(distinct SalePrice) as num_regPz  
      from MYDF  
      where SalesFlag=0   /* coded value to identify regular prizes  */
      group by ProductID')