map_nm | R Documentation |
Loop over an nm object when a vectorized operation is not available.
map_nm(.x, .f, ...) map2_nm(.x, .y, .f, ...) imap_nm(.x, .f, ...) pmap_nm(.l, .f, ...)
.x |
An nm object. |
.f |
A function, formula, or vector (not necessarily atomic). If a function, it is used as is. If a formula, e.g.
This syntax allows you to create very compact anonymous functions. If character vector, numeric vector, or list, it is
converted to an extractor function. Character vectors index by
name and numeric vectors index by position; use a list to index
by position and name at different levels. If a component is not
present, the value of |
... |
Additional arguments passed on to the mapped function. |
.y |
An optional nm object. |
.l |
A list of vectors, such as a data frame. The length of |
A modified nm object.
# create example object m1 from package demo files exdir <- system.file("extdata", "examples", "theopp", package = "NMproject") m1 <- new_nm(run_id = "m1", based_on = file.path(exdir, "Models", "ADVAN2.mod"), data_path = file.path(exdir, "SourceData", "THEOPP.csv")) ## vectorized run m1 %>% child(1:3) %>% run_id(paste0(run_id(.), "modified")) m1 %>% child(1:3) %>% map_nm(~ .x %>% run_id(paste0(run_id(.), "modified")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.