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:
tar_manifest(fields=command)
tar_visnetwork()
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:
! Error running targets::tar_make()
Error messages: targets::tar_meta(fields = error, complete_only = TRUE)
Debugging guide: https://books.ropensci.org/targets/debugging.html
How to ask for help: https://books.ropensci.org/targets/help.html
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 ! This is the file structure:
# This file is created by use_targets().
# Load packages required to define the pipeline:
library(targets)
# Set the path to your functions file
source("R/functions_data_wrangling.R")
# Set target options:
tar_option_set(
packages = c("haven, dplyr, ggplot2, survival, survminer"), # packages that your targets need to run
)
list(
#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.