R-SQL查询与R-Base函数和子句HAVING

时间:2017-04-04 19:44:14

标签: sql r count where having

我正在使用库nycflights13。如何输出以下查询的结果:

SELECT engine, COUNT(*) FROM planes WHERE seats > 300 GROUP BY engine HAVING COUNT(*) > 20

但是WITHOUT外部图书馆? (我知道如何使用dplyrsqldf)。只有R-Base功能?

1 个答案:

答案 0 :(得分:0)

z <- as.data.frame(table(planes$engine[planes$seats > 300]))

z[z$Freq > 20,]

#       Var1 Freq
#1 Turbo-fan  190