read_types: Return the 'types' data source as a tibble with names &...

View source: R/read_textdata.R

read_typesR Documentation

Return the 'types' data source as a tibble with names & shortnames

Description

Returns the included data source types as a tibble. Names and shortnames from namelist are added, in English by default.

Usage

read_types(
  path = pkgdatasource_path("textdata/types", ".yml"),
  file = "types",
  file_namelist = "namelist",
  lang = "en"
)

Arguments

path

Location of the data sources types and namelist. The default is to use the location of the data sources as delivered by the installed package.

file

The filename of the types data source, without extension. The default is to use the file delivered by the installed package.

file_namelist

The filename of the namelist data source, without extension. The default is to use the file delivered by the installed package.

lang

An IETF BCP 47 language tag, such as "en" or "nl", to specify the language of names & shortnames to be returned in the tibble.

Details

types is a data source in the vc-format which provides a checklist of types, represented by their current codes, together with several attributes. A 'type' refers to either a (main) habitat type, a habitat subtype or a regionally important biotope (RIB).

read_types() reads the types data source, adds names + shortnames and returns it as a tibble. A tibble is a data frame that makes working in the tidyverse a little easier. By default, the data version delivered with the package is used and English names (lang = "en") are returned for types, attributes and tags.

Note that factors are generated with implicit NA values (i.e. there is no factor level to represent the missing values). If you want this category to appear in certain results, you can convert such variables with forcats::fct_explicit_na().

Value

The types data frame as a tibble, with names & shortnames added for types, attributes and tags according to the lang argument. See types for documentation of the data-source's contents. See namelist for the link between codes or other identifiers and the corresponding names (and shortnames).

The added names and shortnames are represented by the following variables:

  • type_name

  • type_shortname

  • typeclass_name

  • hydr_class_name

  • hydr_class_shortname

  • groundw_dep_name

  • groundw_dep_shortname

  • flood_dep_name

  • flood_dep_shortname

  • tag_1_name

  • tag_1_shortname

  • tag_2_name

  • tag_2_shortname

  • tag_3_name

  • tag_3_shortname

Except for the tags, the names and shortnames are factors with their level order according to that of the corresponding attribute.

Recommended usage

read_types()

read_types(lang = "nl")

See Also

types

Other reading functions for n2khab-referencelists: read_env_pressures(), read_namelist()

Examples

read_types()
read_types(lang = "nl")


inbo/n2khab documentation built on Jan. 15, 2025, 9:36 a.m.