all_is_numeric: Check if All Elements in Character Vector are Numeric

View source: R/utils.R

all_is_numericR Documentation

Check if All Elements in Character Vector are Numeric

Description

Tests, without issuing warnings, whether all elements of a character vector are legal numeric values, or optionally converts the vector to a numeric vector. Leading and trailing blanks in x are ignored.

Usage

all_is_numeric(x, extras = c(".", NA))

Arguments

x

a character vector

extras

a vector of character strings to count as numeric values, other than "".

Value

a logical value

Examples

all_is_numeric(c("1", "1.2", "3"))
all_is_numeric(c("1", "1.2", "3a"))


shug0131/cctu documentation built on Feb. 15, 2025, 3:27 p.m.