View source: R/catch_asNumericIfPossible.R
catch_asNumericIfPossible | R Documentation |
asNumericIfPossible
with modified warning.
This function uses asNumericIfPossible
but lets the user change the warning
issued by asNumericIfPossible
. Suited for use in other R
packages.
catch_asNumericIfPossible(x, warn, maintain.factor.scores = TRUE,
force.string = TRUE, transform.factors = TRUE)
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
|
For details see asNumericIfPossible
Benjamin Becker
char <- c("a", "b", 1)
catch_asNumericIfPossible(x = char, warn = "Vector could not be converted")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.