type_vft | R Documentation |
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.
type_vft()
type_taxa()
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.'.
A list.
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()
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())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.