A wrapper for ff_calc_inv_mass that runs the calculation for a series of elapsed days from 1 to ndays. Returns a data frame with total invertebrate mass (kg) by field unique_id and day.

ff_calc_inv_mass_ts(df, ndays)

Arguments

df

An sf dataset, such as the provided dataframe ff_fields, which includes an attribute area_ac containing the field area in acres. Also works with an ordinary data.frame or tibble.

ndays

The total number of days over which to conduct the mass calculation. A sequence of days from 1 to ndays is fed into the day parameter of the ff_calc_inv_mass function.

Examples

# calculate the invertebrate mass time series
ff_fields |> ff_calc_inv_mass_ts(14)
#> # A tibble: 134,792 × 3
#>      day unique_id total_prod_kg
#>    <int> <chr>             <dbl>
#>  1     1 1103539          17.6  
#>  2     1 1102849          17.7  
#>  3     1 1103353           0.794
#>  4     1 1103425           1.01 
#>  5     1 1103546          36.8  
#>  6     1 1103560          11.3  
#>  7     1 1103561          26.1  
#>  8     1 1103563          18.7  
#>  9     1 1103564          56.2  
#> 10     1 1103566          42.2  
#> # ℹ 134,782 more rows

# calculate the invertebrate mass time series for a particular field
ff_fields |> dplyr::filter(unique_id=="1103539") |> ff_calc_inv_mass_ts(14)
#> # A tibble: 14 × 3
#>      day unique_id total_prod_kg
#>    <int> <chr>             <dbl>
#>  1     1 1103539            17.6
#>  2     2 1103539            35.3
#>  3     3 1103539            52.9
#>  4     4 1103539            70.5
#>  5     5 1103539            88.2
#>  6     6 1103539           106. 
#>  7     7 1103539           123. 
#>  8     8 1103539           141. 
#>  9     9 1103539           159. 
#> 10    10 1103539           176. 
#> 11    11 1103539           194. 
#> 12    12 1103539           212. 
#> 13    13 1103539           229. 
#> 14    14 1103539           247.