| foreignTbl {editbl} | R Documentation |
Create a foreign tibble
Description
Create a foreign tibble
Usage
foreignTbl(
x,
y,
by = intersect(dplyr::tbl_vars(x), dplyr::tbl_vars(y)),
naturalKey = dplyr::tbl_vars(y),
allowNew = FALSE
)
Arguments
x |
|
y |
|
by |
|
naturalKey |
|
allowNew |
|
Details
This is a tibble that can be passed onto eDT as a referenced table.
It is the equivalent of a database table to which the data tbl of eDT has a foreign key.
It will be merged with the tbl passed onto the data argument allowing to provide restrictions
for certain columns.
Note that row uniqueness for the columns used in by and naturalKey is assumed.
This assumption will however not be checked since it is an expensive operation on big datasets.
However, if violated, it might give errors or unexpected results during usage of the eDT module.
Value
List with unmodified arguments. However, they have now been checked for validity.
y, see argument
y.by, see argument
by.naturalKey, see argument
naturalKey.allowNew, see argument
allowNew
Author(s)
Jasper Schelfhout
Examples
a <- tibble::tibble(
first_name = c("Albert","Donald","Mickey"),
last_name_id = c(1,2,2)
)
b <- foreignTbl(
a,
tibble::tibble(
last_name = c("Einstein", "Duck", "Mouse"),
last_name_id = c(1,2,3)
),
by = "last_name_id",
naturalKey = "last_name"
)
## Only run this in interactive R sessions
if(interactive()){
eDT(a,
foreignTbls = list(b),
options = list(columnDefs = list(list(visible=FALSE, targets="last_name_id")))
)
}