DoThinning: Do thinning

Usage Arguments Examples

Usage

1
DoThinning(state, parms, fma, presc)

Arguments

state
parms
fma
presc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (state, parms, fma, presc) 
{
    N <- state[["N"]]
    Wl <- state[["Wl"]]
    Wsbr <- state[["Wsbr"]]
    Wr <- state[["Wr"]]
    op.s <- fma[1, ]
    pNr <- op.s$pNr
    if (is.na(pNr)) {
        pNr <- max((N - op.s$Nres)/N, 0)
    }
    state[["N"]] <- N * (1 - pNr)
    state[["Wl"]] <- Wl * (1 - pNr * op.s$thinWl)
    state[["Wsbr"]] <- Wsbr * (1 - pNr * op.s$thinWsbr)
    state[["Wr"]] <- Wr * (1 - pNr * op.s$thinWr)
    state[["Nharv"]] <- N * pNr
    if (pNr == 1) {
        state[["cycle"]] <- state[["cycle"]] + 1
        if (state[["cycle"]] <= max(presc$cycle)) {
            state[["rotation"]] <- unique(presc[presc$cycle == 
                state[["cycle"]], "rotation"])
        }
        state[["rm.sprouts"]] <- 0
        state[["t"]] <- 0
    }
    return(state)
  }

drGeorgeXenakis/fr3PGD documentation built on June 3, 2020, 6:10 a.m.