Echo Code Evaluations

Capture code evaluations and script executions by expressions, outputs, and condition calls for logging.


echo

Lifecycle:experimental

R-CMD-check Codecov testcoverage

The goal of {echo} is to provide a function for evaluating and logging a script.

Installation

Install {echo} from CRAN with:

install.packages("echo")

Alternatively, you can install the development version of {echo} GitHub with:

# install.packages("devtools")
devtools::install_github("jmbarbone/echo")

Example

echo() allows you to print

library(echo)
try(echo(
  expr = {
    print(1 + 1)
    df <- data.frame(a = 1:5, b = letters[1:5])
    print(df)
    message("hello!")
    warning("hello!")
    stop("error here")
  },
  level = 0
), silent = TRUE)
#> [2023-05-22 09:58:20] [EXP] print(1 + 1)
#> [2023-05-22 09:58:20] [OUT] #> [1] 2
#> [2023-05-22 09:58:20] [EXP] df <- data.frame(a = 1:5, b = letters[1:5])
#> [2023-05-22 09:58:20] [EXP] print(df)
#> [2023-05-22 09:58:20] [OUT] #>   a b
#> [2023-05-22 09:58:20] [OUT] #> 1 1 a
#> [2023-05-22 09:58:20] [OUT] #> 2 2 b
#> [2023-05-22 09:58:20] [OUT] #> 3 3 c
#> [2023-05-22 09:58:20] [OUT] #> 4 4 d
#> [2023-05-22 09:58:20] [OUT] #> 5 5 e
#> [2023-05-22 09:58:20] [EXP] message("hello!")
#> [2023-05-22 09:58:20] [MSG] #> hello!
#> [2023-05-22 09:58:20] [EXP] warning("hello!")
#> [2023-05-22 09:58:20] [WRN] #> hello!
#> [2023-05-22 09:58:20] [EXP] stop("error here")
#> [2023-05-22 09:58:20] [ERR] #> error here

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("echo")

0.1.0 by Jordan Mark Barbone, 3 years ago


https://github.com/jmbarbone/echo, https://jmbarbone.github.io/echo/


Report a bug at https://github.com/jmbarbone/echo/issues


Browse source code at https://github.com/cran/echo


Authors: Jordan Mark Barbone [aut, cph, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports utils

Suggests covr, spelling, testthat


Suggested by mark.


See at CRAN