catch_asNumericIfPossible {eatTools} | R Documentation |
Use asNumericIfPossible
with modified warning.
Description
This function uses asNumericIfPossible
but lets the user change the warning
issued by asNumericIfPossible
. Suited for use in other R
packages.
Usage
catch_asNumericIfPossible(x, warn, maintain.factor.scores = TRUE,
force.string = TRUE, transform.factors = TRUE)
Arguments
x |
A vector or data frame which should be converted. |
warn |
A character vector of length 1 with the desired warning. |
maintain.factor.scores |
Logical:
If |
force.string |
Logical indicating whether columns should be force to
numeric, even if NAs are induced.
If |
transform.factors |
Logical indicating whether columns of class
|
Details
For details see asNumericIfPossible
Author(s)
Benjamin Becker
Examples
char <- c("a", "b", 1)
catch_asNumericIfPossible(x = char, warn = "Vector could not be converted")