transformif {exams.forge}R Documentation

Transformation

Description

Transforms x if cond is TRUE by \log(a+b*x) if p==0 and (a+b*x)^p). Otherwise the transformation can be either applied to each element of x, or to all elements of x.

Usage

transformif(x, cond, a = -abs(min(x)), b = 1, p = 1)

Arguments

x

vector: values

cond

logical: condition if transformation should be applied

a

numeric: shift (default: -abs(min(x)))

b

numeric: scale (default: 1))

p

numeric: power (default: 1))

Value

A transformed vector

Examples

x <- rnorm(5)
transformif(x, min(x)<0)  # all transformed elements > 0
transformif(x, x<0)       # only negative elements are transformed

[Package exams.forge version 1.0.10 Index]