Skip to content

Commit

Permalink
streamline terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
ThierryO committed Sep 6, 2024
1 parent 203354f commit a8d7dbb
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions vignettes/metadata.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,42 @@ vignette: >
`git2rdata` supports extra metadata since version 0.4.1.
Metadata is stored in a separate file with the same name as the data file, but with the extension `.yml`.
The metadata file is a YAML file with a specific structure.
The metadata file contains a generic section and a section for each variable in the data file.
The metadata file contains a generic section and a section for each field in the data file.
The generic section contains information about the data file as a whole.
The variable sections contain information about the variables in the data file.
The fields sections contain information about the fields in the data file.
The metadata file is stored in the same directory as the data file.

The generic section contains the following mandatory fields, automatically created by `git2rdata`:
The generic section contains the following mandatory properties, automatically created by `git2rdata`:

- `git2rdata`: the version of `git2rdata` used to create the metadata.
- `datahash`: the hash of the data file.
- `hash`: the hash of the metadata file.
- `optimize`: a logical indicating whether the data file is optimized for `git2rdata`.
- `sorting`: a character vector with the names of the variables in the data file.
- `split_by`: a character vector with the names of the variables used to split the data file.
- `sorting`: a character vector with the names of the fields in the data file.
- `split_by`: a character vector with the names of the fields used to split the data file.
- `NA string`: the string used to represent missing values in the data file.

The generic section can contain the following optional fields:
The generic section can contain the following optional properties:

- `table name`: the name of the dataset.
- `title`: the title of the dataset.
- `description`: a description of the dataset.

The variable sections contain the following mandatory fields, automatically created by `git2rdata`:
The fields sections contain the following mandatory properties, automatically created by `git2rdata`:

- `type`: the type of the variable.
- `class`: the class of the variable.
- `levels`: the levels of the variable (for factors).
- `index`: the index of the variable (for factors).
- `NA string`: the string used to represent missing values in the variable.
- `type`: the type of the field.
- `class`: the class of the field.
- `levels`: the levels of the field (for factors).
- `index`: the index of the field (for factors).
- `NA string`: the string used to represent missing values in the field.

The variable sections can contain the following optional fields:
The fields sections can contain the following optional properties:

- `description`: a description of the variable.
- `description`: a description of the field.

## Adding metadata

`write_vc()` only stores the mandatory fields in the metadata file.
`write_vc()` only stores the mandatory properties in the metadata file.

```{r store-metadata}
library(git2rdata)
Expand All @@ -77,8 +77,8 @@ display_metadata(my_iris)
## Updating the optional metadata

To add metadata to a `git2rdata` object, use the `update_metadata()` function.
This function allows you to add or update the metadata of a `git2rdata` object.
Setting an argument to `NA` or an empty string will remove the corresponding field from the metadata.
This function allows you to add or update the optional metadata of a `git2rdata` object.
Setting an argument to `NA` or an empty string will remove the corresponding property from the metadata.
The function only updates the metadata file, not the data file.
To see the changes, read the object again before using `display_metadata()`.

Expand Down

0 comments on commit a8d7dbb

Please sign in to comment.