Checks if an SEXP is of Certain Type

isNumeric(s)

Source

Declaration: src/include/Rinternals.h and src/include/Rdefines.h

Implementation: Inline function isNumeric(SEXP s), cf. src/include/Rinlinedfuns.h

Arguments

s

(SEXP) An R object.

Value

(Rboolean) true (=1) or false (=0).

C API

#include <Rinternals.h>
Rboolean Rf_isNumeric(SEXP);
#define isNumeric       Rf_isNumeric

R API

library(base)

is.numeric(integer(length = 2L))  ## TRUE
is.numeric(numeric(length = 2L))  ## TRUE
is.numeric(factor(c("a", "b")))   ## FALSE
is.numeric(logical(length = 2L))  ## FALSE but isNumeric() = true!