coerce_to_numeric: Convert to Numeric (if possible)

View source: R/to_numeric.R

coerce_to_numericR Documentation

Convert to Numeric (if possible)

Description

Tries to convert vector to numeric if possible (if no warnings or errors). Otherwise, leaves it as is.

Usage

coerce_to_numeric(x)

Arguments

x

A vector to be converted.

Value

Numeric vector (if possible)

Examples

coerce_to_numeric(c("1", "2"))
coerce_to_numeric(c("1", "2", "A"))

datawizard documentation built on Oct. 6, 2024, 1:08 a.m.