search for: subrow

Displaying 3 results from an estimated 3 matches for "subrow".

Did you mean: sumrow
2012 Jun 07
1
select subrows based on a specific column in a matrix
Hi all, I have a matrix with 10000 rows and 10 columns. The last columns contains another identifiers but the values are not uniques so that I want to generate another matrix with rows with unique values in the last column. If I did tmp<-unique(my_mat$col10) this will give me 8560 unique entries so the ideal matrix will be 8560X10 columns now then. I tried sub_mat<-my_mat[tmp,] but
2011 Mar 27
1
run function on subsets of matrix
I was wondering if it is possible to do the following in a smarter way. I want get the mean value across the columns of a matrix, but I want to do this on subrows of the matrix, given by some vector(same length as the the number of rows). Something like nObs<- 6 nDim <- 4 m <- matrix(rnorm(nObs*nDim),ncol=nDim) fac<-sample(1:(nObs/2),nObs,rep=T) ##loop trough different 'factor' levels for (i in unique(fac)) print(apply(m[f...
2011 May 05
1
Looping over graphs in igraph
...dges when the graph identifier is 1, make calculations on that graph, then do it again for 2 and so forth. I suspect that this isn't related to igraph specifically--I just don't know the equivalent command in R for what in pseudo Stata code would read as: forvalues i of 1/N { temp_graph=subrows of the main csv file for which graphid==`i' cs`i' = leading.eigenvector.community.step(temp_graph) convert cs`i'$membership into a column in the original csv } I want the output to look something like: Graph ID | Vertex1 | Vertex2 | weight | Vertex 1 membership | Vertex 2 members...