knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(lfcdata)
Spanish National Forest Inventory data, localised at Catalonia is provided in this database. Data is presented at plot level (no individual trees data is available at this moment) for all the NFI versions available:
To access the data use the nfi()
function:
nfidb <- nfi() nfidb
Available tables in the NFI database can be consulted with nfi_avail_tables
,
# limited to the first nfi_avail_tables(nfidb)[1:5]
and a description for the tables with the nfi_describe_table
function:
tables_available <- nfi_avail_tables(nfidb) nfi_describe_table(nfidb, tables_available[1])
Information about the variables can also be consulted with nfi_describe_var
:
nfi_describe_var(nfidb, 'basal_area_balance')
See vignette('tables_and_variables', package = 'lfcdata')
for more detailed information.
Select the table to access and use the nfi_get_data
function. Tables can be related by
plot_id
variable:
library(dplyr) all_info_nfi4 <- nfi_get_data(nfidb, 'plots') |> right_join(nfi_get_data(nfidb, 'plot_nfi_4_results')) |> left_join(nfi_get_data(nfidb, 'plots_nfi_4_dynamic_info')) all_info_nfi4
Data can be retrieved in a spatial object (with plot coordinates as POINT
), using the
sf
package (http://r-spatial.github.io/sf/):
library(sf) nfi_get_data(nfidb, 'plot_nfi_4_results', spatial = TRUE) nfi_get_data(nfidb, 'plot_nfi_4_results', spatial = TRUE) |> plot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.