[R] Odp: Matrix to Vector

2010-06-16 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 15.06.2010 19:51:39: > Hi All, > > I am trying to turn a Matrix into a vector for analysis purposes. I need to > select only certain columns from the entire matrix for the vector (intraday > time intervals). Also I need to transpose the Matrix (so t

Re: [R] Odp: Matrix

2009-02-02 Thread baptiste auguie
Hi, Perhaps this can help if you don't want to manually specify the permutation of indices, A=matrix(10,ncol=2,nrow=2) B <- 2*A C <- rbind(A, B) C[ as.vector(t(matrix(seq(1,nrow(C)),ncol=2))), ] # trick to create the vector of permutations [,1] [,2] [1,] 10 10 [2,] 20 20 [

Re: [R] Odp: Matrix

2009-02-02 Thread Paul Smith
On Mon, Feb 2, 2009 at 4:05 PM, Petr PIKAL wrote: > Hi > > r-help-boun...@r-project.org napsal dne 02.02.2009 16:52:06: > >> >> Hi, >> >> I have a very basic question on merging two matrices by alternating the >> rows. For illustration, assume two matrices - >> >> A looks like: >> >> 10 10 >> 10 1

[R] Odp: Matrix

2009-02-02 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 02.02.2009 16:52:06: > > Hi, > > I have a very basic question on merging two matrices by alternating the > rows. For illustration, assume two matrices - > > A looks like: > > 10 10 > 10 10 > > B looks like: > > 20 20 > 20 20 > > How do I combine

[R] Odp: matrix problem

2008-04-21 Thread Petr PIKAL
Hi Not sure what you want to do. You can set dimensions to your vector. vec<-1:12 dim(vec)<-c(3,4) you can repeat your vector for n times vec<-rep(1:4,3) dim(vec) <- c(4,3) or you can use byrow option vec<-1:12 matrix(vec, nrow=4, ncol=3, byrow=T) Petr Pikal [EMAIL PROTECTED] 724008364, 58