frictionlessdata / datapackage-r

An R package for working with Data Package.
https://frictionlessdata.github.io/datapackage-r/
Other
43 stars 7 forks source link

Error when reading datapackage.json with external schema #25

Open peterdesmet opened 3 years ago

peterdesmet commented 3 years ago

Overview

I'm trying to read a data package where the tabular-data-resource schema is defined in an external data file, but I am getting an Error: $ operator is invalid for atomic vectors. The datapackage.json is valid when I check with other validators.

Reproducible example:

  1. Create local directory periodic_table with a data package containing the periodic table (copied from https://github.com/frictionlessdata/examples/tree/master/periodic-table)
  2. Read and validate package:
package <- Package.load(read_json("periodic_table/datapackage.json"))
package$valid
[1] TRUE
  1. So far so good. Change the datapackage.json so that the schema is an external json file:
{
  "name": "period-table",
  "title": "Periodic Table",
  "profile": "tabular-data-package",
  "licenses": [{
    "id": "CC0-1.0",
    "title": "CC0 1.0",
    "url": "https://creativecommons.org/publicdomain/zero/1.0/"
  }],
  "resources": [{
    "path": "data.csv",
    "name": "data",
    "profile": "tabular-data-resource",
    "format": "csv",
    "mediatype": "text/csv",
    "encoding": "UTF-8",
    "schema": "https://gist.githubusercontent.com/peterdesmet/10725a8f66fc821456abd5b52692d0f6/raw/7b21d5335aeb4a8603f60a1342d02b0bf5a5e95d/schema.json"
  }]
}
  1. Read again:
package <- Package.load(read_json("periodic_table/datapackage.json"))
Error: $ operator is invalid for atomic vectors

Any idea what might be causing this?


Please preserve this line to notify @kleanthisk10 (lead of this repository)