records {autodb} | R Documentation |
Relational data records
Description
Generic function, for retrieving data contained in a database-like structure. In particular, this is intended for such structures where the individual relations can't be accessed with subsetting.
Usage
records(x, ...)
records(x, ...) <- value
Arguments
x |
a relational data object, such as a |
... |
further arguments passed on to methods. |
value |
A list of data frames of the same length as |
Details
Since the relational data objects in autodb
, relation
and database
, have subsetting methods that return relational
data objects, the data contained within them can't be accessed by subsetting.
This function is intended for accessing it instead.
It's recommended to call records
before doing any subsetting, since
subsetting on a relation data object does more work that will be thrown away,
such as subsetting on a database
checking whether foreign key
references should be removed.
Value
A list containing data frames, with elements named for their respective relations.
Examples
db <- autodb(ChickWeight)
records(db) # data for Chick and Time_Chick relations
# ways to get data for subsets
records(db)[c(1, 2)]
records(db)[[1]]
records(db)$Chick
# subsetting first isn't recommended: removes foreign key
# reference as mentions, and you need to subset again anyway
records(db[[1]])[[1]]