MyNixOS website logo
Description

Make Your 'targets' Pipelines into a Package.

Runs 'targets' pipeline in '/inst/tarchives' and stores the results in the R user directory. This means that the user does not have to run the process repeatedly, and the developer has the flexibility to update the data as versions are updated.

tarchives

R-CMD-check CRANstatus Codecov testcoverage RTargetopia Lifecycle:experimental

Overview

The goal of tarchives is to make targets pipelines into a package. It runs targets pipeline in /inst/tarchives and stores the results in the R user directory. This means that the user does not have to run the process repeatedly, and the developer has the flexibility to update the data as versions are updated.

This package is a wrapper for the targets package and contains the following functions:

  • tar_archive(): Convert the targets function to tarchives version
  • tar_make_archive(): tarchives version of targets::tar_make() function
  • tar_read_archive(): tarchives version of targets::tar_read() function
  • tar_target_archive(): tarchives version of targets::tar_target() function

Installation

install.packages("tarchives")

Development version

You can install the development version of tarchives from GitHub with:

install.packages("pak")
pak::pak("UchidaMizuki/tarchives")

Usage

To use tarchives, run the following code under the package you are developing:

library(tarchives)
use_tarchives()

This will create an inst/tarchives directory in your package, where your target pipelines will be stored. You can define your target pipeline in the _targets.R file in the inst/tarchives/example-model directory as follows:

# inst/tarchives/example-model/_targets.R
library(targets)

list(
  tar_target(
    data,
    iris[iris$Species != "setosa", ]
  ),
  tar_target(
    model,
    lm(Sepal.Width ~ Sepal.Length, data)
  )
)

If you have created a package called your-package and saved the pipeline to a directory called example-model in the inst/tarchives directory, you can run it using the following command:

tar_make_archive(
  package = "your-package",
  pipeline = "example-model"
)

Then you can read the results using the tar_read_archive() function:

tar_read_archive(
  model,
  package = "your-package",
  pipeline = "your-pipeline"
)
#> 
#> Call:
#> lm(formula = Sepal.Width ~ Sepal.Length, data = data)
#> 
#> Coefficients:
#>  (Intercept)  Sepal.Length  
#>        1.131         0.278

Declare a target from another pipeline

You can also declare a target from another pipeline using the tar_target_archive() function. For example, if you want to declare the data and model targets from the example-model pipeline in your _targets.R file, you can do it as follows:

library(targets)

tar_source()

list(
  tarchives::tar_target_archive(
    data,
    package = "tarchives",
    pipeline = "example-model"
  ),
  tarchives::tar_target_archive(
    model,
    package = "tarchives",
    pipeline = "example-model"
  )
)
Metadata

Version

0.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows