BLE-LTER / MetaEgress

R package to create Ecological Metadata Language documents from an instance of LTER-core-metabase database schema
https://BLE-LTER.github.io/MetaEgress/
6 stars 3 forks source link

handle check_attributes_congruence length mismatch error #81

Closed twhiteaker closed 7 months ago

twhiteaker commented 7 months ago

In the block below, we should see a message if the metadata doesn't match the data. However, if the number of unique values in data does not match the number of enumeration codes, we get an unhandled error instead.

      if (!all(unique(entity_df[[i]]) %in% c(cats, codes) | c(cats, codes) %in% unique(entity_df[[i]]))) {
        msg <- paste(
          "Enumeration in attribute",
          i,
          "in metadata not matching that in data for entity",
          entity_name
        )
        output_msgs <- c(output_msgs, msg)
      }

The error reads:

  longer object length is not a multiple of shorter object length

To handle the error, we should first check the lengths. Whether there's a length mismatch or some other mismatch, we should also at least report which attribute and table we were checking.

twhiteaker commented 7 months ago

fixed in 53041da25eb65f98e636ba5a4c514185e315d945