【发布时间】:2019-01-21 08:36:34
【问题描述】:
我确实有相当复杂的案例需要我解决。让我通过一个例子来解释你..所以我们从下表开始:
Datum Urlaub_geplannt
1 2018-10 1410
2 2018-11 940
3 2018-12 470
structure(list(Datum = structure(1:3, .Label = c("2018-10", "2018-11",
"2018-12"), class = "factor"), Urlaub_geplannt = c(1410, 940,
470)), .Names = c("Datum", "Urlaub_geplannt"), row.names = c(NA,
-3L), class = "data.frame")
我希望在明年 1 月之前将新行添加到此表中(基准列),并且所有其他列都应填充为 0。在这种情况下,最终表应如下所示:
Datum Urlaub_geplannt
1 2018-10 1410
2 2018-11 940
3 2018-12 470
4 2019-01 0
但是,随着我的数据发生变化(实际上是在Shiny 中),以某种方式自动使其成为“年末”非常重要。
我的意思是,如果我有来自 2019 年的行的新数据,我希望自动获得“结束日期”为 2020 年 1 月。感谢您的帮助!
【问题讨论】:
-
每个月需要一行吗?
-
是的,直到明年 1 月,我确实每个月都需要一行
标签: r