Skip to content

tar_map over tibble containing quosures #435

Closed Answered by wlandau
djbirke asked this question in Help
Discussion options

You must be logged in to vote

Hi @djbirke,

In tar_map(), the names argument refers to columns of values that can be deparsed to suffixes of target names. group_vars is difficult to deparse, and the result is not usable for target names.

deparse(list(vars(cyl), vars(cyl, gear)))
#> [1] "list(structure(list(~cyl), .Names = \"\", class = c(\"quosures\", "                       
#> [2] "\"list\")), structure(list(~cyl, ~gear), .Names = c(\"\", \"\"), class = c(\"quosures\", "
#> [3] "\"list\")))"      

So I recommend you create another column for the names.

library(targets)
tar_script({
  options(tidyverse.quiet = TRUE)
  library(tarchetypes)
  library(tidyverse)
  values <- expand_grid(
    x = c(0, 1, 2),
    tibble(
  …

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@djbirke
Comment options

@ginolhac
Comment options

@wlandau
Comment options

Comment options

You must be logged in to vote
1 reply
@djbirke
Comment options

Answer selected by djbirke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants