bind: Bind local variables to the return values of a function

Description Usage Arguments Details Value Examples

Description

Bind return values from a function to local variables by combining the bind function with the %<-% operator. When a function returns an object that is a vector or list you will normally have to index into that result to get individual components.

Usage

1

Arguments

...

List of variables to bind.

Details

Using bind you can values in a vector or list to local variables, so

bind(x, y, z) %<-% 1:3

binds a, b, and c to values 1, 2, and 3, respectively.

Value

An object containing the variable to be bound. This should be used in combination with the %<-% operator to bind values to parameters.

Examples

1
2
3
4
5
f <- function(x, y) c(x, y)
bind(a, b) %<-% f(1, 2)

g <- function(x, y) list(x, y)
bind(a, b) %<-% g(1, 2)

mailund/bindr documentation built on May 21, 2019, 11:06 a.m.