Re: [R] how to creat a matrix

2009-12-11 Thread milton ruser
Hi Him. Did you read the Help/Manual in PDF/A Instroduction to R.PDF? MyVect<-scan() 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 MyVect MyMat<-matrix(MyVect, ncol=5, byrow=T) MyMat bests milton On Fri, Dec 11, 2009 at 10:47 AM, Moohwan Kim wrote: > Dear R family > > I am attempting

Re: [R] how to creat a matrix

2009-12-11 Thread Robin Hankin
Hi try R> library(magic) R> ashift(diag(5),1) HTH rksh enrique Dallazuanna wrote: Try this: N <- 5 diag(1, N)[c(N, 1:(N - 1)),] On Fri, Dec 11, 2009 at 1:47 PM, Moohwan Kim wrote: Dear R family I am attempting to create a matrix. e.g., 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0

Re: [R] how to creat a matrix

2009-12-11 Thread Henrique Dallazuanna
Try this: N <- 5 diag(1, N)[c(N, 1:(N - 1)),] On Fri, Dec 11, 2009 at 1:47 PM, Moohwan Kim wrote: > Dear R family > >  I am attempting to create a matrix. e.g., >  0 0 0 0 1 >  1 0 0 0 0 >  0 1 0 0 0 >  0 0 1 0 0 >  0 0 0 1 0 >  How could I write a R program? >  Later I want to extend it to a N

[R] how to creat a matrix

2009-12-11 Thread Moohwan Kim
Dear R family I am attempting to create a matrix. e.g., 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 How could I write a R program? Later I want to extend it to a N by N case. Thanks in advance best Moohwan __ R-help@r-projec