Keeps only rows whose spatial index (ids) appears in valid_ids and adds
a sid column (1..n_valid) giving each valid cell's rank among the valid
cells. sid matches the indexing of membership vectors returned by
genclust(). If valid_ids is NULL, all rows are kept and sid is
assigned by rank of ids.
Arguments
- df
A long-format data frame as returned by
data_all().- valid_ids
Integer vector of valid flat spatial positions, as returned in
genclust(...)$valid_ids. IfNULL, all spatial cells are treated as valid.