This is a wrapper function for applying discover_keys,
relation_schema, create, and
insert. This takes a data frame and adds its keys, resulting in
a single relation. If only the keys are required, this can be much quicker
than running autodb.
autokey(
df,
keep_rownames = FALSE,
digits = getOption("digits"),
progress = FALSE,
progress_file = "",
...
)A relation of length 1, containing the data in
df and its keys.
a data.frame, containing the data to be normalised.
a logical or a string, indicating whether to include the row names as a column. If a string is given, it is used as the name for the column, otherwise the column is named "row". Like with the other column names, the function returns an error if this results in duplicate column names. Set to FALSE by default.
a positive integer, indicating how many significant digits are
to be used for numeric and complex variables. This is used for both
pre-formatting in discover_keys, and for rounding the data
before use in insert, so that the data satisfies the
resulting schema. A value of NA results in no rounding. By default,
this uses getOption("digits"), similarly to format.
See the "Floating-point variables" section for discover for
why this rounding is necessary for consistent results across different
machines. See the note in print.default about digits >=
16.
a logical, for whether to display progress to the user during
dependency search in discover.
a scalar character or a connection. If progress
is non-zero, determines where the progress is written to, in the same way
as the file argument for cat.
further arguments passed on to discover_keys.
# simple example
autokey(ChickWeight)
Run the code above in your browser using DataLab