tabde: tabde: Define and Check The Structure of Data Frames and...

Description Usage Arguments Value Storing table_desings Author(s) See Also

Description

Define the structure (column names and types) of tables and save them as csv files. Tools are provided to use such table design to create database tables, read fwf and csv files, and check data.frames for validity.

Table designs are data.frames that contain meta-info on other data.frames such as column names and types. Such table_designs can be used for validating the structure of data.frames, generating SQL code, reading files, etc...

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
tabde(col_name, col_type = rep(NA_character_, length(col_name)),
  col_domain = NULL, ...)

tabde_fwf(col_name, col_type = rep(NA_character_, length(col_name)),
  fwf_start, fwf_end, col_domain = NULL, ...)

tabde_sql(col_name, col_type = rep(NA_character_, length(col_name)),
  sql_type = rep(NA_character_, length(col_name)),
  sql_opts = rep(NA_character_, length(col_name)), col_domain = NULL,
  ...)

Arguments

col_name

character vector. column names

col_type

character vector. Valid data.frame column types. NAs and the string "#skip" have special meanings.

NAs will be converted to readr::col_guess() by as_col_spec() and matches_tabde() will not check the classes of NA columns. In a similar fashion #skip columns will be convertet to readr::col_skip() and matches_tabde will not check if they are present in dat or not.

col_domain

character vector. A valid domain for col_name. Domains can be used by matches_tabde() and as_sql() to check for valid (discrete) values if a values Object is passed to these functions.

...

passed on to methods

fwf_start

integer vector. fwf start positons

fwf_end

integer vector. fwf end positons

sql_type

character vector. SQL Data Types as supported by target DBMS System. Columns wil col_type NA will be skipped when creating SQL statements.

sql_opts

character vector. SQL Options to be used by as_sql() (for example NOT NULL)

Value

a data.frame of class table_design

Storing table_desings

table_desings are designed to be stored as .csv files. This has some disadvantages over storing them in a binary format such as .rds or .rda, but makes it easy to edit them and track changes in a VCS such as git.

Author(s)

Maintainer: Stefan Fleck [email protected]

See Also


s-fleck/tabde documentation built on May 4, 2019, 1:23 p.m.