Skip to contents

Return a Default Value for Values Meeting a Condition

Usage

defaultIf(FUN.test, x, default, count = FALSE)

Arguments

FUN.test

function returning vector of logical, to be applied to x

x

vector in which to set default values

default

value to be set in x at those positions where FUN.text returns TRUE

count

if TRUE (the default is FALSE) the number of replaced values is returned in the attributes count