Skip to contents

Determine the datatype of a vector

Usage

var_type(var)

Arguments

var

vector whose datatype is to be determined

Not exported. See @returns for details of what it does.

Value

Returns generic datatypes of R basic vectors according to the following mapping:

  • logical returns 'binary'

  • numeric values (e.g., integer and double) return 'numeric'

  • However, if the only values of numeric are 0 and 1, then it returns 'binary'

  • unordered factor returns 'categorical'

  • ordered factor returns 'ordinal'