Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write blueprint to YAML #6

Open
matt-dray opened this issue Feb 15, 2024 · 0 comments
Open

Write blueprint to YAML #6

matt-dray opened this issue Feb 15, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@matt-dray
Copy link
Owner

Blueprints should be writable. They act as a record of the content that went into a given release, which is ideal for archival purposes. They could be saved as RDS and YAML.

Blueprints should be readable. A user should be able to edit a blueprint, probably programmticaly and perhaps even outside of an R session, and then read it into to R.

Saving a blueprint with e.g. yaml::write_yaml() means that data.frames are broken up into their constituent list elements (i.e. their columns). I think this is okay, we just need to make sure that this is recognised on read and that the data.frames are recombined. Consider this table from a user-built blueprint:

 $ Table_2 :List of 5
  ..$ sheet_type: chr "tables"
  ..$ title     : chr "The Title 2"
  ..$ subtitle  : chr "The subtitle 2"
  ..$ source    : chr "The source 2."
  ..$ tables    :'data.frame':	5 obs. of  5 variables:
  .. ..$ mpg : num [1:5] 18.1 14.3 24.4 22.8 19.2
  .. ..$ cyl : num [1:5] 6 8 4 4 6
  .. ..$ disp: num [1:5] 225 360 147 141 168
  .. ..$ hp  : num [1:5] 105 245 62 95 123
  .. ..$ drat: num [1:5] 2.76 3.21 3.69 3.92 3.92

Once we do yaml::write_yaml() on it and then yaml::read_yaml(), it comes in like:

 $ Table_2 :List of 5
  ..$ sheet_type: chr "tables"
  ..$ title     : chr "The Title 2"
  ..$ subtitle  : chr "The subtitle 2"
  ..$ source    : chr "The source 2."
  ..$ tables    :List of 5
  .. ..$ mpg : num [1:5] 18.1 14.3 24.4 22.8 19.2
  .. ..$ cyl : num [1:5] 6 8 4 4 6
  .. ..$ disp: num [1:5] 225 360 147 141 168
  .. ..$ hp  : num [1:5] 105 245 62 95 123
  .. ..$ drat: num [1:5] 2.76 3.21 3.69 3.92 3.92

Would just need to recognise that the elements under the tables element of sheets with sheet_type "tables" should be combined with data.frame() when ingested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant