matrix(a, ncol=3, nrow=4, byrow=TRUE) or
> dim(a) <- c(3,4) > a <- t(a) > a [,1] [,2] [,3] [1,] 1 2 3 [2,] 4 5 6 [3,] 7 8 9 [4,] 10 11 12 Depending on the context of the problem. Sarah On Thu, Mar 17, 2011 at 7:59 AM, Bodnar Laszlo EB_HU <laszlo.bod...@erstebank.hu> wrote: > Hi again, > > I'd like to ask you a question again. > > I have a matrix like this: > a <-matrix(c(1,2,3,4,5,6,7,8,9,10,11,12)) > a > > [,1] > [1,] 1 > [2,] 2 > [3,] 3 > [4,] 4 > [5,] 5 > [6,] 6 > [7,] 7 > [8,] 8 > [9,] 9 > [10,] 10 > [11,] 11 > [12,] 12 > > Is there a proper way to change the dimensions of this matrix so that I'll > get this as a result: > [,1] [,2] [,3] > [1,] 1 2 3 > [2,] 4 5 6 > [3,] 7 8 9 > [4,] 10 11 12 > > Thank you very much and have a pleasant day, > Laszlo > -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ R-help@r-project.org mailing list 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.