populate
copies data from a list (e.g. input by a user) to another list
with a similar shape. The second list, called the interface
, will generally
also contain extra metadata for making API requests, such as names or types.
populate(input, interface)
# Make an interface with metadata, e.g. type.
interface <- tag_add(list(foo = c(), bar = c()), list(type = "structure"))
# Combine data and the metadata from the interface.
populate(list(foo = 1, bar = 2), interface)
#> $foo
#> [1] 1
#>
#> $bar
#> [1] 2
#>
#> attr(,"tags")
#> attr(,"tags")$type
#> [1] "structure"
#>