Skip to contents

Get and set methods for the Target S4 class.

Usage

name(x)

# S4 method for Target
name(x)

name(x) <- value

# S4 method for Target
name(x) <- value

command(x)

# S4 method for Target
command(x)

command(x) <- value

# S4 method for Target
command(x) <- value

type(x)

# S4 method for Target
type(x)

type(x) <- value

# S4 method for Target
type(x) <- value

args(x)

# S4 method for Target
args(x)

args(x) <- value

# S4 method for Target
args(x) <- value

comment(x)

# S4 method for Target
comment(x)

comment(x) <- value

# S4 method for Target
comment(x) <- value

code(x)

# S4 method for Target
code(x)

Arguments

x

S4 object of class Target

value

value to set

Examples

workflow_target <- target('a_target',
                          1 + 1,
                          args = list(memory = 'persistent'), 
                          comment = 'A target')

## Return the target name
name(workflow_target)
#> [1] "a_target"

## Set the target name
name(workflow_target) <- 'a_new_name'

## Return the target R code
command(workflow_target)
#> [[1]]
#> 1 + 1
#> 

## Set the target R code
command(workflow_target) <- rlang::expr(1 * 2)

## Return the target type
type(workflow_target)
#> [1] "tar_target"

## Set the target type
type(workflow_target) <- 'tarchetypes::tar_file'

## Return the list target arguments
args(workflow_target)
#> $memory
#> [1] "persistent"
#> 

## Set the target arguments
args(workflow_target) <- list(error = 'continue')

## Return the target comment
comment(workflow_target)
#> [1] "A target"

## Set the workflow comment
comment(workflow_target) <- 'A new comment'