type_vft: Help to read ForestGEO data safely, with consistent columns...

View source: R/read_fgeo.R

type_vftR Documentation

Help to read ForestGEO data safely, with consistent columns type.

Description

A common cause of problems is feeding functions with data which columns are not all of the expected type. The problem often begins when reading data from a text file with functions such as utils::read.csv(), utils::read.delim(), and friends – which commonly guess wrongly the column type that you more likely expect. These common offenders are strongly discouraged; instead consider using readr::read_csv(), readr::read_tsv(), and friends, which guess column types correctly much more often than their analogs from the utils package.

type_vft() and type_taxa() help you to read data more safely by explicitly specifying what type to expect from each column of known datasets. These functions output the specification of column types used internally by read_vft() and read_taxa():

  • type_vft(): Type specification for ViewFullTable.

  • type_taxa(): Type specification for ViewFullTaxonomy.

Usage

type_vft()

type_taxa()

Details

Types reference (for more details see read_delim()):

  • c = character,

  • i = integer,

  • n = number,

  • d = double,

  • l = logical,

  • D = date,

  • T = date time,

  • t = time,

  • ? = guess,

  • or _/- to skip the column.'.

Value

A list.

See Also

readr::read_delim().

Other functions to operate on column types: type_ensure()

Other functions to read text files delivered by ForestgGEO's database: read_vft()

Examples

assert_is_installed("fgeo.x")
library(fgeo.x)
library(readr)

str(type_vft())

read_csv(example_path("view/vft_4quad.csv"), col_types = type_vft())

str(type_taxa())

read_csv(example_path("view/taxa.csv"), col_types = type_taxa())

fgeo.tool documentation built on Sept. 3, 2022, 5:05 p.m.