Open ElsLommelen opened 2 months ago
Thanks for reporting. We have a helper function clean_list()
that allows to sanitize NULL
, list()
etc. We could run it on resource or datapackage before writing, but I'm afraid it might have unintended side effects.
It's probably better to extend this line:
With the properties null = "null"
and na = "null"
, so values are always exported the same way (as NULL, which is the default for lists).
Using na = "string"
would cause all NA values to be exported as "NA" (and thus different than NULL
values). This is probably not desirable, since reading the package would not interpret those automatically as NA. At least NULL
has an inherent meaning in lists.
With the properties
null = "null"
andna = "null"
, so values are always exported the same way (as NULL, which is the default for lists).
This indeed seems a good solution: now it is null = "list"
and na = "null"
, I suppose, and replacing the first by null = "null"
would give the same behaviour after writing for NULL and NA
When adding a metadata item without content (e.g. because all other tables or columns have content for this metadata item), writing and reading the package alters this content:
NA
becomesNULL
, andNULL
becomesNamed list()
, and also the writtendatapackage.json
is different. I don't mind the distinction between NA or NULL, so I don't mind if they would be saved and reloaded as the same value (or not at all), but I find annoying that the written file changes when first giving the metadata value NA (which is kind of a default given by functions in R if no data are available).The reprex demonstrates the issue for metadata on the table level, but metadata on the column level behave similar.
Created on 2024-04-16 with reprex v2.0.2