Validates a mudata object by calling rlang::abort when an error is found; creates a mudata object from a list. Validation is generally performed when objects are created using mudata, or when objects are read/writen using read_mudata and write_mudata.

new_mudata(md, x_columns)

validate_mudata(
  md,
  check_unique = TRUE,
  check_references = TRUE,
  action = abort
)

Arguments

md

An object of class 'mudata'

x_columns

The x_columns attribute (see mudata).

check_unique

Check if columns identify unique values in the appropriate tables

check_references

Check the referential integrity of the mudata object

action

The function to be called when errors are detected in validate_mudata

Examples

validate_mudata(kentvillegreenwood) new_mudata(kentvillegreenwood, x_columns = "date")
#> A mudata object aligned along "date" #> distinct_datasets(): "ecclimate" #> distinct_locations(): "GREENWOOD A", "KENTVILLE CDA CS" #> distinct_params(): "cooldegdays", "dirofmaxgust" ... and 9 more #> src_tbls(): "data", "locations" ... and 3 more #> #> tbl_data() %>% head(): #> # A tibble: 6 x 6 #> dataset location param date value flags #> <chr> <chr> <chr> <date> <dbl> <chr> #> 1 ecclimate KENTVILLE CDA CS maxtemp 1999-07-01 28.5 <NA> #> 2 ecclimate KENTVILLE CDA CS maxtemp 1999-07-02 30.7 <NA> #> 3 ecclimate KENTVILLE CDA CS maxtemp 1999-07-03 26.4 <NA> #> 4 ecclimate KENTVILLE CDA CS maxtemp 1999-07-04 28.6 <NA> #> 5 ecclimate KENTVILLE CDA CS maxtemp 1999-07-05 26 <NA> #> 6 ecclimate KENTVILLE CDA CS maxtemp 1999-07-06 25.3 <NA>