Hello Everyone,

I am using R 2.15.0 and I came across this behaviour and I was wondering
why I don't get an integer vector or and integer matrix with the following
code:

> z <- c(1, 2:0, 3, 4:8)

> typeof(z)

[1] "double"

> z <- rbind(1, 2:0, 3, 4:8)

Warning message:

In rbind(1, 2:0, 3, 4:8) :

  number of columns of result is not a multiple of vector length (arg 2)

> typeof(z)

[1] "double"

> z <- matrix(c(1, 2:0, 3, 4:8), nrow = 5)

> typeof(z)

[1] "double"


Shouldn't be typeof integer? According to the online help if everything is
integer the output should be integer.
But if I do this, I get an integer matrix.

> z <- matrix(1:20, nrow = 5)

> typeof(z)

[1] "integer"

Thanks!

Lourdes

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to