Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

drake: how to send arguments to target with combine?

$
0
0

Consider the following MWE. How do I get the m1 and m2 integers instead of expressions to be exposed to the func() arguments, instead of "object '1' not found"?

func <- function(x, m1, m2) {
  paste("M1=", m1, "M2=", m2, ": ", mean(unlist(x)))
}
p <- drake_plan(
  a = target(
    runif(10, m1, m2),
    transform = cross(m1 = 0, m2 = c(1,2), n = !!c(1,5))
  ),
  b = target(
    func(list(a), m1, m2),
    transform = combine(a, .by = m2)
  )
)

Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>