[R] help with matrix

2013-07-19 Thread Kátia Emidio
Hi, I am a beginner at R and I would like to get information from a matrix, where the numbers are larger than or equal to 50m . This means that plants need to be apart at least 50m. I need to get the selection as in a way that I can identify which pair of species are 50m or more apart. here a

Re: [R] help with matrix

2013-07-19 Thread Duncan Murdoch
On 19/07/2013 10:17 AM, Kátia Emidio wrote: Hi, I am a beginner at R and I would like to get information from a matrix, where the numbers are larger than or equal to 50m . This means that plants need to be apart at least 50m. I need to get the selection as in a way that I can identify which

[R] Help with Matrix code optimization

2012-02-23 Thread Matt Shotwell
The chol and solve methods for dpoMatrix (Matrix package) are much faster than the default methods. But, the time required to coerce a regular matrix to dpoMatrix swamps the advantage. Hence, I have the following problem, where use of dpoMatrix is worse than a regular matrix. library(Matrix) x <

Re: [R] help with matrix column cleaning

2012-02-13 Thread David Winsemius
On Feb 14, 2012, at 12:46 AM, Vijayan Padmanabhan wrote: Dear R Group I have a matrix object in R, where i want to retain only those columns which have each row from a different group.. see the example below.. team1<-c("a1","a2","b1","b2","b3","c1","c2") teams<-combn(team1, 3) I want a funct

[R] help with matrix column cleaning

2012-02-13 Thread Vijayan Padmanabhan
Dear R Group I have a matrix object in R, where i want to retain only those columns which have each row from a different group.. see the example below.. team1<-c("a1","a2","b1","b2","b3","c1","c2") teams<-combn(team1, 3) I want a function which will delete all columns in the teams matrix that

Re: [R] Help with matrix

2008-07-25 Thread jim holtman
Is this what you want: > x <- read.table(textConnection("g1 g2 f + 3 4 10 + 2 1 30 + 4 4 50"), header=TRUE) > closeAllConnections() > # create empty matrix > mat <- matrix(0, max(x$g1), max(x$g2)) > mat[cbind(x[,1], x[,2])] <- x[,3] > mat [,1] [,2] [,3] [,4] [1,]000

[R] Help with matrix

2008-07-25 Thread Van Wyk, Jaap
Hi I have 3 vectors, say g1, g2 and f, where g1 and g2 contain the row and column indices of a matrix, with corresponding elements in f. How can I create a matrix containing the values in f ? For example: g1 g2 f 3 4 10 2 1 30 4 4 50 How can then get a matrix that looks as follows: 0

Re: [R] help with matrix

2007-12-30 Thread jim holtman
Does this give you want you want? I assume that you have to also ignore the first column in matrixC or else you don't have a reasonable comparison. Also your data for matrixA and matrixB did not have any spaces between the numbers, so I just took a guess at what they should be. > a.m <- scan(tex

[R] help with matrix

2007-12-30 Thread Yingchen Wang
Hi, dear all: I am a beginner. I appreciate any help or hint from you. I am trying to do calculation with matrices. I have 3 matrices. One is matrixA, 2nd is matrixB, and last is matrixC. Here is matrixA: 1.8511.40.0831.001 0.8771.30.1161.33 1.9021.21.1020.302 0.8640.1261.110.252