AgroCares/Open-Bodem-Index-Calculator

obic_field_dt suggests it works for multipile fields but doesn't

BrentWHR opened this issue · 1 comments

The description of input parameter dt reads: dt (data.table) A data.table containing the data of the fields to calculate the OBI
However, when obic_field() is called, the ID parameter = 1.
Any ID passed to obic_field_dt() is not preserved.

To implement this functionality checks on ID may be needed in obic_field_dt()
additionally, a unit test for a dt with multipile fields (and ID's) is required

Alternatively, explicitly do not support multiplie fields and have users loop over their fields or something similair.

as a temp solution looping on user side can be done by

dt.obi <- lapply(unique(dt$ID), function(i) obic_field_dt(dt[ID==i])[,ID:=i]) |> rbindlist()