Learn R Programming

gsubfn (version 0.7)

Utilities for Strings and Function Arguments

Description

The gsubfn function is like gsub but can take a replacement function or certain other objects instead of the replacement string. Matches and back references are input to the replacement function and replaced by the function output. gsubfn can be used to split strings based on content rather than delimiters and for quasi-perl-style string interpolation. The package also has facilities for translating formulas to functions and allowing such formulas in function calls instead of functions. This can be used with R functions such as apply, sapply, lapply, optim, integrate, xyplot, Filter and any other function that expects another function as an input argument or functions like cat or sql calls that may involve strings where substitution is desirable. There is also a facility for returning multiple objects from functions and a version of transform that allows the RHS to refer to LHS used in the same transform.

Copy Link

Version

Install

install.packages('gsubfn')

Monthly Downloads

21,806

Version

0.7

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

March 16th, 2018

Functions in gsubfn (0.7)

transform2

Like transform but allows right hand sides to refer to left hand sides.
list

Multiple value assignment.
gsubfn-package

gsubfn
match.funfn

Generic extended version of R match.fun
gsubfn

Pattern Matching and Replacement
strapply

Apply a function over a string or strings.
read.pattern

Read file or text string using a regular expression to separate fields.
as.function.formula

Make a one-line function from a formula.
fn

Transform formula arguments to functions.