dataesr/scientific-paragraphs-categorization huggingface dataset:
e. plants, beetles, chironomids, rodents, foraminifera, and dinoflagellate cysts) associated with an extensive range of climate variables (20 terrestrial and 19 marine variables) that enables its use in most terrestrial and marine environments. Private data collections can also be used instead of, or in combination with, the provided calibration dataset. The package includes a suite of graphical diagnostic tools to represent the data at each step of the reconstruction process and provide insights into the effect of the different modelling assumptions and external factors that underlie a reconstruction. With this R package, the CREST method can now be used in a scriptable environment and thus be more easily integrated with existing workflows. It is hoped that crestr will be used to produce the much-needed quantified climate reconstructions from the many regions where they are currently lacking, despite the availability of suitable fossil records.
Introduction Fossil-based climate reconstruction techniques are commonly used to quantify past climates and shed light on the nature of the drivers of climate change across space and time. Over the years, numerous techniques of increasing complexity have been proposed, each one based on a unique set of assumptions regarding the modelling of (palaeo)ecological datasets and their translation into climate reconstructions (e. g. Birks et al. , 2010; Chevalier et al. , 2020b). In particular, many techniques focus on modelling the relationships between proxy assemblages and climate from collections of modern proxy samples. Of these techniques, weighted averaging  (WA, ter Braak and van Dame, 1989) , weightedaveraging partial least square (WA-PLS, ter Braak and  Juggins, 1993) , and the modern analogue technique (MAT,  Hutson, 1978; Overpeck et al.
, 1985)  have been the most widely employed because of their conceptual simplicity, their demonstrated capacity to reconstruct climate from various palaeoecological proxies (e. g. fossil pollen, chironomids, foraminifera) and their accessibility via multiple software tools. However, the limited availability of the necessary calibration datasets beyond the Northern Hemisphere extratropics has often hindered their application in many environments and regions where quantified climate reconstructions are needed, despite the existence of suitable fossil records  (Chevalier et al. , 2020b). Published by Copernicus Publications on behalf of the European Geosciences Union. Conceptual illustration of the differences between a modelling approach based on the full spread of the data with the probabilities spread along the climate gradient (e.
, 2017). Since the assumptions of CREST do not restrict its use to southern African pollen records, CREST was also integrated into a point-and-click graphical user interface to enable its use by the broader community  (Chevalier et al. , 2014). However, the complexity of collating and formatting the thousands of distinct occurrences required to estimate reliable proxy-climate relationships limited its practical use. To overcome this limitation, a global, multi-proxy calibration dataset containing millions of modern occurrence data for plants, beetles, chironomids, foraminifera, and diatoms was subsequently released  (Chevalier, 2019) , and this curated dataset contributed to creating quantified climate reconstructions beyond southern Africa (e. g. Yi et al. , 2020; Hui et al. , 2021; Gibson et al.
, 2022). However, maintaining the compatibility of the graphical interface across a range of constantly evolving operating platforms has been challenging. This paper thus introduces a new multi-platform R package crestr designed to replace the original interface. crestr integrates the global calibration dataset and provides simple solutions to tailor it to the users' specific needs. The package also proposes an array of graphical diagnostic tools to represent the calibration and reconstruction data at different pivotal steps of the reconstruction process and thus facilitate data and result interpretations. In addition, the advantage of using CREST is not limited to its capacity to produce quantified reconstructions in understudied regions. CREST is equipped with some fundamental statistical features that make it well-adapted to analysing extensive collections of palaeoecological records from any region  (Chevalier et al.
1 ). In practice, joint solutions based on all the available information often differ from best climate estimates. Using methods such as CREST that can estimate the full range of climate uncertainties associated with a proxy sample is thus critical to bring reconstructions and even climate simulations together in a cohesive way. This article introduces the crestr R package and provides good-practice recommendations to produce high-quality climate reconstructions. The article is structured as follows: Sect. 2 summarises the most important mathematics and assumptions underlying the approach. Understanding all the details of this section is not necessary to use the package. Then, Sect. 3 describes the embedded calibration dataset, how it was built and how the data are structured. Section 4 explains the philosophy and main elements of the package and describes the format of the different input files required.
Nature of the required data Three types of data are required to reconstruct climate parameters with the CREST method: a fossil proxy record with several taxa being corecorded and expressed as counts, percentages or binary presence/absence; modern presence-only occurrence data of species corresponding to the taxa observed in the fossil record (i. e. collections of geographical coordinates where the species are observed across a user-defined study area; see Fig. 2b  and Sect. 3 for an example of a curated dataset); climatology(ies) of the variable(s) to reconstruct gridded at the same resolution as the modern occurrences (Fig. 2a ). All the climate values observed in the study area define the climate space.
CREST calibration dataset A multiproxy calibration dataset to estimate PDFs from a global collection of presence-only occurrence data (hereafter proxy "distributions") was introduced in Chevalier (2019). These data were obtained from the Global Biodiversity Information Facility (GBIF) database, an online collection of geolocalised observations of biological entities  (GBIF, 2018). The calibration dataset (hereafter gbif4crest, Chevalier, 2020) contains the species distributions of six common palaeoecological fossils: the five taxa presented in the original version of the dataset -plants  (GBIF, 2020l, h, k, f, g, m, i, n, j, 2021a  for fossil pollen and macrofossils, chironomids (GBIF, 2020b), beetles (GBIF, 2020a), diatoms (GBIF, 2020c) and foraminifera (GBIF, 2020d) -to which rodents (GBIF, 2020e) were recently added (Fig.
3 ). These data were curated and stored in a relational database to ensure the consistency of the data. The coordinates of all the presence records of these six common palaeoecological fossil proxies were mapped onto a grid with a spatial resolution of 0. 25 • × 0. 25 • (hereafter QDGC for quarter-degree grid cell). The QDGC spatial resolution is an empirical trade-off between numerous factors, including the resolution of the presence data, the quality of the data or the spatial representativity of the studied proxy (see discussions in  Chevalier et al. , 2014, and Chevalier, 2019). However, this trade-off may be suboptimal in some situations. For that reason, crestr can also be used with the raw GBIF data (stored in the DISTRIB table, Fig. 4 ) and even independent calibration datasets. In the gbif4crest database, all the QDGC grid cells were associated with a collection of terrestrial and oceanic environmental variables that can be reconstructed  (Fick and Hijmans, 2017; Zomer et al.
, 2008; Locarnini et al. , 2019; Zweng et al. , 2018; Garcia et al. , 2019a, b; Reynolds et al. , 2007 , see details in Tables  1  and 2 ). Despite the diversity of variables available, it is recommended to avoid serial reconstructions and, on the contrary, to identify the few important variables for the studied palaeoecological datasets a priori. The grid cells were also associated with "nonreconstructible" environmental and geographical descriptors that serve to tailor the calibration dataset to the users' needs. These include the coordinates, the elevation and elevation https://doi. org/10. 5194/cp-18-821-2022 Clim. Past, 18, 821-844, 2022 variability within the grid cell  (Amante and Eakins, 2009) , the country (https://www. naturalearthdata. com, last access: September 2021) or ocean (https://www.
marineregions. org, last access: September 2021) names, as well as different levels of ecological classification for the terrestrial  (Olson et al. , 2001)  and marine  (Costello et al. , 2017)  realms. In its current version (V2), the gbif4crest calibration dataset contains about 25. 3 million unique QDGC occurrence data for the six climate proxies. Unfortunately, the density of data available varies between proxies and regions (Fig. 3 ). Plant data largely dominate the calibration dataset (> 22 million unique occurrences) and allow for the use of crestr across all landmasses. For the five other proxies, the calibration data are not as extensive. However, these datasets are regularly updated by GBIF. For example, the first version of the gbif4crest dataset released in 2018 contained about 17.
5 million QDGC entries (∼ 44 % increase). The range of "reconstructible" areas is thus rapidly broadening (see, for instance, the coverage of Russia by plant data compared to the first version of the gbif4crest dataset presented in  Chevalier, 2019). This database will be regularly updated, and specific requests can also be made. The gbif4crest database is composed of three main types of data: taxonomic data (TAXA table in Fig. 4 ), distribution data (DISTRIB (raw data) and DISTRIB_QDGC (curated data) tables) and diverse geopolitical, climatological, and environmental data (DATA_QDGC table). Its structure is slightly different from the first version presented in Chevalier (  2019 ), with a grouping of all the separate QDGC tables in a unique DATA_QDGC table to enable faster data extraction.
The DISTRIB_QDGC tables link the TAXA and DATA_QDGC tables using the unique identifiers taxonID and locID, respectively. Each occurrence's first and last observation dates are also now included, along with the type of observation reported by GBIF (see https://rs. gbif. org/vocabulary/ dwc/basis_of_record. xml, last access: September 2021) and the number of observations n_occ reported between the first and the last observation dates. The DATA_QDGC table was also entirely recalculated using a new protocol that better accounts for coastal margins, implying that some coastal cli-mate values may differ, however marginally, between the different versions of the gbif4crest dataset. Due to its large size (about 15 Gb), this database is not downloaded when installing the package but can be accessed through different routes.
First, the data are stored in an openaccess, cloud-based PostgreSQL database that can be accessed via crestr. This solution is the recommended option, as users without any SQL knowledge can benefit from the package's interface to automatically query the database simply by providing study-specific parameters (e. g. the name of the taxa or geographical boundaries for the study area) to import all the necessary data in the correct format to the R environment (see Sect. 5. 2). Second, more advanced users can also directly query the database to extract and curate data from the DISTRIB or DISTRIB_QDGC tables using SQL requests and the dbRequest() function. Finally, the full gbif4crest calibration dataset can also be downloaded as an SQLite3 portable database file from Chevalier (2020).
Philosophy of the package The crestr package has been designed for two independent but complementary modelling purposes. The probabilistic proxy-climate responses can be used to quantitatively reconstruct climate from their statistical combination, such as in  Chevalier et al. (2021a)  or  Chevalier and Chase (2015) , or they can be used in a more qualitative way to determine the (relative) climate sensitivities of different taxa in a given area to characterise past ecological changes, such as in  Chevalier et al. (2021b)  or  Quick et al. (2021). To simplify access to the functionalities, default values are provided for all parameters to enable a rapid generation of preliminary results that users can then use as a starting point to adapt the model to their data. Different publication-ready graphical diagnostic tools were designed to represent the CREST data in a standardised way to guide users in this task and avoid the typical "black box" criticism many complex statistical tools face.
The central element: the crestObj object In crestr, all the CREST-related data are stored within a single S3 object of the class crestObj that is first initialised by either crest. get_modern_data or crest. set_modern_data (see Sect. 5. 2 for details). Most package functions will take a crestObj as their primary input and return an updated version of that object. In practice, a crestObj is a nested list that contains five sublists, each one grouping a specific type of information, such as the calibration data, the fitted climate responses, or the reconstructions (Fig. 5 ). Wrapper functions have been implemented to manipulate and modify the information contained in a crestObj, and users are never expected to manually modify their crestObj -even if it is possible. The five sub-lists contain the following information: inputs contains the input data (e.
g. the counts/percentages of the fossil proxy data, the ages of the samples or the names of the fossil taxa). parameters contains the parameters provided at the different stages of the analysis (e. g. the tailoring of the gbif4crest calibration dataset or the fitting and combination of the PDFs; see Sect. 5). modelling contains all the data related to the estimation of the PDFs (e. g. the occurrence data (the "distri-butions") used to estimate the PDFs, the climate space of the study area, or the PDFs themselves). reconstructions contains all the results (e. g. best estimates, synthetic error measurements, and the full distribution of the reconstruction). misc contains some additional metadata relative to the reconstruction (e. g. the site location or, most importantly, information related to the proxy-species associated process described in Sect.
Input data for crestr Five different input data files are compatible with crestr. However, most applications will only require two files (the df and PSE files, see below) to be created. More specific applications may require up to four of these files. All the files can be prepared outside the R environment and imported using standard R functions. Examples files based on pseudo data accompany the "get started" example provided in the package (https://mchevalier2. github. io/crestr/articles/ get-started. html, last access: February 2022). The files used in the application to illustrate the package are available in the Supplement to this paper.
The proxy-species equivalency (PSE) table Creating a PSE data frame is required to extract distribution data from the gbif4crest calibration dataset. It is used to group individual species available in the TAXA table into their corresponding fossil taxon. This step is important to estimate the species responses (PDF sp (s, c)) and taxon responses (PDF tx (t, c)) described in Sect. 2. 2. When all the fossil taxa are identified at the species level, the PSE table is a simple data frame with one row per taxon (such as, for instance, the row corresponding to Elaeis guineensis in Table  3 ). However, fossil taxa are most often identified at a lower taxonomic resolution (sub-genus, genus, sub-family, family). These varying levels of identification should be encoded in the PSE file to link one or more (groups of) species to their common fossil taxon name (i.
Artemisia in Table 3). A PSE file is composed of five columns (Table  3 ). The first one (Level) contains an integer that indicates the level of taxonomic resolution of the row (1 for family, 2 for genus, 3 for species and 4 for taxa that should be excluded from the reconstruction, e. g. "Triletes spores" in the example case study). The fifth column, ProxyName, contains the name of the taxon. All the taxa recorded in the df dataset should be listed here, or they will be excluded from the study. Columns  list_of_taxa <-colnames(df)[-1] createPSE(list_of_taxa) The species-taxon association is performed in sequential steps by the crest. get_modern_data() function (see Sect. 5. 2). First, crestr classifies the taxa with the lowest taxonomical resolution (i. e. when Level is equal to one) and then increases the resolution Level by Level.
The alternative modern calibration dataset (distributions) Users that prefer fitting proxy-climate responses from their own calibration data instead of the proposed gbif4crest dataset should prepare a distributions dataset following the specific structure presented in Table  4. The first two columns should contain species names (or any unique identifiers) and the corresponding proxy name. If more than one species correspond to one taxon, the PDFs will be fitted in two steps, as explained in Sect. 2. The following two columns contain the coordinates of the species occurrence data. Finally, the last columns contain the climate values to be reconstructed. An optional column called weight can be added to distributions in the fifth position (i. e. between the coordinates and the climate variables) if one wants to weigh the different observations.
The climate_space data frame This data frame is only necessary if the users use a personal calibration dataset (distributions) instead of the gbif4crest dataset. This data frame enables (1) using the climate space weighting option (Sect. 2. 2) and (  2 ) including plots of modern climate in the different diagnostic tools. Its structure is straightforward, with the first two columns containing longitudes and latitudes and the subsequent columns the climate variables to reconstruct. The spatial resolution and the ordering of the climate variables should be identical to the distributions table  (Table 4 ). However, the arrangement of the rows is not important. Including a climate_space dataset is recommended, even if it is not mandatory.
Package dependencies The crestr package is built in R (R Core Team, 2020) using the devtools package  (Wickham et al. , 2020). crestr depends on numerous packages: clipr  (Lincoln, 2020)  To illustrate the different ways of using crestr and its graphical diagnostic tools, I use pollen data recently analysed with the original CREST software to reconstruct mean annual temperature (MAT) from marine core MD96-2048. The core was retrieved off the coast of South Africa and Mozambique near the mouth of the Limpopo River. The terrestrial sediments are expected to come from the entire catchment of the Limpopo River and the smaller local river catchments near the coast  (Dupont et al. , 2019 (Dupont et al. , , 2011;; Castañeda et al. , 2016). The MAT reconstruction is based on 181 fossil pollen samples and the percentages of more than 150 terrestrial pollen taxa and covers the last 790 000 years.
As the catchment of these marine sediments is large, an extensive calibration dataset covering all vegetation zones from tropical Africa to the temperate southwestern tip of South Africa was designed to prevent any artificial reduction in the possible range of variability of the reconstruction. The glacial-interglacial trends and amplitude of the MAT reconstructions were validated by comparing them with regional temperature records and other global indicators of glacialinterglacial temperature variability (e. g. Antarctic temperature or global sea-level curves, see  Chevalier et al. , 2021a , for more details). Here, I reproduce this reconstruction using the original parameterisation of the CREST algorithm obtained from the original CREST point-and-click interface to showcase how it can easily be replicated in a few lines of code with the crestr package.
Formatting the calibration data in a crestObj As the gbif4crest dataset was used to fit the PDFs, the function called crest. get_modern_data() was used to extract the calibration data: All the parameters of the function were defined by the characteristics of the proxy (pollen), the climate to reconstruct (MAT/bio1) and the definition of the study area (eastern and southern Africa). The three input files (i. e. df, PSE and selectedTaxa; see Sect. 4. 3) required to realise this reconstruction are reproduced from the published dataset  (Chevalier et al. , 2020a)  and are available in the Supplement. The following points describe the different parameters of the crest. get_modern_data() function and how they relate to the data extraction and modelling. -The parameter taxaType is used to choose the type of proxy used and takes a value between 1 to 6 for plants (i.
e. pollen and plant macro remains), beetles, chironomids, foraminifers, diatoms and rodents, respectively. -The name(s) or code(s) of the climate variables to study should be provided here (see Tables  1  and 2  or use the function accClimateVariables() for a list of accepted names). Here, "bio1" means mean annual temperature. More variables can be added if necessary (e. g. c('bio1', 'ai')). However, serial reconstructions should be avoided, even if many variables are provided with this package. Careful interpretations of the fossil data should be made before selecting variables. -Geographical parameters can be provided to tailor the gbif4crest dataset to the study area and data. These can include minimum and maximum longitude and latitude  (xmn, xmx, ymn, ymx) , continent, ocean or country names (see accCountryNames() and accBasinNames() for a list of accepted names), and also some ecological classifiers, such as realms, biomes or ecoregions (see accRealmNames() for a list of official names).
Only the occurrences that respect all the specified constraints will be returned. -To estimate reliable species PDFs, it is recommended to use at least 20 distinct occurrences for each species, even if different values can be specified with the minGridCell parameter, depending on the density of data available across the study area. -Optional information about the site, such as a name and coordinates, can be provided and, where possible, this information will be represented on the different graphical diagnostic tools created by crestr (e. g. the location of the record is added to the maps if the coordinates are provided). The crest. get_modern_data() function reads all the data and parameters, extracts the data from the cloudbased gbif4crest database, processes the distribution data and returns everything as a structured crestObj -here called rcnstrctn and whose structure is displayed in Fig.
5  -that will be read and modified by all subsequent functions. Alternatively, the function crest. set_modern_data() could be called instead of crest. get_modern_data() to use personal calibration data instead of the gbif4crest database. If the calibration data needed for this study were available as a distributions and climate_space data frames (Sect. 4. 3), similar results would be obtained with As described in Sect. 2. 2, the different parameters that control the reconstruction should be carefully considered to produce reliable PDFs. These include specifying the shape of the species PDFs, which should be either "normal" or "lognormal", depending on the variable to reconstruct (see Sect. 2. 2). the width of the climate bins (bin_width) expressed in the variables' units (e. g. 2 • C or 50 mm) if the PDFs are corrected for an heterogeneous climate space (climateSpaceWeighting set to TRUE).