The fqar package

Andrew Gard and Alexia Myers

Introduction

The \({\tt fqar}\) packages provides tools for downloading and analyzing floristic quality assessment (FQA) data from universalFQA.org. Two sample data sets, \({\tt missouri}\) and \({\tt chicago}\), are also provided.

Functions in this package fall into three general categories: indexing functions, which produce data frames of current public databases and FQAs from various regions, downloading functions, which download the FQAs themselves, and tidying functions, which convert downloaded assessments into a standard format.

Indexing functions

Each floristic quality assessment is tied to a specific databases of native plants that has been compiled by experts in local flora. A listing of all databases accepted by universalFQA.org can be viewed with the \({\tt index\_fqa\_databases()}\) function.

databases <- index_fqa_databases()
head(databases)
#> # A tibble: 6 × 4
#>   database_id region                                                year descr…¹
#>         <dbl> <chr>                                                <dbl> <chr>  
#> 1         206 "Allegheny Plateau, Glaciated"                        2021 Faber-…
#> 2          70 "Appalachian Mtn (EPA Ecoregions 66,67,68,69) of KY…  2013 Gianop…
#> 3         108 "Atlantic Coastal Pine Barrens (8.5.4) "              2017 NEIWPC…
#> 4         136 "Atlantic Coastal Pine Barrens (8.5.4)"               2018 Nature…
#> 5         204 "Atlantic Coastal Pine Barrens (8.5.4)"               2021 Faber-…
#> 6           1 "Chicago Region"                                      1994 Swink,…
#> # … with abbreviated variable name ¹​description

To see a listing of all public floristic quality assessments using a given database, use the \({\tt index\_fqa\_assessments()}\) function.

missouri_fqas <- index_fqa_assessments(database_id = 63)
head(missouri_fqas)
#> # A tibble: 6 × 5
#>      id assessment             date       site            practitioner          
#>   <dbl> <chr>                  <date>     <chr>           <chr>                 
#> 1 26735 Oakwood Bottoms Survey 2022-08-18 Oakwood Bottoms Jonathan Jackson  and…
#> 2 26527 1                      2022-08-04 Fremont         GRB                   
#> 3 26528 2                      2022-08-04 Fremont         grb                   
#> 4 26530 3                      2022-08-04 Fremont         grb                   
#> 5 26531 4                      2022-08-04 Fremont         grb                   
#> 6 26532 5                      2022-08-04 Fremont         grb

Similarly, the \({\tt index\_fqa\_transects()}\) function returns a listing of all public transect assessments using the specified database.

missouri_transects <- index_fqa_transects(database_id = 63)
head(missouri_transects)
#> # A tibble: 6 × 5
#>      id assessment       date       site              practitioner              
#>   <dbl> <chr>            <date>     <chr>             <chr>                     
#> 1  6875 Post Burn Survey 2022-06-14 Rock Garden Glade Colatskie, Scherrer, Nels…
#> 2  6736 Plot 24          2022-02-11 kaintuck          GRB                       
#> 3  6737 Plot 25          2022-02-11 kaintuck          GRB                       
#> 4  6738 Plot 26          2022-02-11 kaintuck          GRB                       
#> 5  6739 Plot 27          2022-02-11 kaintuck          GRB                       
#> 6  6740 Plot 28          2022-02-11 kaintuck          GRB

Downloading functions

Floristic quality assessments can be downloaded individually by id number or in batches according to specified search criteria using the \({\tt download\_assessment()}\) and \({\tt download\_assessment\_list()}\) functions, respectively.

The first of these accepts an assessment ID number as its sole input and returns a data frame. For instance, the Grasshopper Hollow survey has \({\tt assessment\_id} = 25961\) according to the listing obtained using \({\tt index\_fqa\_assessments()}\). The following code downloads this assessment.

grasshopper <- download_assessment(assessment_id = 25961)

Multiple assessments from a specified database can be downloaded simultaneously using \({\tt download\_assessment\_list()}\), which makes use of \({\tt dplyr::filter}\) syntax on the variables \({\tt id, assessment, date, site}\) and \({\tt practitioner}\). For instance, the following code downloads all assessments performed using the 2015 Missouri database at the Ambrose Farm site.

ambrose <- download_assessment_list(database_id = 63,
                                    site == "Ambrose Farm")

For even mid-sized requests, this command may run slowly due to the limited speed of the universalFQA.org website. For this reason, a progress bar has been added to the \({\tt download\_assessment\_list()}\) function when \(n\ge 5\).

As the name suggests, the output of \({\tt download\_assessment\_list()}\) is a list of data frames.

class(ambrose)
#> [1] "list"
length(ambrose)
#> [1] 3

Transect assessment data data stored on universalFQA.org is accessible to analysts using the \({\tt fqar}\) package via the functions \({\tt download\_transect()}\) and \({\tt download\_transect\_list()}\), which work exactly like their counterparts, \({\tt download\_assessment()}\) and \({\tt download\_assessment\_list()}\).

rock_garden <- download_transect(transect_id = 6875)
golden <- download_transect_list(database_id = 63,
                                 site == "Golden Prairie")

Tidying functions

The data frames obtained from these downloading functions are all highly untidy, respecting the default structure of the website from which they are obtained. The \({\tt fqar}\) package provides tools for efficiently re-formatting these sets.

Each floristic quality assessments on universalFQA.org includes two types of information: details about the species observed during data collection and summary information about the assessment as a whole. The \({\tt fqar}\) functions \({\tt assessment\_inventory()}\) and \({\tt assessment\_glance()}\) extract and tidy these two types of information.

For instance, the following code creates a data frame of species found in the 2021 Grasshopper Hollow survey downloaded earlier.

grasshopper_species <- assessment_inventory(grasshopper)
glimpse(grasshopper_species)
#> Rows: 300
#> Columns: 9
#> $ `Scientific Name` <chr> "Acer rubrum var. rubrum", "Acer saccharum subsp. sa…
#> $ Family            <chr> "Sapindaceae", "Sapindaceae", "Asteraceae", "Acorace…
#> $ Acronym           <chr> "ACERUR", "ACESUG", "ACHMIL", "ACOCAL", "ACTPAC", "A…
#> $ `Native?`         <chr> "native", "native", "native", "non-native", "native"…
#> $ C                 <dbl> 5, 5, 1, 0, 8, 2, 5, 4, 4, 2, 7, 6, 4, 5, 4, 8, 5, 6…
#> $ W                 <dbl> 0, 3, 3, -5, 3, 3, -3, 5, 3, 3, -5, 3, 0, 0, 3, 5, 5…
#> $ Physiognomy       <chr> "tree", "tree", "forb", "forb", "forb", "forb", "for…
#> $ Duration          <chr> "perennial", "perennial", "perennial", "perennial", …
#> $ `Common Name`     <chr> "red maple", "sugar maple", "yarrow", "sweet flag", …

A tidy summary of the assessment can be obtained with \({\tt assessment\_glance()}\). The output is a data frame with a single row and 53 columns, including \({\tt Native\ Mean\ C}\), \({\tt Native\ Species}\), and \({\tt Native\ FQI}\).

grasshopper_summary <- assessment_glance(grasshopper)
names(grasshopper_summary)
#>  [1] "Title"                     "Date"                     
#>  [3] "Site Name"                 "City"                     
#>  [5] "County"                    "State"                    
#>  [7] "Country"                   "FQA DB Region"            
#>  [9] "FQA DB Publication Year"   "FQA DB Description"       
#> [11] "Custom FQA DB Name"        "Custom FQA DB Description"
#> [13] "Practitioner"              "Latitude"                 
#> [15] "Longitude"                 "Weather Notes"            
#> [17] "Duration Notes"            "Community Type Notes"     
#> [19] "Other Notes"               "Private/Public"           
#> [21] "Total Mean C"              "Native Mean C"            
#> [23] "Total FQI"                 "Native FQI"               
#> [25] "Adjusted FQI"              "% C value 0"              
#> [27] "% C value 1-3"             "% C value 4-6"            
#> [29] "% C value 7-10"            "Native Tree Mean C"       
#> [31] "Native Shrub Mean C"       "Native Herbaceous Mean C" 
#> [33] "Total Species"             "Native Species"           
#> [35] "Non-native Species"        "Mean Wetness"             
#> [37] "Native Mean Wetness"       "Tree"                     
#> [39] "Shrub"                     "Vine"                     
#> [41] "Forb"                      "Grass"                    
#> [43] "Sedge"                     "Rush"                     
#> [45] "Fern"                      "Bryophyte"                
#> [47] "Annual"                    "Perennial"                
#> [49] "Biennial"                  "Native Annual"            
#> [51] "Native Perennial"          "Native Biennial"

The tidy format provided by \({\tt assessment\_glance()}\) is most useful when applied to multiple data sets at once, for instance in the situation where the analyst wants to consider statistics from many different assessments simultaneously. The \({\tt assessment\_list\_glance()}\) function provides a shortcut when those data frames are housed in a list like that returned by \({\tt download\_assessment\_list()}\). For instance, the following code returns a data frame with 52 columns and 3 rows, one per assessment.

ambrose_summary <- assessment_list_glance(ambrose)

The \({\tt fqar}\) package also provides functions for handling transect assessment data. \({\tt transect\_inventory()}\), \({\tt transect\_glance()}\), and \({\tt transect\_list\_glance()}\) work just like their counterparts, \({\tt assessment\_inventory()}\), \({\tt assessment\_glance()}\), and \({\tt assessment\_list\_glance()}\).

rock_garden_species <- transect_inventory(rock_garden)
rock_garden_summary <- transect_glance(rock_garden)
golden_summary <- transect_list_glance(golden)

Additionally, transect assessments usually include physiognometric metrics like relative frequency and relative coverage. These can be extracted with the \({\tt trasect\_phys()}\) function.

rock_garden_phys <- transect_phys(rock_garden)
glimpse(rock_garden_phys)
#> Rows: 6
#> Columns: 6
#> $ Physiognomy                 <chr> "Native forb", "Native grass", "Native sed…
#> $ Frequency                   <dbl> 115, 53, 20, 6, 4, 1
#> $ Coverage                    <dbl> 628, 413, 180, 125, 78, 1
#> $ `Relative Frequency (%)`    <dbl> 51.6, 23.8, 9.0, 2.7, 1.8, 0.4
#> $ `Relative Coverage (%)`     <dbl> 26.1, 17.2, 7.5, 5.2, 3.2, 0.0
#> $ `Relative Importance Value` <dbl> 38.9, 20.5, 8.3, 4.0, 2.5, 0.2

Data sets

Two tidy data sets of floristic quality data, \({\tt missouri}\) and \({\tt chicago}\), are included with the \({\tt fqar}\) package. Produced with \({\tt assessment\_list\_glance()}\), these show summary information for every floristic quality assessment that used databases 63 and 149, respectively, prior to August 14, 2022. These sets may be useful for visualization or machine-learning purposes. For instance, one might consider the relationship between richness and native mean C in sites assessed using the 2015 Missouri database:

ggplot(missouri, aes(x = `Native Species`, 
                     y = `Native Mean C`)) +
  geom_point() +
  geom_smooth() +
  scale_x_continuous(trans = "log10") +
  labs(x = "Native Species (logarithmic scale)",
       y = "Native Mean C") +
  theme_minimal()
#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'