Skip to content

Instantly share code, notes, and snippets.

View smbache's full-sized avatar
Pro

Stefan Milton Bache smbache

Pro
View GitHub Profile
`%<<%` <- function(con, x)
{
UseMethod("%<<%", x)
}
`%<<%.function` <- function(con, x)
{
if (!identical(x, close))
stop("Unknown function provided to <<", call. = FALSE)
@smbache
smbache / NamesTest
Last active August 29, 2015 14:04
Toying with declarations of symbols for use with non-standard evaluation.
#' Placeholder function.
#'
#' @export
as_nonstandard <- function()
{
stop("This is a placeholder function, and should not be called directly.")
}
#' Declare symbols for nonstandard evalution.
#'
@smbache
smbache / arm
Created June 26, 2014 08:08
Fun with pipe and armed expressions
#' Arm a value with a function which fires when evaluated.
#'
#' @param expr an expression
#' @param fun a function of one argument.
#'
#' @return an expression which when evaluated returns the result of expr,
#' after evaluating fun(expr).
arm <- function(expr, fun)
{
substitute({