is_num_fac: Check whether a factor has numeric levels only

Description Usage Arguments Value Examples

View source: R/is_num_fac.R

Description

This function checks whether a factor has only numeric or any non-numeric factor levels.

Usage

1

Arguments

x

A factor.

Value

Logical, TRUE if factor has numeric factor levels only, FALSE otherwise.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# numeric factor levels
f1 <- factor(c(NA, 1, 3, NA, 2, 4))
is_num_fac(f1)

# not completeley numeric factor levels
f2 <- factor(c(NA, "C", 1, 3, "A", NA, 2, 4))
is_num_fac(f2)

# not completeley numeric factor levels
f3 <- factor(c("Justus", "Bob", "Peter"))
is_num_fac(f3)

sjPlot/sjmisc documentation built on Aug. 21, 2018, 11:08 a.m.