Skip to content
This repository was archived by the owner on Mar 14, 2019. It is now read-only.

Commit 269a71d

Browse files
author
Timothée Poisot
committed
How to upload a taxa
Issue #11 is still in progress, I have added a paragraph about how to add a taxa, along with some general considerations on overwriting user-created objects and data representation.
1 parent 60067f2 commit 269a71d

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed

vignettes/rmangal_upload.Rmd

+35-4
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,44 @@ and `get` commands.
3535
# Upload walkthrough
3636

3737
As explained in the vignette on the basics, querying information is best done
38-
from the top (`dataset` objects) to the bottom. The upload process follows the
39-
*inverse* progression: first create taxa, then interactions, then networks,
40-
then wrap them up in a dataset. It is important that you familiarize yourself
41-
with the complete data specification *before* uploading your data.
38+
from the top (`dataset` objects) to the bottom (`taxa`). The upload process
39+
follows the *inverse* progression: first create taxa, then interactions, then
40+
networks, then wrap them up in a dataset. It is important that you familiarize
41+
yourself with the complete data specification *before* uploading your data.
4242

4343
## Creating taxa and related objects
4444

45+
**All** `mangal` objects are essentially `R` `lists`, with names corresponding
46+
to the fields. For example, we can define a `taxa` as
47+
48+
```{r dummy_taxa}
49+
dipl_vu <- list(
50+
name = 'Diplodus vulgaris',
51+
vernacular = 'Common two-banded seabream',
52+
status = 'confirmed',
53+
gbif = 5210979
54+
)
55+
```
56+
57+
Keep in mind that the database *will* check that there are no duplicates of
58+
the object you try to register. You can either check before uploading data
59+
(it's possible to `patch` objects if you have additional informations),
60+
which is a *Good Thing*, or hope that nothing breaks and address duplicates
61+
if they arise (which, obviously, is a *Bad Thing*).
62+
63+
Now this object can be uploaded in the database in the following way:
64+
65+
```{r upload_dummy_taxa, eval = FALSE}
66+
dipl_vu <- addTaxa(api, dipl_vu)
67+
```
68+
69+
By default, the functions to `add` *any* object will return a `list` with the
70+
object queried from the database. This is essentially your object with the
71+
field values you supplied **and** the `id`. For this reason, it is acceptable
72+
(we actually recommend it) that you *overwrite* the original object with the
73+
version actually in the database. Without going into details, it will speed
74+
things up internally, and make the whole upload process more error-proof.
75+
4576
## Creating datasets and related objects
4677

4778
## Releasing the dataset

0 commit comments

Comments
 (0)