我想创建一个具有三个不同增量的序列。例如从6到15增加0.7。跟随顺序应从上一个顺序的最后一个编号开始(在本例中为14.4)。 通过这种方式,我想根据直径类别(小6-14.99;中15-29.99;大> 30)对树的直径增量进行建模。
dbh <- c(seq(from = 6, to = 15, by = temp$DBH_growth[temp$dbh_class == "sma"]),
seq(from = 15, to = 30, by = temp$DBH_growth[temp$dbh_class == "med"]),
seq(from = 30, to = 300, by = temp$DBH_growth[temp$dbh_class == "big"]))
类似于此代码,但从序列的最后一个数字开始。
答案 0 :(得分:0)
类似这样的东西
sma <- seq(6, 15, .7)
med <- seq(max(sma), 30, 1)
lar <- seq(max(med), 300, 1.4)
dbh <- c(sma, med, lar)
假设.7,1,1.4
分别是小号,中号,大号或您的情况下的增量
sma <- seq(6, 15, temp$DBH_growth[temp$dbh_class == "sma"])
med <- seq(max(sma), 30, temp$DBH_growth[temp$dbh_class == "med"])
lar <- seq(max(med), 300, temp$DBH_growth[temp$dbh_class == "big"])
dbh <- c(sma, med, lar)