as.data_model: Coerce to a data model

Description Usage Arguments Details Value

View source: R/dm.R

Description

Functions to coerce an object to a data model if possible.

Usage

1

Arguments

x

A data frame to be coerced to data model object

Details

Function accepts a data frame with columns info. Data frame must have 'table' and 'column' elements. Optional element 'key' (boolean) marks a column as a primary key. Optional element 'ref' (character string) defines referenced table name. Optional element 'ref_col' (character string) defines a column in a referenced table name primary key (only necessery when referenced table has a compound primary key).

Value

If possible it returns a data model object. It is a list of data frames with at least the following columns:

table

A table name

column

A name of the column in a table

key

A boolean value indicating this column is in a primary key. Use integer values with order for compound keys

ref

A character string with a referenced table name. If exists (not NA) then the column is a foreign key.

ref_col

A character string with a referenced table name column. This is only necessary when referenced table has multi-column key


bergant/datamodelr documentation built on March 6, 2021, 5:47 a.m.