nfi_get_data: Access to the tables in the NFI database

View source: R/lfcNFI.R

nfi_get_dataR Documentation

Access to the tables in the NFI database

Description

nfi_get_data is a wrapper for the $get_data method of lfcNFI objects. See also nfi.

Usage

nfi_get_data(object, table_name, spatial = FALSE)

Arguments

object

lfcNFI object, as created by nfi

table_name

character vector of lenght 1 indicating the requested table name

spatial

logical indicating if the data must be converted to an spatial object

Details

Connection to database can be slow. Tables retrieved from the db are stored in a temporary cache inside the lfcNFI object created by nfi, making subsequent calls to the same table are faster.

Value

A tbl object: tbl_df if spatial is FALSE, sf if spatial is TRUE

See Also

Other NFI functions: nfi_avail_tables(), nfi_describe_table(), nfi_describe_var(), nfi()

Examples

if (interactive()) {
  nfidb <- nfi()
  # tibble
  nfi_get_data(nfidb, 'plots')
  # sf tibble
  nfi_get_data(nfidb, 'plots', TRUE)

  # we can use pipes
  nfidb |>
    nfi_get_data('plots', TRUE)

  # nfidb is an R6 object, so the previous examples are the same as:
  nfidb$get_data('plots')
  nfidb$get_data('plots', TRUE)
}


MalditoBarbudo/lfcdata documentation built on May 2, 2023, 10:30 p.m.