Check location data
Details
imuGAP() works on a hierarchical model of locations, so needs to be
told what that structure is. This method checks that the location structure
is valid, and returns a canonical version including the layer size.
id may not have an duplicates. If there is a row with id == 1, it must
have parent_id == NA. max(id) must equal the number of rows, give or
take the presence of the root id == 1 - put another way, id must be
seq_len(dim(locations)[1]) (again, give or take 1 for the root node).
After ordering, id and parent_id must be all(diff(id) == 1) and
all(diff(parent_id) %in% c(0, 1)).
Intended future capability: be able to extract a location structure that satisfies the requirements. In particular:
allow a root other than 1; would be defined by a
parent_id==NAaccept arbitrary column types for
id, including a non-covering set of integers, andparent_id; the return object will include an appropriate remapping to be applied to weighting dataaccept arbitrary layer depths
