skip_scope: Exclude a function from find_scope

Description Usage Arguments Details Value Examples

View source: R/skip_scope.R

Description

In the course of work it will often be the case that one would like to create a new condition function, such such as for specific errors or warning. These should not be included in the scope when inferred. The natural solution would be to include the scope in every call to condition or have it inferred in each function definition. This however, gets very tedious.

Usage

1

Arguments

fun

a function to tag

Details

The skip_scope function tags a function as one that should be excluded from consideration when determining scope via find_scope().

Value

The fun function with the skipscope attribute set to TRUE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
new_msg <- function(where=find_scope()){
    "Hello from" %<<% where
}
new_postcard <- function(msg){
    greeting <- new_msg()
    paste0(greeting, '\n\n', msg)
}

cat(new_postcard("Not all is well"), '\n')
new_msg <- skip_scope(new_msg)

cat(new_postcard("Now all is well"))

RDocTaskForce/pkgcond documentation built on May 3, 2021, 9:42 a.m.