Skip to content

Commit

Permalink
doc: edit version vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasverus committed Feb 23, 2024
1 parent 38f9413 commit 9d33933
Showing 1 changed file with 45 additions and 3 deletions.
48 changes: 45 additions & 3 deletions vignettes/database-versions.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,50 @@ knitr::opts_chunk$set(
)
```

```{r setup}
library(forcis)
The [FORCIS database](https://zenodo.org/doi/10.5281/zenodo.7390791) is regularly updated. The global structure of the `csv` files doesn't change between versions but some bugs can be fixed and new records can also be added. This is why it is **recommended to use the latest version** of the database.


## Using the latest version

The package `forcis` is designed to handle the versioning of the database on Zenodo and will inform the user if a new version is available each time he/she uses one of the `read_*_data()` functions. The following message will be displayed:

```
A newer version of the FORCIS database is available. Use 'download_forcis_db(version = NULL)' to download it.
```

As mentioned in this message, the decision to download and use the latest version of the database is left to the user.

A **good practice** to ensure that the user works with the latest version of the database might be to add this line at the beginning of the script:

```{r 'use-latest-version'}
download_forcis_db(version = NULL, ...)
```

Note that the FORCIS database is saved in `forcis-db/version-99/`, where `99` is the label of the version. If you regularly download the new versions, the content of the folder `forcis-db/` can increase with time and it can be interesting to manually delete the folder of the previous versions.


## Using a specific version

If for some reasons the user wants to freeze the version he/she uses, it is possible to disable this message by setting the argument `check_for_update` to `FALSE` in the `read_*_data()` functions.

It is also possible to disable this message globally with the following line:

```{r 'disable-message'}
options(check_for_update = FALSE)
```

The package `forcis` "knows" which version of the database you used last time. A hidden file `.forcis` is created/updated each time the function `download_forcis_db()` or `read_*_data()` is called. This hidden file contains one line:

```
FORCIS_VERSION=99
```

Note that this hidden file is used by some functions of the `forcis` package. User doesn't have to edit it by hand.

If you want to be sure to use a specific version of the database, you can use the argument `version` of the `read_*_data()` functions, or use the following line:

```{r 'freeze-version'}
options(forcis_version = "99")
```

Work in progress...
But again, it is **recommended to use the latest version** of the database.

0 comments on commit 9d33933

Please sign in to comment.