Closed CarlijnB closed 1 year ago
For No/No/Yes, for now I'm coding for these holdings to be filtered out. When replacing alternative tm matrix holding ids with numeric holding ids (approx. lines 102-107 in data2contactmatrix.R; required to match up with numeric ids from holding_data and movement_data), holding ids not included in the key are automatically turned into NAs. These are then omitted from alternative tm matrices.
If instead choosing to keep these holding ids in, need to add rows for these ids in holding_data before running holdingids2consecints.
Error message for accept_missing_coordinates:
Error: Assertion on 'holding_data["coordinates"]' failed: Contains empty geometries (missing coordinates; row 10). To proceed with missing coordinates, use 'accept_missing_coordinates = TRUE'. This wil set local spread transmission probabilities to/from holdings with missing coordinates to 0.
called as part of data2contactmatrix() argument checks if any missing coordinates in original holding_data
called from create_local_spread_matrix() if any missing coordinates in version of holding_data received by this function. E.g. in situation where there were no missing coordinates in original holding_data, but there were some holdings present in movement_data but not holding_data -> holdingids2consecints() had inserted rows with NA coordinates into holding_data. In such cases, the reference to e.g. "row 10" where the original holding_data is only 9 rows long is not helpful.
[x] Add warning to holdingids2consecints() / add_rows_to_holding_data() to indicate NA-rows have been added to holding_data (ideally with ORIGINAL holding identifier + row number)
+ changed reference from row to holding identifiers in the argument check call, and removed the reference in the create_local_spread_matrix call (because by then identifiers have been changed to numeric form, not easily identifiable).
Implemented a similar argument, error / warning solution for the additional matrices - Yes/No/No no longer filtered out.
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
Movement | Holding | Alternative tm | Action -- | -- | -- | -- Yes | Yes | | Included No | No | | Don't exist Yes | No | | Included if accept_missing_coordinates = TRUE (only movement-based tm), else ERROR No | Yes | | Included if incl_nonactive_holdings = TRUE (only distance-based local tm), else active holdings only | | | Yes | Yes | Yes | Included Yes | Yes | No | Included if accept_missing_alt_tm_prob = TRUE, else ERROR No | Yes | Yes | Included if incl_nonactive_holdings = TRUE (distance-based local tm & alternative tm), else active holdings only Yes | No | Yes | Included if accept_missing_coordinates = TRUE (movement-based & alternative tm), else ERROR Yes | No | No | Included if accept_missing_coordinates = TRUE && accept_missing_alt_tm_prob = TRUE No | Yes | No | Included if incl_nonactive_holdings = TRUE && accept_missing_alt_tm_prob = TRUE No | No | Yes | Included if incl_nonactive_holdings = TRUE && accept_missing_coords = TRUE No | No | No | Don't exist
data2contactmatrix: what to do with active holdings with no coordinates (or not included in alternative tm matrix)?
Holdings included in holding_data, but not in movement_data, are not a problem: they're simply inactive and movements can be set to 0. On the other hand, holdings included in movement_data, but with no coordinates in holding_data, have distance-based transmission probability = NA ... which means that overall transmission probabilities can't be calculated (or are known to NOT include distance-based transmission). What to do with these?
Similarly, when adding an additional transmission probability matrix - what to do with any holdings that are not included in this matrix and/or NA in the distance matrix?