Guidance on Error using Targets?

Hi, I have been asked to use the targets package for two r scripts. I am new to R, started 2 days ago due to this request to offload some work from someone else.

I have create the _targets.R file and when I run these two commands it all works as I expect:


The problem I get is when I try to run tar_make(). I get this error:

✔ skip target file
▶ start target filtered_data
✖ error target filtered_data
▶ end pipeline [44.031 seconds]
! Error running targets::tar_make()
  Error messages: targets::tar_meta(fields = error, complete_only = TRUE)
  Debugging guide:
  How to ask for help:
  Last error: could not find packages haven, dplyr, ggplot2, survival, survminer in library paths 

I am not sure what I need to do, if someone can help me that would be awesome :slight_smile: ! This is the file structure:

# This file is created by use_targets().
# Load packages required to define the pipeline:

# Set the path to your functions file

# Set target options:
  packages = c("haven, dplyr, ggplot2, survival, survminer"), # packages that your targets need to run

  #import data
  tar_target(file, command = "data/raw.dta", format = "file"),
  tar_target(data, get_data(file)),
  #filter data
  tar_target(filtered_data, filter_respondents(data)),


I have checked and it seems that these packages are installed?

Apologies in advance for this simple question. Any help would be much appreciated.

I think the issue was the double quotes on the packages.


packages = c("haven, dplyr, ggplot2, survival, survminer")


packages = c("haven", "dplyr", "ggplot2", "survival", "survminer")
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.