This function loads all locally installed allometric models if they are
downloaded and installed, if not run the install_models
function. The
result is of class model_tbl
, which behaves very much like a
tibble::tbl_df
or a data.frame
.
load_models()
A model_tbl containing the locally installed models.
Printing the head
of allometric_models
, we can see the structure of the
data
allometric_models <- load_models()
#> Warning in readRDS(rds_path): strings not representable in native encoding will be translated to UTF-8
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'M<e1>laga' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>ceres' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
#> Warning in readRDS(rds_path): input string 'C<e1>diz' cannot be translated to UTF-8, is it valid in 'UTF-8'?
head(allometric_models)
#> # A tibble: 6 x 10
#> id model_type country region taxa pub_id model family_name covt_name pub_year
#> <chr> <chr> <list> <list> <list> <chr> <list> <list> <list> <dbl>
#> 1 76ccc16a site index <chr [1]> <chr [2]> <Taxa> barnes_1962 <FxdEffcM> <chr [1]> <chr [2]> 1962
#> 2 cc2078aa site index <chr [1]> <chr [2]> <Taxa> barrett_1978 <FxdEffcM> <chr [1]> <chr [2]> 1978
#> 3 3955ab4f stem height <chr [1]> <chr [3]> <Taxa> barrett_2006 <FxdEffcM> <chr [1]> <chr [1]> 2006
#> 4 48b4aecf stem height <chr [1]> <chr [3]> <Taxa> barrett_2006 <FxdEffcM> <chr [1]> <chr [1]> 2006
#> 5 2fa084c2 stem height <chr [1]> <chr [3]> <Taxa> barrett_2006 <FxdEffcM> <chr [1]> <chr [1]> 2006
#> 6 7a585d5e stem height <chr [1]> <chr [3]> <Taxa> barrett_2006 <FxdEffcM> <chr [1]> <chr [1]> 2006
The columns are:
id
- A unique ID for the model.
model_type
- The type of model (e.g., stem volume, site index, etc.)
country
- The country or countries from which the model data is from.
region
- The region or regions (e.g., state, province, etc.) from which
the model data is from.
taxa
- The taxonomic specification of the trees that are modeled.
model
- The model object itself.
pub_id
- A unique ID representing the publication.
family_name
- The names of the contributing authors.
covt_name
- The names of the covariates used in the model.
pub_year
- The publication year.
Models can be searched by their attributes. Note that some of the columns
are list
columns, which contain lists as their elements. Filtering on
data in these columns requires the use of purrr::map_lgl
which is used to
determine truthiness of expressions for each element in a list
column.
While this may seem complicated, we believe the nested data structures are
more descriptive and concise for storing the models, and users will quickly
find that searching models in this way can be very powerful.
One of the most common things people need is a model for a particular
species. For this, we must interact with the taxa
column. For example,
to find models for the Pinus genus we can use
pinus_models <- dplyr::filter(
allometric_models,
purrr::map_lgl(taxa, ~ "Pinus" %in% .)
)
head(pinus_models)
#> # A tibble: 6 x 10
#> id model_type country region taxa pub_id model family_name covt_name pub_year
#> <chr> <chr> <list> <list> <list> <chr> <list> <list> <list> <dbl>
#> 1 cc2078aa site index <chr [1]> <chr [2]> <Taxa> barrett_1978 <FxdEffcM> <chr [1]> <chr [2]> 1978
#> 2 502152d1 stem height <chr [1]> <chr [3]> <Taxa> barrett_2006 <FxdEffcM> <chr [1]> <chr [1]> 2006
#> 3 3fb70119 stem height <chr [1]> <chr [3]> <Taxa> barrett_2006 <FxdEffcM> <chr [1]> <chr [1]> 2006
#> 4 925de182 stem height <chr [1]> <chr [3]> <Taxa> barrett_2006 <FxdEffcM> <chr [1]> <chr [1]> 2006
#> 5 910dddb1 stem height <chr [1]> <chr [3]> <Taxa> barrett_2006 <FxdEffcM> <chr [1]> <chr [1]> 2006
#> 6 5b3e21e7 stem height <chr [1]> <chr [3]> <Taxa> barrett_2006 <FxdEffcM> <chr [1]> <chr [1]> 2006
nrow(pinus_models)
#> [1] 352
Users can also search with a specific taxon, which allows a full specification from family to species. For example, if we want models that apply to Ponderosa pine, first declare the necessary taxon, then use it to filter as before
We can even check for models that contain certain types of data requirements. For example, the following block finds diameter-height models, specifically models that use diameter outside bark at breast height as the only covariate. The utility here is obvious, since many inventories are vastly limited by their available tree measurements.
dia_ht_models <- dplyr::filter(
allometric_models,
model_type == 'stem height',
purrr::map_lgl(covt_name, ~ length(.)==1 & .[[1]] == 'dsob'),
)
nrow(dia_ht_models)
#> [1] 285
Breaking this down, we have the first condition model_type=='stem_height'
selecting only models concerned with stem heights as a response variable. The
second line maps over each element of the covt_name
column, which is a
character vector. The .
represents a given character vector for that row.
First, we ensure that the vector is only one element in size using
length(.)==1
, then we ensure that the first (and only) element of this
vector is equal to 'dsob'
, (diameter outside bark at breast height). In
this case, 285 are available in the package.
By now the user should be sensing a pattern. We can apply the exact same
logic as the Finding Contributing Authors section to find all models
developed using data from US-OR
us_or_models <- dplyr::filter(
allometric_models,
purrr::map_lgl(region, ~ "US-OR" %in% .),
)
nrow(us_or_models)
#> [1] 537
We can see that 537 allometric models are defined for the state of Oregon, US.