ropensci / EML

Ecological Metadata Language interface for R: synthesis and integration of heterogenous data
https://docs.ropensci.org/EML
Other
98 stars 33 forks source link

Suggestion for more informative warning during set_attribute unit check #274

Closed annakrystalli closed 5 years ago

annakrystalli commented 5 years ago

Hi!

Thanks for all the work on this very useful package!

I just wanted to make a small suggestion with regards to the warning message thrown during the set_attribute() unit checks, in particular, when the value is missing (NA). I appreciate that one reason a value being NA is because of omission. But I suspect another common reason, which was indeed my case, was that the variable is dimensionless. I assumed initially (admittedly without checking the function manual, that leaving it as NA was most appropriate but that correctly threw a warning:

#> Warning in set_attribute(attributes[i, ], factors = factors, missingValues
#> = missingValues): Unit 'NA' is not a recognized standard unit; treating
#> as custom unit. Please be sure you also define a custom unit in your EML
#> record, or replace with a recognized standard unit. See set_unitList() for
#> details.

After checking the manual, I only found that the field was required but no further guidance on the case where the variable has no units. Eventually I did find the dimensionless entry in the formal EML docs, but it took a little while.

So I did find my solution eventually, so it is fine to ignore this suggestion. But I think a message just mentioning dimensionless units, either in the docs or when the unrecognised unit is NA might both save folks some time + help educate!

cboettig commented 5 years ago

Thanks @annakrystalli , excellent suggestion. Would you like to make a quick PR against

https://github.com/ropensci/EML/blob/f4eba00d091109bda07080c3c333fbcc45f88abd/R/set_attributes.R#L132

to add a line to the effect that Unitless values should use "dimensionless" as the unit. or something like that?

annakrystalli commented 5 years ago

Sure! Will do tomorrow. 👍

Sent from my iPhone

On 17 May 2019, at 23:17, Carl Boettiger notifications@github.com wrote:

Thanks @annakrystalli , excellent suggestion. Would you like to make a quick PR against

https://github.com/ropensci/EML/blob/f4eba00d091109bda07080c3c333fbcc45f88abd/R/set_attributes.R#L132

to add a line to the effect that Unitless values should use "dimensionless" as the unit. or something like that?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.