View source: R/dsmartr_helpers.R
check_attributes | R Documentation |
Checks dsmartr input map attributes for potential data quality issues.
check_attributes(src_map = NULL, id_field = NULL, cs = NULL, ps = NULL)
src_map |
An sfc_POLYGON/MULTIPOLYGON or SpatialPolygonsDataFrame
object, see |
id_field |
String; name of unique feature identifier field. |
cs |
String; stub of attribute column names holding soil class data |
ps |
String; stub of attribute column names folding soil percentage data |
This function highlights some issues that may cause dsmartr to either fail or behave unpredictably. Usually these are side-effects of prepration work carried out in other software. Sometimes they are the result of errors in the source data. Note that only attributes are checked; geometry checking techniques are already available in sf and other spatial packages. At present, four problems are checked: whether data is missing (e.g. a polygon class without a matching percentage), whether any percentage values are 0%, whether total percentage (by polygon) is not 100%, and whether any IDs are duplicated.
An sf object with appended logical columns indicating presence of possible data faults.
## Not run:
load("heronvale_soilmap")
checked_map <- check_attributes(src_map = heronvale_soilmap,
id_field = 'POLY_NO',
cs = 'CLASS',
ps = 'PERC')
# to write to file without data loss (some formats
# can't store boolean), do this beforehand:
checked_map <- dplyr::mutate_if(checked_map, is.logical, as.character)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.