Hi r-help-boun...@r-project.org napsal dne 29.03.2010 08:41:15:
> Hi Leo, > > see the matrix function e.g. > > m <- matrix(0, nrow=1, ncol=3) > > then you can use functions like rbind or cbind to create bigger ones. > > I am a newbie so double check everything :) > > HTH, > Best regards, > Giovanni > > On Mar 29, 2010, at 8:37 AM, leobon wrote: > > > > > Hello all, > > I want to creat a space for a matrix. There is no such "space" for an object. Advisable is to create an object with desired final dimensions when using for cycle. However there is not many reasons for using cycles, much can be done with vectorised code instead. You can create matrix by mat <- matrix(0, nrow, ncol) or by mat <- rep(0,nrow*ncol) dim(mat) <- c(nrow,ncol) where nrow is integer number of rows and ncol is integer number of columns Regards Petr > > For example, I have a matrix with the dimension of 1(row)*3(col), which is > > (2,3,4). Then I want to put this matrix into a new and larger matrix. The > > dimension of the new matrix is 3*3. So what I want is creating a new larger > > matrix which allows me to put each smaller matrix with the same columns into > > it. > > I know 0*(1:3) is the way to creat a space for 3 numbers. Could any body > > tell me how to creat a space for a matrix? > > Appreciate very much for your help! > > > > Leo > > -- > > View this message in context: http://n4.nabble.com/create-space-for-a- > matrix-tp1694754p1694754.html > > Sent from the R help mailing list archive at Nabble.com. > > > > ______________________________________________ > > 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. > > ______________________________________________ > 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. ______________________________________________ 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.