Modifies the arguments of a function
fun %but% x
Function to modify
A function with the same body as the
fun argument but
with a different list of arguments.
%but% operator is S3-generic with the following methods:
- A default method which does nothing more than returning the
- A charactor method. In that case,
x describes the logical
arguments of the function.
x is a single character string containing
one or several token of the form
b is the first
letter of the logical argument we wish to modify and
an optional modifier.
a can be empty or
+, in which
case the argument will be set to
- in which case the
argument will be set to
! in which case the
argument will be the opposite of the current value in
- A list. In that case, arguments that are part of the formal
fun and elements of the list
updated to the element in
Romain Francois <email@example.com>
1 2 3 4 5 6 7 8 9 10 11 12
### 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 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.