as_config | R Documentation |
This function is provided to keep compatibility with 'config' package, which requires existence of default key. Additionally, we can at once wrap our structure with some other keys, in order to not to mix directory structur with different keys.
as_config(x, config = "default", wrap = "dirs", ...)
## S3 method for class 'path_chain'
as_config(x, config = "default", wrap = "dirs",
..., root.name = "root.dir")
## S3 method for class 'list'
as_config(x, config = "default", wrap = "dirs", ...)
x |
list with directory structure |
config |
configuration name |
wrap |
key name to wrap directory structure |
... |
additional arguments (not used at the moment) |
root.name |
key for root directory (for path_chain only) |
list compatible with 'config' package
library(magrittr)
# Initalizaing sample directory
tmp <- create_temp_dir("files")
create_sample_dir(tmp, override = TRUE)
full_path_chain(tmp, "kRoot", naming_k) %>%
list(kDirs = .) %>%
list(default = .) %>%
yaml::write_yaml(temp_path("config.yaml"))
# We can simply use such function
full_path_chain(tmp, "kRoot", naming_k) %>%
as_config("default", "kDirs") %>%
yaml::write_yaml(temp_path("config.yaml"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.