[R] creating matrix row by row

2015-03-28 Thread Ragia Ibrahim
Hi, I have a original adjacency matrix n X n , and I want to connect certain row with a set of other selected columns (could be not the same as in the original matrix). this in each iteration I have a new row of this connections matrix , how to create this matrix. having original row

[R] Creating matrix from long table in database (pivoting)

2010-03-02 Thread Jan Hornych
Hi all, I have a table in database that is very long and when simplified it has only two columns in it (id, text). id is the row, and text is the column. Technically the text is a term and and id is the document. If simplifying this and assuming there is only one occurrence of the term per the

Re: [R] Creating matrix from long table in database (pivoting)

2010-03-02 Thread Henrique Dallazuanna
Try this: DF - read.table(textConnection(1 this 1 is 1 the 1 first 1 row 2 this 2 is 2 the 2 send 2 row)) reshape(DF, v.names = 'V2', idvar = 'V1', timevar = 'V2', direction = 'wide') On Tue, Mar 2, 2010 at 3:35 PM, Jan Hornych jh.horn...@gmail.com wrote: Hi all, I have a table in database

Re: [R] Creating matrix from long table in database (pivoting)

2010-03-02 Thread Phil Spector
Jan - Here's one way: tbl = data.frame(id=c(1,1,1,1,1,2,2,2,2,2), text=c('this','is','the','first','row','this','is','the','second','row')) xtabs(~id+text,tbl) text id first is row second the this 1 1 1 1 0 11 2 0 1 1 1 11

Re: [R] Creating matrix from long table in database (pivoting)

2010-03-02 Thread Henrique Dallazuanna
Or better: reshape(cbind(DF, value = 1), v.names = 'value', idvar = 'V1', timevar = 'V2', direction = 'wide') On Tue, Mar 2, 2010 at 3:49 PM, Henrique Dallazuanna www...@gmail.com wrote: Try this: DF - read.table(textConnection(1 this 1 is 1 the 1 first 1 row 2 this 2 is 2 the 2 send

[R] Creating Matrix

2008-05-11 Thread Claire_6700
Hello, I have two data. x-c(1, 2, 1, 3, 2) y-c(3, 1, 2, 3, 5) How do i create matrix from this two. what i want is this x y 1 1 3 2 2 1 3 1 2 4 3 3 5 2 5 thanks Claire -- View this message in context: http://www.nabble.com/Creating-Matrix-tp17168173p17168173.html Sent

Re: [R] Creating Matrix

2008-05-11 Thread Gabor Csardi
See ?cbind and ?matrix. Gabor On Sat, May 10, 2008 at 03:21:26PM -0700, Claire_6700 wrote: Hello, I have two data. x-c(1, 2, 1, 3, 2) y-c(3, 1, 2, 3, 5) How do i create matrix from this two. what i want is this x y 1 1 3 2 2 1 3 1 2 4 3 3 5 2 5

Re: [R] Creating Matrix

2008-05-11 Thread nikola . markov
Here is how you can apply the mat function mentioned by Cassardi, x-c(1, 2, 1, 3, 2) y-c(3, 1, 2, 3, 5) mat-matrix(c(x,y),5,2) ##the first parameter gives the data vector wich is filled columnwise in the matrix, then comes the row and column dimensions) colnames(mat)-c(x,y) you can

Re: [R] Creating Matrix

2008-05-11 Thread Claire_6700
how do i calculate the p-value of trend test power oquote author=Claire_6700 Hello, I have two data. x-c(1, 2, 1, 3, 2) y-c(3, 1, 2, 3, 5) 1. How do i create matrix from this two. what i want is this x y 1 1 3 2 2 1 3 1 2 4 3 3 5 2 5 2. what is the best way to use