Menu

#7 Matrix Create Function R Example is Bad

v1.0 (example)
open
nobody
None
5
2015-09-20
2015-09-20
Neil Tiffin
No

In section 4 Matrices, one of the functions in R is not the same as the other function in R or the function in MATLIB.

R - BAD
> array(c(2,3,4,5), dim=c(2,2))
[,1] [,2]
[1,] 2 4
[2,] 3 5

R - CORRECTED
> array(c(2,4,3,5), dim=c(2,2))
[,1] [,2]
[1,] 2 3
[2,] 4 5

R - GOOD
> rbind(c(2,3),c(4,5))
[,1] [,2]
[1,] 2 3
[2,] 4 5

Octave - GOOD
octave:2> a=[2 3;4 5]
a =

   2   3
   4   5

Discussion


Log in to post a comment.

MongoDB Logo MongoDB