Description Usage Arguments Value Examples
Note: do not count on order of resulting data. Also only added rows are altered by the fill instructions.
1 2 3 4 5 6 7 8 9 |
data |
data.frame data to augment |
support |
data.frame rows of unique key-values into data |
... |
not used, force later arguments to bind by name |
fills |
list default values to fill in columns |
newRowColumn |
character if not null name to use for new row indicator |
copy |
logical if TRUE copy support to data's source |
tempNameGenerator |
temp name generator produced by wrapr::mk_tmp_name_source, used to record dplyr::compute() effects. |
augmented data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # single column key example
data <- data.frame(year = c(2005,2007,2010),
count = c(6,1,NA),
name = c('a','b','c'),
stringsAsFactors = FALSE)
support <- data.frame(year=2005:2010)
filled <- replyr_coalesce(data, support,
fills=list(count=0))
filled <- filled[order(filled$year), ]
filled
# complex key example
data <- data.frame(year = c(2005,2007,2010),
count = c(6,1,NA),
name = c('a','b','c'),
stringsAsFactors = FALSE)
support <- expand.grid(year=2005:2010,
name= c('a','b','c','d'),
stringsAsFactors = FALSE)
filled <- replyr_coalesce(data, support,
fills=list(count=0))
filled <- filled[order(filled$year, filled$name), ]
filled
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.