Learn R Programming

jwutil (version 1.2.3)

is_numeric_str: Which elements of a character vector are numeric

Description

Takes a character vector and returns a logical vector of the same length, indicating which values are numeric. NA is considered non-numeric. NA is never returned from this function.

Usage

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

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

Arguments

x

character vector

extras

character vector containing acceptable alternatives to numeric values which will result in returning TRUE for that element. Default is c(".", "NA", NA).

Value

logical vector of same length as input

Functions

  • areNumeric: Deprecated

Examples

Run this code
# NOT RUN {
areNumeric(c("1", "2", "3"))
areNumeric(c("1L", "2.2"))
areNumeric(c("NA", NA, ".", "", "-1.9"))
# }

Run the code above in your browser using DataLab