Learn R Programming

mathml (version 1.5)

hook: Hook for custom symbols

Description

hook(term, display) hook_fn(fn) unhook(term) hooked(term)

Usage

hook(term, display = NULL, quote = TRUE, as.rolog = TRUE)

unhook(term, quote = TRUE, as.rolog = TRUE)

hooked(term)

hook_fn(fn)

Value

hook and unhook return TRUE on success. hooked returns the hooked expression or FALSE on failure.

Arguments

term

an R call or symbol/number. This is the expression to replace.

display

an R call or symbol/number. This is shown instead of term.

quote

(default is TRUE) indicates that term and display should be quoted.

as.rolog

(default is TRUE) indicates that simplified quasi-quotation is to be used.

fn

a custom function. The name of fn is replaced by its function body.

Examples

Run this code
hook(t0, subscript(t, 0))
hooked(quote(t0))
mathml(quote(t0))
hook(term=quote(t0), display=quote(superscript(t, 0)), quote=FALSE)
mathml(quote(t0))
unhook(t0)
mathml(quote(t0))
square <- function(x) {x^2} ; hook_fn(square)

Run the code above in your browser using DataLab