Subsetting data.table set by date range in R

杀马特。学长 韩版系。学妹 提交于 2019-11-27 19:21:50

Why not:

testset[date>="2013-08-02" & date<="2013-11-01"]
Daniel Krizian

See also:

?`%between%`

Works like this:

testset[date %between% c("2013-08-02", "2013-11-01")]

You mentioned that you are subsetting, but its not clear whether you are using the subset fn in R.

Type ?subset into the R console to see the details of the subset() function in R which 'returns a subset of vectors, matrices or data frames which meet conditions'. Then use part of the method that Troy posted above to choose the date range

thisYear <- subset(testset, date > "2015-01-01" & date < "2015-12-31")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!