Skip to contents

Decomposes a data frame into several relations, based on the given database schema. It's intended that the data frame satisfies all the functional dependencies implied by the schema, such as if the schema was constructed from the same data frame. If this is not the case, the function will returns an error.

Usage

decompose(df, schema)

Arguments

df

a data.frame, containing the data to be normalised.

schema

a database schema with foreign key references, such as given by autoref.

Value

A database object, containing the data in df within the database schema given in schema.

Details

If the schema was constructed using approximate dependencies for the same data frame, decompose returns an error, to prevent either duplicate records or lossy decompositions. This is temporary: for the next update, we plan to add an option to allow this, or to add "approximate" equivalents of databases and database schemas.