where: where function

View source: R/tools.where.R

whereR Documentation

where function

Description

This function return a vector / matrix / array of the same shape than cond / x / y such that if(cond) values are x, and else y.

Usage

where(cond,x,y)

Arguments

cond

[vector/matrix/array] Boolean values

x

[vector/matrix/array] Values if cond is TRUE

y

[vector/matrix/array] Values if cond is FALSE

Value

z [vector/matrix/array].

Examples

x = base::seq( -2 , 2 , length = 100 )
y = where( x < 1 , x , exp(x) ) ## y = x if x < 1, else exp(x)


SBCK documentation built on Sept. 11, 2023, 5:10 p.m.

Related to where in SBCK...