# [R] is.integer() function

Gabor Grothendieck ggrothendieck at gmail.com
Wed Jan 25 19:29:35 CET 2006

```My understanding is that a variable of _mode_ "numeric" can be
of _type_ "double" or _type_ "integer".    Just knowing that a variable
is numeric does not tell you which of these two subcategories it
falls in.

x <- 1:3
mode(x) # "numeric"
typeof(x) # "integer"
y <- 1.2
mode(y) # "numeric"
typeof(y) # "double"

On 1/25/06, Barry Rowlingson <B.Rowlingson at lancaster.ac.uk> wrote:
> Duncan Murdoch wrote:
>
> > Here "numeric vector" is being used in the R-specific technical sense as
> > a vector of double precision values, so the documentor was trying hard
> > to be precise.  The problem is that English also admits the
> > interpretation in a non-technical sense as a vector of numbers.  I
> > believe your country is to blame for the language. :-)
>
>
>  But can "numeric vector" in the "R-specific technical sense" also mean
> a vector of integer (representation) values? It passes is.numeric() and
> is.vector():
>
>  > x=1:3
>  > is.numeric(x)
> [1] TRUE
>  > is.vector(x)
> [1] TRUE
>  > is.integer(x)
> [1] TRUE
>
>
>  Unless by the "R-specific technical sense of 'numeric vector'" you
> dont mean something for which is.numeric() and is.vector() are both
> true. Which is perverse. But then large chunks of R are. Anyway, is this
> right:
>
> is.RSpecificTechnicalSenseNumericVector=function(v){is.numeric(v) &
> is.double(v)}
>
> Barry
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help