Learn R Programming

kimisc (version 0.4)

vswitch-deprecated: Vectorized switch

Description

The function vswitch is a vectorized version of base::switch() optimized for performance.

Usage

vswitch(EXPR, ...)

Arguments

EXPR

an expression evaluating to a number or a character string.

...

the list of alternatives. If it is intended that EXPR has a character-string value these will be named, perhaps except for one alternative to be used as a ‘default’ value.

Value

The value of one of the elements of ..., or NA whenever no element is selected. Contrary to base::switch() the result is always visible.

Details

Only the EXPR argument is treated as a vector. In particular, if any of the alternatives (or the default alternative) is a vector, the result will be a list of vectors.

See Also

Other deprecated functions: coalesce.na-deprecated, df_to_list-deprecated, hms.to.seconds-deprecated, kimisc-deprecated, list_to_df-deprecated, nc-deprecated, nlist-deprecated, ofactor-deprecated, sample.rows-deprecated, seconds.to.hms-deprecated, thisfile-deprecated, tll-deprecated