Learn R Programming

jwutil (version 1.1.1)

areNumeric: which elements of a vector are numeric

Description

test without throwing a warning

Usage

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

Arguments

x

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

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