This function returns the type of a variable as character. It
is similar to type_sum
, however, the
return value is not truncated, and var_type()
works
on data frames and within pipe-chains.
var_type(x, ..., abbr = FALSE)
x | A vector or data frame. |
---|---|
... | Optional, unquoted names of variables that should be selected for
further processing. Required, if |
abbr | Logical, if |
The variable type of x
, as character.
data(efc) var_type(1)#> [1] "numeric"var_type(1L)#> [1] "integer"var_type("a")#> [1] "character"var_type(efc$e42dep)#> [1] "numeric"#> [1] "categorical"#> c82cop1 c83cop2 c84cop3 c85cop4 c86cop5 c87cop6 c88cop7 c89cop8 #> "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" #> c90cop9 #> "numeric"