How to access TOFF using RStudio

How to access the TOFF database and download its content using RStudio

A) Download the R script and launch RStudio
The R script needed to access the database can be downloaded here. If you already installed RStudio you may now launch it and open the script.

B) Open the script via RStudio
In RStudio : Click on “File” in the top left corner of the software and then click “Open File” in the menu that appeared.

You should now see the script in a new window.

C) Login and password
The script is divided into several parts, clearly labeled in the code. In the part called “TOFF connection and setup” (part 1, line 27 and 28), you should see a field “user_name” and a field “pswd”. You may replace the placeholder between quotation with your login and your password, respectively in the “user_name” and “pswd” fields.

D) Running the script
To run the script, ensure that you have filled all the necessary fields (login, password) before doing so or the script will result in an error. Before running the script, you also need to ensure that your machine is connected to the internet.

In RStudio, from the RStudio Editor window, select all the script. Then, in the menu at the top called “code”, click on “Run Selected Line(s)”. A window will appear shortly asking you to specify where you want to save the files that will be downloaded.

E) Downloaded files

When the script is done, you will get six files at the location that you specified: “df_traits” in csv and xlsx, “df_metadata” in csv and xlsx and “df_merged_metadata_traits” in csv and xlsx. All functional traits recorded in TOFF (df_traits) are associated with information about measurements in an environmental context (df_metadata). The link between “df_traits” and “df_metadata” can be established through the “mea_id” or “met_id” columns or simply by looking at the merged file “df_merged_metadata_traits”. More information on the content of the database can be found in the “information” section of the website, or in the published paper (DOI: 10.1038/s41597-019-0307-z).