Description Usage Arguments Details Value See Also Examples
A checkFunction
to be called from
check
for identifying numeric variables that have
been misclassified as categorical.
1 | identifyNums(v, nVals = 12, ...)
|
v |
A character, factor, or (haven_)labelled variable to check. |
nVals |
An integer determining how many unique values a variable must have
before it can potentially be determined to be a misclassified numeric variable.
The default is |
... |
Not in use. |
A categorical variable is suspected to be a misclassified
numeric variable if it has the following two properties: First,
it should consist exclusively of numbers (possibly including signs
and decimals points). Secondly, it must have at least nVals
unique values.
The default values of nVals
is 12, which means that
e.g. variables including answers on a scale from 0-10 will
not be recognized as misclassified numerics.
A checkResult
with three entires:
$problem
(a logical indicating the variable is suspected to be
a misclassified numeric variable), $message
(if a problem was found,
the following message: "Note: The variable consists exclusively of numbers and takes
a lot of different values. Is it perhaps a misclassified numeric variable?",
otherwise "") and $problemValues
(always NULL
).
check
, allCheckFunctions
,
checkFunction
, checkResult
1 2 3 4 5 | #Positive and negative numbers, saved as characters
identifyNums(c(as.character(-9:9)))
#An ordinary character variable
identifyNums(c("a", "b", "c", "d", "e.f", "-a", 1:100))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.