Skip to contents

When attributes are missing, the base::attr() function returns NULL. In those cases this function can be used to find an alternative value in one expression: attr(x,"dim") %otherwise% length(x)

Usage

a %otherwise% b

Arguments

a

value to check for NULL

b

value to substitute

Value

a, or b if a is NULL