【发布时间】:2014-12-03 05:15:39
【问题描述】:
第一次提问,如有遗漏,我深表歉意:
我将一个 excel 文件导入到 R 中!使用XLconnect,str()函数如下:
data.frame': 931 obs. of 5 variables:
$ Media : chr "EEM" "EEM" "EEM" "EEM" ...
$ Month : POSIXct, format: "2014-08-01" "2014-08-01" "2014-08-01" "2014-08-01" ...
$ Request_Row : num 8 25 26 37 38 44 53 62 69 83 ...
$ Total_Click : num 12 9 9 8 8 8 7 7 7 7 ...
$ Match_Type : chr "S" "S" "S" "S" ...
当我使用以下 sqldf 时,我没有选择任何行,无论如何可能是错误的:
sqldf(" select Media, sum(Total_Click) , avg(Request_Row), min(Request_Row) , max(Request_Row), count(distinct(Media)) from All_Data
where Request_Row < 100
and month='2014-09-01'
group by 1,2 order by 2,6 desc ")
<0 rows> (or 0-length row.names)
感谢您的帮助
Vj
【问题讨论】:
-
“2014-09-01”月份是否真的存在于excel文件中?
-
请注意
month != Month。 (R 区分大小写,您可能会考虑修复您的问题标题,因为它目前“只是丑陋”。) -
听到没有回应我会认为拼写是问题并投票关闭作为一个简单的错字。
-
谢谢各位!这样就解决了问题,strftime('%Y-%m-%d', month, 'unixepoch', 'localtime') ='2014-08-01'
-
这里的问题不仅仅是月/月。我的答案中概述的代码存在多个问题,因此我投票重新打开。