db2vegtable: Import PostgreSQL databases into vegtable objects

Description Usage Arguments

View source: R/db2vegtable.R

Description

Import and adaption of Postgres tables into objects of class vegtable.

In the case that some schemas are not mentioned, the function assumes such tables are located in the same schema as the table header. Thus for databases placed in just one schema, this need to be set only in argument header_schema.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
db2vegtable(conn, ...)

## S3 method for class 'PostgreSQLConnection'
db2vegtable(
  conn,
  header,
  sql_header,
  samples,
  relations,
  layers,
  coverconvert,
  geometry,
  description,
  as_list = FALSE,
  ...
)

import_swea(
  conn,
  header = c("swea_dataveg", "header"),
  samples = c("swea_dataveg", "samples"),
  relations = list(globe_plots = c("swea_dataveg", "globe_plots"), swea1_code =
    c("swea_dataveg", "swea1_code"), soil_moisture = c("swea_dataveg", "soil_moisture"),
    soil_texture = c("swea_dataveg", "soil_texture"), community_type = c("commons",
    "community_type"), naturalness = c("swea_dataveg", "naturalness"), record_type =
    c("swea_dataveg", "record_type")),
  layers = list(veg_layer = c("swea_dataveg", "veg_layer"), spec_miguel =
    c("specimens", "specimens_miguel")),
  coverconvert = list(br_bl = c("commons", "br_bl"), b_bbds = c("commons", "b_bbds"),
    ordinal = c("commons", "ordinal")),
  geometry = "plot_centroid",
  get_countries = TRUE,
  get_data_sources = TRUE,
  bib_args = list(),
  taxon_names = c("tax_commons", "taxonNames"),
  taxon_relations = c("swea_dataveg", "taxonRelations"),
  taxon_traits = c("swea_dataveg", "taxonTraits"),
  taxon_views = c("bib_references", "main_table"),
  taxon_levels = c("tax_commons", "taxonLevels"),
  names2concepts = c("swea_dataveg", "names2concepts"),
  ...
)

import_sam(
  conn,
  header = c("sudamerica", "header"),
  samples = c("sudamerica", "samples"),
  relations = list(community_type = c("commons", "community_type")),
  layers = list(spec_miguel = c("specimens", "specimens_miguel")),
  coverconvert = list(br_bl = c("commons", "br_bl"), b_bbds = c("commons", "b_bbds"),
    ordinal = c("commons", "ordinal")),
  geometry = "plot_centroid",
  get_countries = TRUE,
  get_data_sources = TRUE,
  bib_args = list(),
  taxon_names = c("tax_commons", "taxonNames"),
  taxon_relations = c("sudamerica", "taxonRelations"),
  taxon_traits = c("sudamerica", "taxonTraits"),
  taxon_views = c("bib_references", "main_table"),
  taxon_levels = c("tax_commons", "taxonLevels"),
  names2concepts = c("sudamerica", "names2concepts"),
  ...
)

import_bernice(
  conn,
  description = c(Title = "Parthenium survey in Lake Baringo", Author =
    "Bernice Mereina Sainepo", Source = "SWEA-Dataveg (GIVD-AF-00-006)", Version =
    Sys.Date()),
  head_cols = c("ReleveID", "code_trr228", "original_number", "record_date",
    "plot_size", "data_source", "elevation"),
  samples_cols = c("record_id", "ReleveID", "quadrant", "TaxonUsageID",
    "misspelled_name", "cover_percentage", "frequency"),
  ...
)

Arguments

conn

A database connection provided by dbConnect().

...

Further arguments passed to db2taxlist().

header, samples

Character vectors indicating the schema and table containing header and samples information, respectively.

sql_header

SQL statement to be used instead of header.

relations

A list of vectors indicating the schema and table in the database, excluding 'data_source'.

layers, coverconvert

Lists of vectors for the respective slots, each containing schema and name of required table.

geometry

Name of the variable in header containing the geometry of the plots.

description

Named vector with metadata.

as_list

Logical value indicating whether a list or an object of class vegtable should be returned.

get_countries

Logical argument, specific for the databases 'sudamerica' and 'SWEA-Dataveg', indicating whether country information should be reimported from integrated map.

get_data_sources

Logical argument whether references should be imported as data sources or not.

bib_args

List of arguments passed to biblio::read_bib().

taxon_names, taxon_relations, taxon_traits, taxon_views, taxon_levels, names2concepts

Arguments passed to db2taxlist().

head_cols

Character vector indicating the header variables to be imported (except the coordinates).

samples_cols

Character vector indicating the samples variables to be imported.


kamapu/vegtables2 documentation built on July 8, 2021, 7:57 a.m.