【发布时间】:2017-10-05 16:42:31
【问题描述】:
我有多个如下所示的数据框: 列中有许多物种,我不在这里报告。 d1:
Year Region Sites Depth Transect Pharia pyramidatus
2000 LP BALLENA 5 1 0.03
2000 LP ISLOTES 5 1 0.20
2000 LP NORTE 5 1 0.10
2000 LP NORTE 20 1 0.00
d2
Year Region Sites Depth Transect Pharia pyramidatus
2010 LP PLAYA 5 1 0.03
2010 LP ISLOTES 5 1 0.20
2010 LP NORTE 5 1 0.10
2010 LP NORTE 20 1 0.00
d3
Year Region Sites Depth Transect Pharia pyramidatus
2016 LP BALLENA 5 1 0.03
2016 LP ISLOTES 5 1 0.20
2016 LP SUR 5 1 0.10
2016 LP NORTE 20 1 0.00
我想做的是提取仅在 每一 年出现的相同站点 (Reef),并将结果 rbind 到一个应如下所示的数据框中:
Year Region Reef Depth Transect Pharia pyramidatus
2000 LP ISLOTES 5 1 0.20
2000 LP NORTE 5 1 0.10
2000 LP NORTE 20 1 0.00
2010 LP ISLOTES 5 1 0.20
2010 LP NORTE 5 1 0.10
2010 LP NORTE 20 1 0.00
2016 LP ISLOTES 5 1 0.20
2016 LP NORTE 20 1 0.00
非常感谢您的帮助
【问题讨论】:
-
“网站”是指
Reef? -
另外,
NORTE不存在于d3中,那么为什么要将它包含在最终的df中? -
查看更新数据的解决方案
标签: r dataframe subset extract