tests/testfiles/bad-definition.R

log_to <- function(f, path = '.log') {
  function(...) {
    lcon <- file(path, "w")
    on.exit(close(lcon))
    fval <- f(...)
    cat(fval, '\n', file = lcon)
    fval
  }
}

#. log_to(path = '.log.whoops')
whoops <- function(x, ) {
  if (!y) return('why not?')

  'Did I miss something?'
}

Try the tinsel package in your browser

Any scripts or data that you put into this service are public.

tinsel documentation built on May 2, 2019, 1:30 p.m.