Re: [R] matrix into vector with vertex names - shortestpath reshape2

2013-08-27 Thread Joseph J. Bakker
Ok, the problem seems simpler than I thought. It works well if omit two lines: y_s[,1] - V(y)$name[y_s[,1]] y_s[,2] - V(y)$name[y_s[,2]] It seems melt creates a data.frame (unlike what it did two years ago?) Joe On Tue, Aug 27, 2013 at 12:35 AM, Joseph J. Bakker joe.st...@gmail.comwrote: Two

[R] matrix into vector with vertex names - shortestpath reshape2

2013-08-26 Thread Joseph J. Bakker
Two years ago, as shown in the script at the end, I created shortestpaths using Igraph, then using Melt in Reshape2 I converted the the resulting matrix into three column vectors - vertex1, vertex2, shortestpath. It worked then. However, in the meantime I have installed new versions of R

Re: [R] matrix into vector with vertex names

2011-08-24 Thread joe j
Hi Gabor, Thanks. I will try to figure out the solution you suggest. I found out about melt() from a discussion forum; it seems to me that melt()$value is similar to c(), and when I modified the script as below it 'seems' to be running faster. Anyway in the end I only needed to use a smaller

Re: [R] matrix into vector with vertex names

2011-08-18 Thread Gábor Csárdi
Joe, what is melt() supposed to do here? What's wrong with the simple solution of creating a data.frame first, and then filling it with values through a loop? Actually, keeping the matrix is just as good, indexing is just as fast, and takes the same amount of memory as your three column matrix,

[R] matrix into vector with vertex names

2011-08-05 Thread joe j
Using Igraph, I create shortest paths, then convert the matrix into three column vectors - vertex1, vertex2, shortestpath - as the code below shows. #code for generating shortest path matrix and creating a 3 columns from an igraph graph object y y_s-shortest.paths(y, weights = NULL) y_s -