Displaying 1 result from an estimated 1 matches for "mtraxi".
Did you mean:
maxi
2010 Jan 19
4
apply command
...print(apply(b, 1, function(y) sort(y, na.last=F)))
the output is a matrix of 6 rows by 2 columns.
[,1] [,2]
[1,] 1 NA
[2,] 2 2
[3,] 4 3
[4,] 5 3
[5,] 7 3
[6,] 9 5
As you can see in the example I start with a matrix of (2 by 6) and the
output of apply is a mtraxi of (6 by 2).
This is very strange because I was expecting as output a matrix of the same
dim (2 by 6) of the input matrix. I can solve this issues using an if
statment on the dim of the matrix but if I am using a square matrix I am not
able to control if the result of the apply is correct.
Do anyo...