【发布时间】:2016-08-17 05:38:50
【问题描述】:
我有一个名为薪金的数据集,其中 yearID 作为一列。我想指定从 2010 年到 2014 年的年份范围。我怎么能在 r 中做到这一点? 这个我试过了
df <- Salaries(yearID=c(2010,2011,2012,2013,2014))
还有,
salar09-05<-Salaries(yearID=c(2010:2014))
和
sqldf("select * from salaries where yearID > 2009 and date < 2015")
其中任何一个都不起作用。
【问题讨论】:
-
你的意思是
data.frame(yearID=c(2010,..。就做subset(Salaries, yearID %in% 2010:2014) -
是的,但我已经在我的数据框是 Salaries 的第一个代码中使用了它
标签: r