What is the shortest way to get a row from a matrix as a matrix?
> x<-matrix(1:9,nrow=3,byrow=TRUE) > x [,1] [,2] [,3] [1,] 1 2 3 [2,] 4 5 6 [3,] 7 8 9 > x[1,] [1] 1 2 3 > is.vector(x[1,]) [1] TRUE
where i would like to get
[,1] [,2] [,3] [1,] 1 2 3
source share