Character-based constructor mirroring targets::tar_target_raw(): name is a string and it is meant for use inside targets factories. Returns a single targets target whose command runs an optional R pre-script, script (via JuliaCall), and an optional R post-script, then returns a converted R object or a character vector of files. See run_jl_step() for the pre/post-script contract (the to_jl hand-off and the jl_get / jl_call helpers). For direct use in _targets.R, see tar_target_jl(). The Python twin is tar_target_py_raw().
Usage
tar_target_jl_raw(
name,
script,
pre_script = NULL,
post_script = NULL,
inputs = NULL,
output = "object",
retrieve = NULL,
files = NULL,
julia_version = NULL,
julia_home = getOption("tarpolyglot.julia_home"),
julia_project = NULL,
julia_packages = NULL,
pattern = NULL,
packages = targets::tar_option_get("packages"),
library = targets::tar_option_get("library"),
deps = NULL,
string = NULL,
format = NULL,
repository = targets::tar_option_get("repository"),
iteration = targets::tar_option_get("iteration"),
error = targets::tar_option_get("error"),
memory = targets::tar_option_get("memory"),
garbage_collection = isTRUE(targets::tar_option_get("garbage_collection")),
deployment = targets::tar_option_get("deployment"),
priority = targets::tar_option_get("priority"),
resources = targets::tar_option_get("resources"),
storage = targets::tar_option_get("storage"),
retrieval = targets::tar_option_get("retrieval"),
cue = targets::tar_option_get("cue"),
description = targets::tar_option_get("description")
)Arguments
- name
Character string, the target name.
- script
Path to the Julia script to run (required). Either a literal string (an untracked path: editing the file does not invalidate the target) or a
tar_target_path()reference to an upstream target (typicallyformat = "file"), which makes this step re-run whenever that file changes.- pre_script
Optional path to an R script run before the Julia script. See
run_jl_step(); assign a named listto_jlto hand objects to Julia. Accepts a literal string or atar_target_path()reference, as forscript.- post_script
Optional path to an R script run after the Julia script. See
run_jl_step(); helpersjl_get()andjl_call()are available, and its last expression (object mode) or returned paths (file mode) become the value. Accepts a literal string or atar_target_path()reference, as forscript.- inputs
Named character vector (or list) mapping the name seen inside the step (in the R environment and, after the hand-off, in the foreign session) to the name of an upstream target, e.g.
c(x = "prepared_x"). Each upstream target becomes a dependency of this target and is bound by that name in the step environment; under dynamic branching the per-branch slice is bound instead.- output
Output mode:
"object"(default) returns a converted R object,"file"returns a character vector of file paths (and defaultsformatto"file").- retrieve
Optional character vector of foreign-session variable names to return when no
post_scriptis supplied in object mode. One name returns that object; several return a named list.- files
Optional character vector of file paths to return when no
post_scriptis supplied in file mode.- julia_version
Optional Julia version to select (e.g.
"1.11"), used whenjulia_homeis not given; resolved to a juliaup-managed install. Forwarded torun_jl_step(). DefaultNULLuses the computer/global Julia.- julia_home, julia_project, julia_packages
Julia environment selection, forwarded to
run_jl_step().julia_homeis the directory containing the julia executable (defaults togetOption("tarpolyglot.julia_home"); when unset and nojulia_version, JuliaCall discovers Julia onPATH).julia_projectis a Julia project environment toPkg.activate().julia_packagesis a character vector of packages tousingbefore the script.- pattern
Optional targets dynamic-branching pattern as a language object (e.g.
quote(map(x))), forwarded totargets::tar_target_raw(). Thetarpolyglot_map()family is also accepted and behaves identically to the plaintargetspatterns here (they only differ on the Rust constructor).- packages, library
Character vectors of R packages (and library paths) to load for the target, forwarded to
targets::tar_target_raw().- deps, string
Advanced
targets::tar_target_raw()arguments: extra dependency names and a string used for change detection.- format, repository, iteration
Storage/iteration settings forwarded to
targets::tar_target_raw().formatdefaults to"file"whenoutput = "file", otherwise to thetargetsoption default.- error, memory, garbage_collection, deployment, priority, resources, storage, retrieval, cue, description
Standard
targets::tar_target_raw()execution/behaviour arguments, forwarded unchanged.
Details
All targets::tar_target_raw() arguments are forwarded unchanged, so dynamic branching (pattern), storage format, deployment, resources, cue, etc. all work as usual. Upstream targets are wired in through inputs, which become dependencies (and are sliced under dynamic branching).
Examples
if (FALSE) { # \dontrun{
tarpolyglot::tar_target_jl_raw(
name = "jl_sum",
script = "scripts/sum.jl",
inputs = c(x = "prepared_x"),
post_script = "scripts/post.R",
julia_packages = "Statistics"
)
} # }