【发布时间】:2020-12-13 17:32:51
【问题描述】:
下面是我的数据集:
df_gather %>%
filter(Country.Region %in% c("Italy")) %>%
arrange(desc(Date)) #%>%
# filter(Date %in% c(2020-12-12))
########### output #############
Country.Region Date Cases_Count
<chr> <date> <int>
Italy 2020-12-12 1825775
Italy 2020-12-11 1805873
Italy 2020-12-10 1787147
Italy 2020-12-09 1770149
Italy 2020-12-08 1757394
Italy 2020-12-07 1742557
Italy 2020-12-06 1728878
Italy 2020-12-05 1709991
Italy 2020-12-04 1688939
Italy 2020-12-03 1664829
问题:当我尝试使用以下代码filter 时,我得到0 rows 作为回报
df_gather %>%
filter(Country.Region %in% c("Italy")) %>%
arrange(desc(Date)) %>%
filter(Date %in% c(2020-12-12))
######## output #########
0 rows
也尝试在日期上加上引号,但即便如此我得到相同的结果
df_gather %>%
filter(Country.Region %in% c("Italy")) %>%
arrange(desc(Date)) %>%
filter(Date %in% c("2020-12-12"))
######## output #########
0 rows
这似乎但无法弄清楚。即使在过滤中也有不同的处理日期的方法吗?
【问题讨论】: