Skip to content

Commit

Permalink
review vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasverus committed Sep 19, 2024
1 parent 9ba6946 commit 6d5a1b2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
12 changes: 6 additions & 6 deletions vignettes/data-conversion.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ The FORCIS database includes counts of foraminifera species collected with multi

## Conversion functions

The functions detailed in this vignette allow to convert counts between the following formats **Raw abundance**, **Relative abundance** and **Number concentration**.
The functions detailed in this vignette allow users to convert counts between the following formats **Raw abundance**, **Relative abundance** and **Number concentration**.

> **NOTE:** FORCIS data from *Sediment traps* and the *CPR North* are not supported by
these functions.

First, let's import the required package.
First, let's attach the required package.

```{r setup}
library(forcis)
```

Before going any further, we will download the latest version of the FORCIS database.
Before proceeding, let's download the latest version of the FORCIS database.

```{r 'download-db', eval=FALSE}
# Create a data/ folder ----
Expand All @@ -54,7 +54,7 @@ dir.create("data")
download_forcis_db(path = "data", version = NULL)
```

The vignette will use the plankton nets data of the FORCIS database. Let's import the latest release of the data.
The vignette will use the plankton net data of the FORCIS database. Let's import the latest release of the data.

```{r 'load-data', echo=FALSE}
file_name <- system.file(file.path("extdata", "FORCIS_net_sample.csv"), package = "forcis")
Expand All @@ -66,7 +66,7 @@ net_data <- read.table(file_name, dec = ".", sep = ";")
net_data <- read_plankton_nets_data(path = "data")
```

**NB:** In this vignette, we use a subset of the plankton nets data, not the whole dataset.
**NB:** In this vignette, we use a subset of the plankton net data, not the whole dataset.


After importing the data, the initial step involves choosing the taxonomic level for the analyses, (the different taxonomic levels are described in this [data paper](https://www.nature.com/articles/s41597-023-02264-2)).
Expand All @@ -78,7 +78,7 @@ Let's use the function `select_taxonomy()` to select the **VT** taxonomy (valida
net_data <- select_taxonomy(net_data, taxonomy = "VT")
```

Once the data contains counts from the same taxonomic level, we can proceed with the conversion functions: `compute_*()`.
Once the data contain counts from the same taxonomic level, we can proceed with the conversion functions: `compute_*()`.

The functions accept two arguments: the input `data` and the `aggregate` arguments. If `aggregate = TRUE`, the function will return the transformed counts of each species using the sample as the unit. If `aggregate = FALSE`, it will re-calculate the species' abundance by subsample.

Expand Down
8 changes: 4 additions & 4 deletions vignettes/data-visualization.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ knitr::opts_chunk$set(
)
```

The package `forcis` provides [a lot of functions](https://frbcesab.github.io/forcis/reference/index.html#visualization-tools) to visualize FORCIS data. This vignette shows how to use and customize these functions.
The package `forcis` provides [numerous functions](https://frbcesab.github.io/forcis/reference/index.html#visualization-tools) to visualize FORCIS data. This vignette shows how to use and customize these functions.


## Setup
Expand All @@ -33,7 +33,7 @@ library(forcis)
library(ggplot2)
```

Before going any further, we will download the latest version of the FORCIS database.
Before proceeding, let's download the latest version of the FORCIS database.

```{r 'download-db', eval=FALSE}
# Create a data/ folder ----
Expand All @@ -43,7 +43,7 @@ dir.create("data")
download_forcis_db(path = "data", version = NULL)
```

The vignette will use the plankton nets data of the FORCIS database. Let's import the latest release of the data.
The vignette will use the plankton net data of the FORCIS database. Let's import the latest release of the data.

```{r 'load-data', echo=FALSE}
file_name <- system.file(file.path("extdata", "FORCIS_net_sample.csv"), package = "forcis")
Expand All @@ -55,7 +55,7 @@ net_data <- read.table(file_name, dec = ".", sep = ";")
net_data <- read_plankton_nets_data(path = "data")
```

**NB:** In this vignette, we use a subset of the plankton nets data, not the whole dataset.
**NB:** In this vignette, we use a subset of the plankton net data, not the whole dataset.


## `geom_basemap()`
Expand Down
12 changes: 6 additions & 6 deletions vignettes/database-versions.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,40 @@ The [FORCIS database](https://zenodo.org/doi/10.5281/zenodo.7390791) is regularl

## 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:
The package `forcis` is designed to handle the versioning of the database on Zenodo and will inform users if a new version is available each time they use 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.
As mentioned in this message, users can choose whether to download the latest version of the database.

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.
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/` may grow over 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.
If for some reason users want to freeze the version they use, 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 for the current session:

```{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:
The package `forcis` _"knows"_ which version of the database you used last time. A hidden file named `.forcis` is created (or 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.
Note that this hidden file is used by some functions of the `forcis` package. Users don't need to edit it manually.

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:

Expand Down
10 changes: 5 additions & 5 deletions vignettes/select-and-filter-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ First, let's import the required packages.
library(forcis)
```

Before going any further, we will download the latest version of the FORCIS database.
Before proceeding, let's download the latest version of the FORCIS database.

```{r 'download-db', eval=FALSE}
# Create a data/ folder ----
Expand Down Expand Up @@ -71,7 +71,7 @@ net_data <- select_taxonomy(net_data, taxonomy = "VT")

## `select_columns()`

Because FORCIS data contains more than 100 columns, the function `select_columns()` can be used to lighten the `data.frame` to easily handle it and to speed up some computations.
Because FORCIS data contain more than 100 columns, the function `select_columns()` can be used to lighten the `data.frame` to easily handle it and to speed up some computations.

By default, only required columns listed in `get_required_columns()` and species columns will be kept.

Expand Down Expand Up @@ -134,7 +134,7 @@ nrow(net_data)
nrow(net_data_bbox)
```

Note that the argument `bbox` can be an object of class `bbox` (package `sf`) or a vector of four numeric values defining a square bounding box. If a vector of numeric values is provided, coordinates must be defined in the system WGS 84 (`epsg=4326`).
Note that the argument `bbox` can be either an object of class `bbox` (package `sf`) or a vector of four numeric values defining a square bounding box. If a vector of numeric values is provided, coordinates must be defined in the system WGS 84 (`epsg=4326`).



Expand Down Expand Up @@ -189,7 +189,7 @@ nrow(net_data_poly)

## `filter_by_species()`

The function `filter_by_species()` allows to filter FORCIS data for one or more species.
The `filter_by_species()` function allows users to filter FORCIS data for one or more species.

It takes a `data.frame` and a vector of species names (argument `species`).

Expand All @@ -211,7 +211,7 @@ dim(glutinata_nitida)

## `reshape_data()`

The function `reshape_data()` converts FORCIS data into a long format.
The `reshape_data()` function converts FORCIS data into a long format.

```{r 'reshape-data'}
# Convert to long format ----
Expand Down

0 comments on commit 6d5a1b2

Please sign in to comment.