You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
library(drake)
library(gapminder)
library(tidyverse)
# Split the Gapminder data by continent.gapminder_continents<-function() {
gapminder %>%
mutate(gdpPercap= scale(gdpPercap)) %>%
split(f=.$continent)
}
# Fit a model to a continent.fit_model<-function(continent_data) {
lm(formula=gdpPercap~year, data=continent_data[[1]])
}
plan<- drake_plan(
continents= gapminder_continents(),
model= target(fit_model(continents), dynamic= map(continents))
)
make(plan)
#> target continents#> dynamic model#> subtarget model_23022788#> subtarget model_e020ff00#> subtarget model_53c1b086#> subtarget model_0fc4392a#> subtarget model_8b2d2fd5#> aggregate model
readd(model)
#> Error: `..1` must be a vector, not a `lm` object
Prework
drake
's code of conduct.Description
#1105 made dynamic branching a breeze for most use cases, but now
drake
is less forgiving about non-vector sub-targets.To quote Hadley in r-lib/vctrs#321:
And I totally forgot about it in #1105.
Created on 2020-01-18 by the reprex package (v0.3.0)
The error comes from trying to aggregate non-vectors.
Created on 2020-01-18 by the reprex package (v0.3.0)
We need some special error handling to catch non-vectors.
Created on 2020-01-18 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: