[R] [External] Function of "matrix"

Richard M. Heiberger rmh @end|ng |rom temp|e@edu
Thu Oct 22 21:13:27 CEST 2020


FAQ 7.31

> 10.1/.1
[1] 101
> print(10.1/.1, digits=17)
[1] 100.99999999999999
> floor(10.1/.1)
[1] 100
>  floor(10.1*10)
[1] 101
> matrix(0, 2.9, 3.9)
     [,1] [,2] [,3]
[1,]    0    0    0
[2,]    0    0    0
>

note that the dimension arguments are passed through floor() before
they are used.

On Thu, Oct 22, 2020 at 2:42 PM 奈良県奈良市 <jaajikan using gmail.com> wrote:
>
> Dear R project team
>
> I used the function of "matrix" as follows:
> matrix(c(1:3030), 10.1/0.1)
> However, in the function, matrix, 10.1/0.1 was regarded as 100 not as 101.
> Therefore, a warning message appeared.
> On the other hand, matrix(c(1:3030), 101) or matrix(c(1:3030), 10.1*10) was
> OK. Of course, simply, 10.1/0.1 was successfully calculated. However,
> In the "matrix" environment, 10.1/0.1 was calculated as 100.
>
> Would you give me some answers?
>
> Sincerely
>
> Kazuki Sakura
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list