This function calculates the average age of the grass

calc_grass_age(ID, B_LU_BRP)

Arguments

ID

(numeric) The ID of the field

B_LU_BRP

(numeric) The crop code (gewascode) from the BRP

Value

The age of the grassland within a crop rotation plan. A numeric value.

Details

The function assumes that the order of crop codes are descending, so the latest year is on top.

Examples

calc_grass_age(ID = rep(1,5), B_LU_BRP = c(1091,265,256,256,1091))
#> [1] 0 1 0 0 0
calc_grass_age(ID = rep(1,5), B_LU_BRP = c(265,265,265,265,1091))
#> [1] 4 3 2 1 0