propagate {dunlin} | R Documentation |
Propagate Column
Description
propagate
copy columns from a given table of a list
of data.frame
to all tables based on other
common columns. If several rows are associated with the same key, the rows will be duplicated in the receiving
tables. In safe mode, the key must be unique in the original table.
Usage
propagate(db, from, add, by, safe = TRUE)
## S3 method for class 'list'
propagate(db, from, add, by, safe = TRUE)
Arguments
db |
( |
from |
( |
add |
( |
by |
( |
safe |
( |
Value
updated list
of data.frame
.
Examples
df1 <- data.frame(
id1 = c("a", "a", "c", "d", "e", "f"),
id2 = c("A", "B", "A", "A", "A", "A"),
int = c(1, 2, 3, 4, 5, 6),
bool = c(TRUE, FALSE, TRUE, FALSE, TRUE, FALSE)
)
df2 <- data.frame(
id1 = c("a", "a", "d", "e", "f", "g"),
id2 = c("A", "B", "A", "A", "A", "A")
)
df3 <- data.frame(
id1 = c("a", "c", "d", "e", "f", "x"),
id2 = c("A", "A", "A", "A", "B", "A"),
int = c(11, 22, 33, 44, 55, 66)
)
db <- list(df1 = df1, fd2 = df2, df3 = df3)
propagate(db, from = "df1", add = c("int", "bool"), by = c("id1", "id2"))
[Package dunlin version 0.1.7 Index]