### Set up GitHub Actions with tar_github_actions() Source: https://github.com/ropensci/targets/blob/main/README.md The tar_github_actions() function helps set up a pipeline to run automatically on GitHub Actions. A minimal example is available to demonstrate this setup. ```R tar_github_actions() ``` -------------------------------- ### Install targets package (Development - GitHub) Source: https://github.com/ropensci/targets/blob/main/README.md Install the development version of the targets package from GitHub using pak. ```r pak::pkg_install("ropensci/targets") ``` -------------------------------- ### Install targets package (Development - rOpenSci) Source: https://github.com/ropensci/targets/blob/main/README.md Install the development version of the targets package from the rOpenSci repository. ```r install.packages("targets", repos = "https://dev.ropensci.org") ``` -------------------------------- ### Package Installation Check Source: https://github.com/ropensci/targets/blob/main/NEWS.md Uses rlang::check_installed() inside assert_package() for more robust package installation checks. ```r rlang::check_installed("some_package") ``` -------------------------------- ### Reproducible Examples with tar_reprex Source: https://github.com/ropensci/targets/blob/main/NEWS.md Create reproducible examples of `targets` pipelines using the `tar_reprex()` function. This simplifies sharing and debugging pipeline issues. ```r tar_reprex() ``` -------------------------------- ### Install targets package (CRAN) Source: https://github.com/ropensci/targets/blob/main/README.md Install the latest release of the targets package from CRAN. ```r install.packages("targets") ``` -------------------------------- ### Get Target Configuration Source: https://github.com/ropensci/targets/blob/main/NEWS.md Retrieve configuration settings for targets. Deprecated 'seconds_interval' argument is replaced by 'seconds_meta' and 'seconds_reporter'. ```r tar_config_get() ``` -------------------------------- ### Install crew package Source: https://github.com/ropensci/targets/blob/main/README.md Install the crew package, recommended for distributed computing with targets version 0.4.0 or higher. ```r install.packages("crew") ``` -------------------------------- ### Initialize a new targets project with use_targets() Source: https://context7.com/ropensci/targets/llms.txt use_targets() creates a template _targets.R script to start a new targets project. It can be used to initialize the current project, overwrite existing scripts, or prevent automatic opening in an editor. ```r # Initialize targets for current project use_targets() # The function creates _targets.R with a template # Edit the file to customize your pipeline # Don't open in editor (e.g., for scripts) use_targets(open = FALSE) # Overwrite existing script use_targets(overwrite = TRUE) ``` -------------------------------- ### Get Data from Target Database Source: https://github.com/ropensci/targets/blob/main/NEWS.md Retrieve data from the target's database, with support for list columns. ```r database$get_data() ``` -------------------------------- ### Get Source Code for Debugging Source: https://github.com/ropensci/targets/blob/main/NEWS.md Use the 'file' argument and 'keep.source = TRUE' in tar_source() to aid in interactive debugging by preserving source code. ```r tar_source() ``` -------------------------------- ### Get Default Options with tar_option_get() Source: https://github.com/ropensci/targets/blob/main/NEWS.md Retrieve current default options for various tarchetypes settings. These defaults have been updated to improve efficiency and resource management. ```r tar_option_get("repository_meta") tar_option_get("storage") tar_option_get("retrieval") tar_option_get("memory") tar_option_get("garbage_collection") ``` -------------------------------- ### Lint Package Code Formatting Source: https://github.com/ropensci/targets/blob/main/CONTRIBUTING.md Use the `lint_package()` function from the `lintr` package to format your code according to the tidyverse style guide. ```r lint_package() ``` -------------------------------- ### Error for Target Names Starting with Dot Source: https://github.com/ropensci/targets/blob/main/NEWS.md Throws an informative error if a target name begins with a dot, enforcing naming conventions within the `targets` package. ```r # Throw an informative error if a target name starts with a dot ``` -------------------------------- ### Configure Project-Level Settings Source: https://github.com/ropensci/targets/blob/main/NEWS.md Support extra project-level configuration with _targets.yaml. Use tar_config_get() and tar_config_set() to interact with this file, currently supporting the 'store' field for data path customization. ```r tar_config_get("store") tar_config_set(store = "path/to/new/store") ``` -------------------------------- ### Run pipeline Source: https://github.com/ropensci/targets/blob/main/README.md Execute the pipeline using tar_make(). ```r tar_make() ``` -------------------------------- ### Run Overall Package Checks Source: https://github.com/ropensci/targets/blob/main/CONTRIBUTING.md Execute `devtools::check()` and `goodpractice::gp()` to perform overall package checks before submitting your contribution. ```r devtools::check() ``` ```r goodpractice::gp() ``` -------------------------------- ### Writing .gitignore for _targets/meta/ Source: https://github.com/ropensci/targets/blob/main/NEWS.md A `.gitignore` file is written to the `_targets/meta/` directory to ensure only essential meta files are tracked. ```bash echo "# Ignore all files except .gitignore and meta." > _targets/meta/.gitignore echo "*" >> _targets/meta/.gitignore echo "!/.gitignore" >> _targets/meta/.gitignore echo "!/meta" >> _targets/meta/.gitignore ``` -------------------------------- ### Support New Storage Formats Source: https://github.com/ropensci/targets/blob/main/NEWS.md The targets package now supports 'feather', 'parquet', 'aws_feather', and 'aws_parquet' storage formats for data serialization. ```r tar_option_set(format = "parquet") ``` -------------------------------- ### Anticipate Loading/Saving Targets from Other Languages Source: https://github.com/ropensci/targets/blob/main/NEWS.md Set `retrieval = "none"` and `storage = "none"` to prepare for loading or saving targets from languages other than R, such as Julia. This is particularly useful when `storage = "none"` is employed. ```R tar_target(name = my_data, command = read_data(), retrieval = "none", storage = "none") ``` -------------------------------- ### Replacing TAR_MAKE_REPORTER with tar_config_get("reporter_make") Source: https://github.com/ropensci/targets/blob/main/NEWS.md Configuration for the make reporter is now managed through `tar_config_get()` instead of the `TAR_MAKE_REPORTER` environment variable. ```R tar_config_get("reporter_make") ``` -------------------------------- ### Get Current Targets Function with tar_call Source: https://github.com/ropensci/targets/blob/main/NEWS.md The `tar_call()` function returns the `targets` function currently executing. This is useful for introspection within pipeline scripts or target definitions. ```r tar_call() ``` -------------------------------- ### tar_make - Run the pipeline Source: https://context7.com/ropensci/targets/llms.txt Runs the pipeline defined in the target script file. It executes targets in the correct order, skips up-to-date targets, and stores return values in the `_targets/objects/` folder. ```APIDOC ## tar_make - Run the pipeline ### Description Runs the pipeline defined in the target script file. It executes targets in the correct order, skips up-to-date targets, and stores return values in the `_targets/objects/` folder. ### Method `tar_make()` ### Parameters #### Arguments - **names** (character vector, optional) - Specific targets to run (and their dependencies). - **reporter** (character, optional) - The reporting style (e.g., "verbose", "timestamp"). - **callr_function** (function, optional) - Function to use for running targets (defaults to `callr::run`). Set to `NULL` to run in the current session. - **controller** (crew controller object, optional) - For distributed computing. ### Request Example ```r # Run all targets tar_make() # Run specific targets and their dependencies tar_make(names = c(model, predictions)) # Run targets matching a pattern tar_make(names = starts_with("data")) # Run with verbose reporter for detailed output tar_make(reporter = "verbose") # Run with timestamp reporter tar_make(reporter = "timestamp") # Run in the current R session (useful for debugging) tar_make(callr_function = NULL) # Distributed computing with crew tar_script({ library(targets) tar_option_set(controller = crew::controller_local(workers = 4)) list( tar_target(a, slow_function(1)), tar_target(b, slow_function(2)), tar_target(c, slow_function(3)), tar_target(d, combine(a, b, c)) ) }) tar_make() ``` ``` -------------------------------- ### Get Last Modified Timestamp of Target Data Source: https://github.com/ropensci/targets/blob/main/NEWS.md Use tar_timestamp() and tar_timestamp_raw() to retrieve the last modified timestamp of a target's data. Useful for tracking data freshness. ```r tar_timestamp() tar_timestamp_raw() ``` -------------------------------- ### Initialize Targets Pipeline Source: https://github.com/ropensci/targets/blob/main/NEWS.md Initialize a new targets pipeline using use_targets(). Suggests a crew controller for managing distributed tasks. ```r use_targets() ``` -------------------------------- ### Get Pipeline Store Path with tar_store Source: https://github.com/ropensci/targets/blob/main/NEWS.md Retrieve the path to the `targets` pipeline's storage directory using `tar_store()`. This function is useful for accessing pipeline artifacts or configuration. ```r tar_store() ``` -------------------------------- ### Get Current Target Definition with tar_definition() Source: https://github.com/ropensci/targets/blob/main/NEWS.md Use `tar_definition()` within a running target's pipeline to retrieve its target definition object. This function is helpful for inspecting or manipulating the target's properties during execution. ```R tar_target(name = my_target, command = { tar_definition() }) ``` -------------------------------- ### Run Target Pipeline with Future Source: https://github.com/ropensci/targets/blob/main/NEWS.md Execute the target pipeline using the Future backend. The 'seconds_interval' argument is deprecated and replaced by 'seconds_meta' and 'seconds_reporter'. ```r tar_make_future() ``` -------------------------------- ### Control tar_watch() Display Arguments Source: https://github.com/ropensci/targets/blob/main/NEWS.md Expose arguments display and displays to tar_watch() so the user can select which display shows first. Make "summary" the default display instead of "graph". ```r tar_watch(display = "summary") ``` -------------------------------- ### List Targets by Progress Category Source: https://github.com/ropensci/targets/blob/main/NEWS.md New helper functions `tar_started()`, `tar_skipped()`, `tar_built()`, `tar_canceled()`, and `tar_errored()` provide ways to list targets based on their current progress status in the pipeline. ```R tar_built() ``` ```R tar_errored() ``` -------------------------------- ### Configure GCP Resources Source: https://github.com/ropensci/targets/blob/main/NEWS.md Configure Google Cloud Platform resources with a 'max_tries' argument for retrying operations. ```r tar_resources_gcp() ``` -------------------------------- ### Specify Resources with tar_resources_future() and plan Source: https://github.com/ropensci/targets/blob/main/NEWS.md It is recommended to use `plan` within `tar_resources_future()` to specify resources for parallel execution. This provides a clear and organized way to manage computational resources. ```R tar_resources_future(plan = future::multisession) ``` -------------------------------- ### Upload Workspaces to Cloud Storage Source: https://github.com/ropensci/targets/blob/main/NEWS.md Upload local workspaces to cloud storage (AWS or GCP) when repository_meta is set to 'aws' or 'gcp'. Use tar_workspace_download() to retrieve them and tar_destroy() to remove them from the cloud. ```r tar_option_set(repository_meta = "aws") tar_workspace_upload() tar_workspace_download() tar_destroy(destroy = "all") tar_destroy(destroy = "cloud") ``` -------------------------------- ### Skip Parts of Pipeline with shortcut Argument Source: https://github.com/ropensci/targets/blob/main/NEWS.md Add a shortcut argument to tar_make(), tar_make_clustermq(), tar_make_future(), tar_outdated(), and tar_sitrep() to more efficiently skip parts of the pipeline. ```r tar_make(shortcut = TRUE) ``` -------------------------------- ### Configure URL Resources Source: https://github.com/ropensci/targets/blob/main/NEWS.md Configure resources for URL-based targets, including deprecated arguments like 'seconds_interval' and 'seconds_timeout'. ```r tar_resources_url() ``` -------------------------------- ### Configure AWS Resources Source: https://github.com/ropensci/targets/blob/main/NEWS.md Configure AWS resources with arguments for timeout, connection closing, and S3 path style. Supports analogous arguments in paws.storage::s3(). ```r tar_resources_aws( seconds_timeout = 600, close_connection = TRUE, s3_force_path_style = TRUE ) ``` -------------------------------- ### Run the Pipeline with tar_make() Source: https://context7.com/ropensci/targets/llms.txt Use tar_make() to execute the pipeline defined in the target script. It runs targets in order, skips up-to-date ones, and stores results. Supports running specific targets, patterns, different reporters, and local debugging. ```r # Run all targets tar_make() ``` ```r # Run specific targets and their dependencies tar_make(names = c(model, predictions)) ``` ```r # Run targets matching a pattern tar_make(names = starts_with("data")) ``` ```r # Run with verbose reporter for detailed output tar_make(reporter = "verbose") ``` ```r # Run with timestamp reporter tar_make(reporter = "timestamp") ``` ```r # Run in the current R session (useful for debugging) tar_make(callr_function = NULL) ``` ```r # Distributed computing with crew tar_script({ library(targets) tar_option_set(controller = crew::controller_local(workers = 4)) list( tar_target(a, slow_function(1)), tar_target(b, slow_function(2)), tar_target(c, slow_function(3)), tar_target(d, combine(a, b, c)) ) }) tar_make() ``` -------------------------------- ### tar_script - Write a target script file Source: https://context7.com/ropensci/targets/llms.txt Creates the required `_targets.R` script file that defines and configures the pipeline. This file is executed by `tar_make()` and related functions to build the pipeline definition. ```APIDOC ## tar_script - Write a target script file ### Description Creates the required `_targets.R` script file that defines and configures the pipeline. This file is executed by `tar_make()` and related functions to build the pipeline definition. ### Method `tar_script()` ### Parameters #### Arguments - **script** (expression) - The R code to write to the script file. - **name** (character, optional) - The name of the script file (defaults to `_targets.R`). - **ask** (logical, optional) - Whether to ask for confirmation before overwriting (defaults to `TRUE`). ### Request Example ```r # Write a basic target script tar_script({ library(targets) list( tar_target(data, read.csv("data.csv")), tar_target(summary, summary(data)), tar_target(model, lm(y ~ x, data = data)) ) }) # Write a more complete target script with options tar_script({ library(targets) library(tarchetypes) # Load custom functions source("R/functions.R") # Set global options tar_option_set( packages = c("dplyr", "ggplot2"), format = "qs" ) # Define pipeline list( tar_target(raw_data, load_data("data/input.csv")), tar_target(clean_data, clean(raw_data)), tar_target(model, fit_model(clean_data)), tar_target(predictions, predict(model, clean_data)), tar_target(report, create_report(predictions), format = "file") ) }, ask = FALSE) # The script is written to _targets.R by default cat(readLines("_targets.R"), sep = "\n") ``` ``` -------------------------------- ### Run Target Pipeline with ClusterMQ Source: https://github.com/ropensci/targets/blob/main/NEWS.md Execute the target pipeline using the ClusterMQ backend. The 'seconds_interval' argument is deprecated and replaced by 'seconds_meta' and 'seconds_reporter'. ```r tar_make_clustermq() ``` -------------------------------- ### Enabling priorities in tar_make() and tar_manifest() Source: https://github.com/ropensci/targets/blob/main/NEWS.md Priorities can now be specified in `tar_make()` and `tar_manifest()` to control the order of target execution. ```R tar_make(priority = ...) ``` ```R tar_manifest(priority = ...) ``` -------------------------------- ### Specify Custom Paths for Script and Store in tar_target() Source: https://github.com/ropensci/targets/blob/main/NEWS.md Choose custom paths for the target script file and data store for individual function calls using the 'script' and 'store' arguments. ```r tar_target(name, command, script = "path/to/script.R", store = "path/to/store") ``` -------------------------------- ### Handle Missing Target Name or Command Source: https://github.com/ropensci/targets/blob/main/NEWS.md The package now throws informative error messages when a target's name or command is missing, improving debugging. ```r # Example of a missing command (will throw an error) tar_target(name = my_target) ``` -------------------------------- ### Visualize dependency graph with tar_visnetwork Source: https://context7.com/ropensci/targets/llms.txt Creates an interactive HTML visualization of the pipeline's dependency graph using the visNetwork package. Colors indicate target status. Supports filtering, including labels, highlighting outdated targets, excluding nodes, and controlling graph layout. ```r # Basic visualization tar_visnetwork() ``` ```r # Show only targets (hide functions and globals) tar_visnetwork(targets_only = TRUE) ``` ```r # Filter to specific targets and their dependencies tar_visnetwork(names = starts_with("model")) ``` ```r # Include labels with runtime and storage info tar_visnetwork(label = c("description", "time", "size")) ``` ```r # Show outdated targets highlighted tar_visnetwork(outdated = TRUE) ``` ```r # Exclude certain nodes from the graph tar_visnetwork(exclude = c(".Random.seed", "internal_helper")) ``` ```r # Control graph layout tar_visnetwork( level_separation = 200, physics = TRUE, degree_from = 2, degree_to = 2 ) ``` -------------------------------- ### Set Alternative YAML Configuration Path Source: https://github.com/ropensci/targets/blob/main/NEWS.md Allow users to set an alternative path to the YAML configuration file for the current R session. This is for niche applications like Shiny apps with targets backends. ```r tar_config_set(config_path = "path/to/your/_targets.yaml") ``` -------------------------------- ### Write a Target Script File with tar_script() Source: https://context7.com/ropensci/targets/llms.txt Use tar_script() to create the _targets.R script file that defines and configures your pipeline. This file is executed by tar_make() and related functions. Supports setting global options like packages and format. ```r # Write a basic target script tar_script({ library(targets) list( tar_target(data, read.csv("data.csv")), tar_target(summary, summary(data)), tar_target(model, lm(y ~ x, data = data)) ) }) ``` ```r # Write a more complete target script with options tar_script({ library(targets) library(tarchetypes) # Load custom functions source("R/functions.R") # Set global options tar_option_set( packages = c("dplyr", "ggplot2"), format = "qs" ) # Define pipeline list( tar_target(raw_data, load_data("data/input.csv")), tar_target(clean_data, clean(raw_data)), tar_target(model, fit_model(clean_data)), tar_target(predictions, predict(model, clean_data)), tar_target(report, create_report(predictions), format = "file") ) }, ask = FALSE) # The script is written to _targets.R by default cat(readLines("_targets.R"), sep = "\n") ``` -------------------------------- ### Create Quarto Documents Source: https://github.com/ropensci/targets/blob/main/NEWS.md Create Quarto documents using tar_quarto, a literate programming target factory. This function is an exception to the rule disallowing access to the local data store during pipeline execution. ```r tar_quarto() ``` -------------------------------- ### Set Target Configuration Source: https://github.com/ropensci/targets/blob/main/NEWS.md Set configuration options for targets, including default 'label' and 'level_separation'. ```r tar_config_set() ``` -------------------------------- ### Check pipeline visualization Source: https://github.com/ropensci/targets/blob/main/README.md Visualize the pipeline structure using tar_visnetwork(). ```r tar_visnetwork() ``` -------------------------------- ### Load targets into environment with tar_load Source: https://context7.com/ropensci/targets/llms.txt Loads target return values into the current or a specified environment. Useful for interactive exploration of pipeline results. Supports loading single, multiple, or all targets, with options for environment specification and error handling. ```r # Load a single target tar_load(model) print(model) ``` ```r # Load multiple targets with tidyselect tar_load(c(data, model, predictions)) ``` ```r # Load all targets starting with "clean" tar_load(starts_with("clean")) ``` ```r # Load all targets tar_load(everything()) # Or equivalently tar_load_everything() ``` ```r # Load into a specific environment my_env <- new.env() tar_load(model, envir = my_env) print(my_env$model) ``` ```r # Silently skip targets that fail to load tar_load(everything(), strict = FALSE, silent = TRUE) ``` -------------------------------- ### Detect RStudio Addin Usage Source: https://github.com/ropensci/targets/blob/main/NEWS.md A warning is now thrown if devtools::load_all() or similar functions are detected within _targets.R, helping to prevent unexpected behavior. ```r # Warning triggered if devtools::load_all() is used in _targets.R ``` -------------------------------- ### Control Neighborhood Highlighting in tar_glimpse() Source: https://github.com/ropensci/targets/blob/main/NEWS.md Highlight a graph neighborhood when a user clicks a node. Control the neighborhood degree with new arguments degree_from and degree_to of tar_glimpse(). ```r tar_glimpse(degree_from = 0, degree_to = 1) ``` -------------------------------- ### New Balanced Reporter Source: https://github.com/ropensci/targets/blob/main/NEWS.md Creates a new 'balanced' reporter that utilizes a cli progress bar for better progress visualization during pipeline execution. ```r tar_reporter_balanced() ``` -------------------------------- ### Queue Operations in targets Source: https://github.com/ropensci/targets/blob/main/NEWS.md The queue$enqueue() function has been renamed to queue$prepend() and now consistently appends to the front of the queue. ```r queue$prepend() ``` -------------------------------- ### Select Active Project with TAR_PROJECT Source: https://github.com/ropensci/targets/blob/main/NEWS.md The `TAR_PROJECT` environment variable allows selection of the currently active project when the YAML configuration file supports multiple projects. This is part of a restructured configuration format. ```R Sys.setenv(TAR_PROJECT = "my_project") ``` -------------------------------- ### Define Resources for tar_target() Source: https://github.com/ropensci/targets/blob/main/NEWS.md Add structure to the resources argument of tar_target() to avoid conflicts among formats and HPC backends. Use helper functions like tar_resources() and tar_resources_aws() to build the required data structures. ```r tar_target(name, command, resources = tar_resources(aws = tar_resources_aws(bucket = "my-bucket"))) ``` -------------------------------- ### Custom Storage Format with tar_format Source: https://github.com/ropensci/targets/blob/main/NEWS.md Use `tar_format()` to define entirely custom storage formats for targets. This allows for advanced control over how target data is stored and retrieved. ```r tar_target(format = tar_format(...)) ``` -------------------------------- ### Set global target options with tar_option_set Source: https://context7.com/ropensci/targets/llms.txt Sets default arguments for tar_target() and configures pipeline-wide settings. Call it in _targets.R before defining targets. Supports configuration of packages, storage format, error handling, parallel computing, imports, workspace saving, and garbage collection. ```r tar_script({ library(targets) # Set default packages for all targets tar_option_set(packages = c("dplyr", "tidyr", "ggplot2")) # Set default storage format tar_option_set(format = "qs") # Fast serialization # Configure error handling tar_option_set(error = "continue") # Keep going on errors # Configure parallel computing with crew tar_option_set(controller = crew::controller_local(workers = 4)) # Track dependencies from a custom package tar_option_set(imports = "myAnalysisPackage") # Set workspace saving for debugging tar_option_set(workspace_on_error = TRUE) # Configure garbage collection tar_option_set(garbage_collection = 10) # Run gc() every 10 targets # Full example tar_option_set( packages = c("dplyr", "ggplot2"), format = "qs", error = "continue", memory = "transient", garbage_collection = 5, workspace_on_error = TRUE ) list( tar_target(data, load_data()), tar_target(model, fit_model(data)) ) }) ``` -------------------------------- ### Configure Reporter and Worker Defaults in _targets.yaml Source: https://github.com/ropensci/targets/blob/main/NEWS.md Add new _targets.yaml config options reporter_make, reporter_outdated, and workers to control function argument defaults shared across multiple functions called outside _targets.R. ```yaml reporter: "summary" workers: 4 ``` -------------------------------- ### Load Targets with Strict and Silent Options Source: https://github.com/ropensci/targets/blob/main/NEWS.md Control the behavior of `tar_load()` and `tar_load_raw()` with `strict` and `silent` arguments. These allow bypassing targets that cannot be loaded, offering more flexibility in data retrieval. ```r tar_load(strict = TRUE, silent = FALSE) ``` ```r tar_load_raw(strict = FALSE, silent = TRUE) ``` -------------------------------- ### Feather and Parquet Formats with RecordBatch and Table Source: https://github.com/ropensci/targets/blob/main/NEWS.md Feather and Parquet formats now accept objects of class `RecordBatch` and `Table`. This enhancement improves interoperability with data manipulation libraries. ```R tar_target(name = my_table, command = as_record_batch(my_data), format = "parquet") ``` -------------------------------- ### Allow Destroying Processes Source: https://github.com/ropensci/targets/blob/main/NEWS.md The tar_destroy() function now accepts 'process' as a value for the 'destroy' argument, allowing for targeted cleanup. ```r tar_destroy(destroy = "process") ``` -------------------------------- ### Add tar_option_with() Function Source: https://github.com/ropensci/targets/blob/main/NEWS.md Introduces the tar_option_with() function, likely for managing options within specific contexts or with certain conditions. ```r tar_option_with() ``` -------------------------------- ### Using eval(parse(text = readLines(...))) instead of source() Source: https://github.com/ropensci/targets/blob/main/NEWS.md This approach offers more control over evaluation compared to `source()`. An `envir` argument is available for further control when `callr_function` is `NULL`. ```R eval(parse(text = readLines("_targets.R")), envir = some_envir) ``` -------------------------------- ### Control Neighborhood Highlighting in tar_visnetwork() Source: https://github.com/ropensci/targets/blob/main/NEWS.md Highlight a graph neighborhood when a user clicks a node. Control the neighborhood degree with new arguments degree_from and degree_to of tar_visnetwork(). ```r tar_visnetwork(degree_from = 1, degree_to = 2) ``` -------------------------------- ### Summarize Pipeline Progress Source: https://github.com/ropensci/targets/blob/main/NEWS.md Use tar_progress_summary() to compactly summarize the progress of all targets in the pipeline. Provides a quick overview of the pipeline's status. ```r tar_progress_summary() ``` -------------------------------- ### Handle NA Buckets in Cloud Storage Deletion Source: https://github.com/ropensci/targets/blob/main/NEWS.md Implements error handling for NA buckets in store_delete_objects.tar_aws() and store_delete_objects.tar_gcp() to prevent issues during cloud object deletion. ```r store_delete_objects.tar_aws(bucket = NA) store_delete_objects.tar_gcp(bucket = NA) ``` -------------------------------- ### Set Default Options with tar_option_set() Source: https://github.com/ropensci/targets/blob/main/NEWS.md Configure default options for tarchetypes. The 'balanced' reporter is now the default for tar_make() and tar_outdated(). ```r tar_option_set(reporter = "balanced") ``` -------------------------------- ### Document RNG Seed Generation Source: https://github.com/ropensci/targets/blob/main/NEWS.md RNG seed generation is now documented for tar_target_raw(), tar_meta(), and tar_seed(), providing clarity on reproducibility. ```r # Documentation added for RNG seed generation ``` -------------------------------- ### Manage Environment Variables in targets Source: https://github.com/ropensci/targets/blob/main/NEWS.md Use tar_envvar() to list values of special environment variables supported by the targets package. Consult the help file for detailed explanations of each variable. ```r tar_envvar() ``` -------------------------------- ### Load Globals for Debugging with tar_load_globals() Source: https://github.com/ropensci/targets/blob/main/NEWS.md Use tar_load_globals() for debugging, testing, prototyping, and teaching to load global objects into the current R session. ```r tar_load_globals(names = c("obj1", "obj2")) ``` -------------------------------- ### Render Markdown Files Source: https://github.com/ropensci/targets/blob/main/NEWS.md Render markdown files using tar_render, a literate programming target factory. This function is an exception to the rule disallowing access to the local data store during pipeline execution. ```r tar_render() ``` -------------------------------- ### Exponential Backoff for Priority Queue Source: https://github.com/ropensci/targets/blob/main/NEWS.md An exponential backoff algorithm is implemented for polling the priority queue in tar_make_clustermq() and tar_make_future(), improving efficiency. ```r # Exponential backoff is automatically applied in tar_make_clustermq() and tar_make_future() ``` -------------------------------- ### Namespace Call in tar_test Source: https://github.com/ropensci/targets/blob/main/NEWS.md Demonstrates the use of a namespaced call to `tar_dir()` within `tar_test()`, ensuring proper function resolution in testing environments. ```r tar_test(tar_dir()) ``` -------------------------------- ### Ensuring metadata loading for label computation Source: https://github.com/ropensci/targets/blob/main/NEWS.md Metadata is now loaded correctly to compute labels when `outdated = FALSE` in `tar_visnetwork()`, resolving an issue with outdated graph visualizations. ```R tar_visnetwork(outdated = FALSE) ``` -------------------------------- ### Read pipeline metadata with tar_meta() Source: https://context7.com/ropensci/targets/llms.txt Use tar_meta() to retrieve metadata for completed targets. Filter by name, select specific fields, or retrieve only target-specific metadata. Useful for analyzing execution times, file sizes, and errors. ```r # Get all metadata meta <- tar_meta() # Filter to specific targets tar_meta(names = c(data, model)) # Select specific fields tar_meta(fields = c(name, seconds, bytes, error)) # Get only target metadata (exclude functions and globals) tar_meta(targets_only = TRUE) # Get only complete rows tar_meta(complete_only = TRUE) # Useful metadata queries # Find slow targets meta <- tar_meta(fields = c(name, seconds)) meta[order(-meta$seconds), ] # Find large targets meta <- tar_meta(fields = c(name, bytes)) meta[order(-meta$bytes), ] # Find errored targets meta <- tar_meta(fields = c(name, error)) meta[!is.na(meta$error), ] ``` -------------------------------- ### Detect Running Local Pipelines Source: https://github.com/ropensci/targets/blob/main/NEWS.md An early and informative error is thrown from `tar_make()` if another `targets` pipeline is already running on the same local data store. This is detected using `tar_process()` which checks the process ID and timestamp. ```r tar_process() ``` -------------------------------- ### Configure Target Cues for Seed Behavior Source: https://github.com/ropensci/targets/blob/main/NEWS.md To avoid rerunning your entire pipeline after an upgrade that invalidates targets due to seed generation changes, set `cue = tar_cue(seed = FALSE)` in `tar_target()`. ```r tar_cue(seed = FALSE) ``` -------------------------------- ### Suppress tar_destroy() Prompt with TAR_ASK Source: https://github.com/ropensci/targets/blob/main/NEWS.md Add a menu prompt to tar_destroy() which can be suppressed with TAR_ASK = "false". ```r tar_destroy(ask = "false") ``` -------------------------------- ### Clean up data store with tar_destroy() Source: https://context7.com/ropensci/targets/llms.txt Use tar_destroy() to remove the data store ('_targets/' folder) or specific parts of it. Options include destroying local files, metadata, objects, progress, workspaces, or cloud data. ```r # Destroy everything (full reset) tar_destroy() # Destroy only local files, keep cloud data tar_destroy(destroy = "local") # Destroy only metadata (forces all targets to rerun) tar_destroy(destroy = "meta") # Destroy only target objects (keep metadata) tar_destroy(destroy = "objects") # Destroy progress tracking tar_destroy(destroy = "progress") # Destroy saved workspaces tar_destroy(destroy = "workspaces") # Destroy cloud data tar_destroy(destroy = "cloud") ``` -------------------------------- ### Inspect pipeline definition with tar_manifest Source: https://context7.com/ropensci/targets/llms.txt Returns a data frame with information about all targets defined in the pipeline. Useful for reviewing the pipeline structure without running it. Supports selecting specific columns, filtering to specific targets, viewing cue settings, and viewing all fields. ```r # Get full manifest manifest <- tar_manifest() print(manifest) ``` ```r # Select specific columns tar_manifest(fields = c(name, command, pattern)) ``` ```r # Filter to specific targets tar_manifest(names = starts_with("model")) ``` ```r # View cue settings tar_manifest(fields = starts_with("cue")) ``` ```r # View all fields tar_manifest(fields = everything(), drop_missing = FALSE) ``` -------------------------------- ### Visualize Pipeline Progress with tar_watch() Source: https://github.com/ropensci/targets/blob/main/README.md Use tar_watch() to launch a built-in Shiny app for visualizing pipeline progress while it is running. It can also be used as a Shiny module via tar_watch_ui() and tar_watch_server(). ```R tar_watch() ``` ```R tar_watch_ui() ``` ```R tar_watch_server() ``` -------------------------------- ### Set Global Reporter for tar_make* Functions Source: https://github.com/ropensci/targets/blob/main/NEWS.md The TAR_MAKE_REPORTER environment variable can be used to globally set the reporter for tar_make() and tar_make_clustermq(). ```r # Set environment variable globally Sys.setenv(TAR_MAKE_REPORTER = "silent") ``` -------------------------------- ### Generate Target Seeds with SHA3 Source: https://github.com/ropensci/targets/blob/main/NEWS.md In `tar_seed_create()`, `secretbase::sha3()` is used to generate target seeds, offering better resistance to overlapping RNG streams compared to the previous `digest::digest()` and `digets::digest2int()` combination. ```r secretbase::sha3(x = TARGET_NAME, bits = 32L, convert = NA) ``` ```r digest::digest(algo = "sha512") ``` ```r digets::digest2int() ``` -------------------------------- ### Run targets Pipeline as an RStudio Job Source: https://github.com/ropensci/targets/blob/main/NEWS.md The `tar_make()` function now includes an `as_job` argument, allowing you to optionally run a `targets` pipeline as an RStudio job. ```r tar_make(as_job = TRUE) ``` -------------------------------- ### Configure Target Script Path in tar_config_set() Source: https://github.com/ropensci/targets/blob/main/NEWS.md Set the target script path using tar_config_set(). This is useful for custom pipeline configurations. ```r tar_config_set(script = "path/to/your/_targets.R") ``` -------------------------------- ### File Assertion with tar_assert_file Source: https://github.com/ropensci/targets/blob/main/NEWS.md Implement file assertions using `tar_assert_file()`. This function is useful for validating the existence or properties of files within your pipeline. ```r tar_assert_file() ``` -------------------------------- ### Returning correct error messages from feather and parquet formats Source: https://github.com/ropensci/targets/blob/main/NEWS.md Ensures correct error messages are returned from feather and parquet formats by calling `assert_df()` from `store_assert_format()`. ```R assert_df() from store_assert_format() ``` -------------------------------- ### Set Default Configuration File Path with TAR_CONFIG Source: https://github.com/ropensci/targets/blob/main/NEWS.md The `TAR_CONFIG` environment variable specifies the default file path for the YAML configuration file. If not set, it defaults to `_targets.yaml`. ```R Sys.setenv(TAR_CONFIG = "path/to/your/_targets.yaml") ``` -------------------------------- ### Retrying writing lines to database files Source: https://github.com/ropensci/targets/blob/main/NEWS.md Improves reliability for `tar_poll()` on Windows by retrying writing lines to database files, allowing concurrent pipeline runs. ```R Retry writing lines to database files ``` -------------------------------- ### RStudio Addin Fix Source: https://github.com/ropensci/targets/blob/main/NEWS.md The 'write target at cursor' RStudio addin has been fixed and now correctly positions the cursor between the parentheses. ```r # RStudio addin 'write target at cursor' is now fixed. ``` -------------------------------- ### Update igraph Dependency Source: https://github.com/ropensci/targets/blob/main/NEWS.md The minimum required `igraph` version has been bumped to 2.0.0 because `igraph::get.edgelist()` was deprecated in favor of `igraph::as_edgelist()`. ```r igraph::as_edgelist() ``` -------------------------------- ### Hash Dependencies Source: https://github.com/ropensci/targets/blob/main/NEWS.md Hash dependencies using a custom sort_chr() function that temporarily sets LC_COLLATE to "C" for consistent lexicographical comparisons across platforms. ```r hash_deps() ``` -------------------------------- ### Handle Dynamic Targets with Group Iteration Source: https://github.com/ropensci/targets/blob/main/NEWS.md An assertion in `tar_target_raw()` prevents users from using `iteration = "group"` with dynamic targets (those using `pattern = map(...)`). This clarifies that group iteration is not valid for dynamic targets. ```r tar_target_raw(..., iteration = "group") ``` -------------------------------- ### Conditional Command Line Spinner Source: https://github.com/ropensci/targets/blob/main/NEWS.md A command line spinner is only shown if the reporter is set to 'silent', reducing console clutter. ```r tar_option_set(reporter = "silent") ``` -------------------------------- ### New tar_auto() Store Read Path Source: https://github.com/ropensci/targets/blob/main/NEWS.md Adds the store_read_path.tar_auto() function, potentially for handling reading data from automatically determined storage formats. ```r store_read_path.tar_auto() ``` -------------------------------- ### Update Cloud Storage Hashing Strategy Source: https://github.com/ropensci/targets/blob/main/NEWS.md For cloud storage, targets now uses the ETag for AWS S3 and the MD5 hash for GCP GCS, sanitizing with `targets:::digest_chr64()`. This ensures the hash in metadata matches the current object in the bucket, meaning pipelines will be up-to-date with the newest cloud object versions. ```r targets:::digest_chr64() ``` -------------------------------- ### Asserting command length in tar_target_raw() Source: https://github.com/ropensci/targets/blob/main/NEWS.md In `tar_target_raw()`, an assertion is added to ensure commands have a length of 1 when converted to expressions. ```R tar_target_raw(..., command = 1) ```