【发布时间】:2017-12-13 08:10:14
【问题描述】:
我的数据集看起来像 that
您可以看到相同的 School-type 出现在同一个社区。 我想看看是否有办法最终得到一个包含变量的数据集:
-学校名称
-total_this year = 同一个社区总和 no_of_grads_this_year
-total_last_year = 同一个社区总和 no_of_grads_last_year
最终目标是创建这两个新列(total_this year、total_last_year)并将它们与学校名称相匹配。所以它看起来像this
我试过的:(说话的方式,这不是一个完整的尝试,因为它是错误的)
temp <- data%>%
select(school_name,neighborhood,no_grads_this_year,no_of_grads_last_year)%>%
filter(unique(id))%>%
mutate()
【问题讨论】:
标签: sql r dplyr aggregate aggregate-functions