Learn R Programming

operators (version 0.1-8)

but: Modification of function arguments

Description

Modifies the arguments of a function

Usage

fun %but% x

Arguments

fun
Function to modify
x
Modifier

Value

A function with the same body as the fun argument but with a different list of arguments.

See Also

args, formals

Examples

Run this code
### default method, nothing is done
rnorm %but% 44

### character method, operating on logical arguments
grep %but% "pf"     # grep, with perl and fixed set to TRUE
grep %but% "i-e"    # grep, ignoring the case but not using extended regular expressions
( grep %but% "vp" )( "blue", colors() )

### list method 
rnorm %but% list( mean = 3 )
rnorm %but% list( nonsense = 4 )

Run the code above in your browser using DataLab