[R] [External] converting MATLAB -> R | element-wise operation

Berwin A Turlach berw|n@tur|@ch @end|ng |rom gm@||@com
Wed Feb 28 10:15:33 CET 2024


On Tue, 27 Feb 2024 21:37:52 +0000
"Richard M. Heiberger" <rmh using temple.edu> wrote:

> > t(t(NN)/lambda)  
>      [,1]      [,2] [,3]
> [1,]  0.5 0.6666667 0.75
> [2,]  2.0 1.6666667 1.50
> >  
> 
> R  matrices are column-based. MATLAB matrices are row-based.

It might depend on what you mean with this statement, but I would be
very surprised if MATLAB is not storing matrices in column-major form,
just as R does.

NN = [1, 2, 3; 4, 5, 6];

and 

NN = [ [1, 4]' , [2, 5]', [3, 6]' ];

produce the same matrix in MATLAB.

So the default filling of matrices is by row, and there is no
convenient argument to change that. 

Cheers,

	Berwin



More information about the R-help mailing list