Re: [R] Matrix max by row

2009-03-28 Thread Wacek Kusnierczyk
Ana M Aparicio Carrasco wrote: > I need help about how to obtain the max by row in a matrix. > For example if I have the following matrix: > 2 5 3 > 8 7 2 > 1 8 4 > > The max by row will be: > 5 > 8 > 8 > matrix(apply(m, 1, max), nrow(m)) vQ __ R-he

Re: [R] Matrix max by row

2009-03-28 Thread jim holtman
?apply > x <- rbind(c(2,5,3),c(8,7,2),c(1,8,4)) > apply(x, 1, max) [1] 5 8 8 > > On Sat, Mar 28, 2009 at 7:54 PM, Ana M Aparicio Carrasco wrote: > I need help about how to obtain the max by row in a matrix. > For example if I have the following matrix: > 2 5 3 > 8 7 2 > 1 8 4 > > The max by row

Re: [R] Matrix max by row

2009-03-29 Thread Bert Gunter
Of Wacek Kusnierczyk Sent: Saturday, March 28, 2009 5:22 PM To: Ana M Aparicio Carrasco Cc: r-help@r-project.org Subject: Re: [R] Matrix max by row Ana M Aparicio Carrasco wrote: > I need help about how to obtain the max by row in a matrix. > For example if I have the following matrix: > 2 5

Re: [R] Matrix max by row

2009-03-29 Thread Rolf Turner
project.org] On Behalf Of Wacek Kusnierczyk Sent: Saturday, March 28, 2009 5:22 PM To: Ana M Aparicio Carrasco Cc: r-help@r-project.org Subject: Re: [R] Matrix max by row Ana M Aparicio Carrasco wrote: I need help about how to obtain the max by row in a matrix. For example if I have the follow

Re: [R] Matrix max by row

2009-03-29 Thread Bill.Venables
essage- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Rolf Turner Sent: Monday, 30 March 2009 1:39 PM To: Bert Gunter Cc: 'Wacek Kusnierczyk'; r-help@r-project.org Subject: Re: [R] Matrix max by row I tried the following: m <- matrix(runif

Re: [R] Matrix max by row

2009-03-30 Thread Wacek Kusnierczyk
>> >> Hint:The man page for ?data.frame says: >> "A data frame is a list of variables of the same length with unique row >> names, given class 'data.frame'." >> >> Cheers, >> Bert >> >> Bert Gunter >> Genentech Nonclinica

Re: [R] Matrix max by row

2009-03-30 Thread Bert Gunter
Sent: Monday, March 30, 2009 2:33 AM To: Rolf Turner Cc: Bert Gunter; 'Ana M Aparicio Carrasco'; r-help@r-project.org Subject: Re: [R] Matrix max by row Rolf Turner wrote: > I tried the following: > > m <- matrix(runif(10),1000,100) > junk <- gc() > print(system.t

Re: [R] Matrix max by row

2009-03-30 Thread Wacek Kusnierczyk
Bert Gunter wrote: > > Serves me right, I suppose. Timing seems also very dependent on the > dimensions of the matrix. Here's what I got with my inadequate test: > > >> x <- matrix(rnorm(3e5),ncol=3) >> > ## via apply > >> system.time(apply(x,1,max)) >> >user system elapsed

Re: [R] Matrix multiplication - code problem

2009-04-01 Thread Ben Bolker
MarcioRibeiro wrote: > > Hi listers, > I am having some trouble in a matrix multiplication... > I have already checked some posts, but I didn't find my problem... > I have the following code... > But I am not getting the right multiplication... > I checked the dimension and they are fine... >

Re: [R] Matrix multiplication - code problem

2009-04-01 Thread Ben Bolker
I think your problem is with R's behavior of dropping array indices when dim==1. Simulating that > m1 <- matrix(1:2,nrow=2) > m2 <- matrix(1:2,ncol=2) > m1 %*% m2 [,1] [,2] [1,]12 [2,]24 > m1[,] %*% m2[,] [,1] [1,]5 [1,]5 > m1[,,drop=FALSE] %*% m2[,,drop=

Re: [R] Matrix multiplication - code problem

2009-04-01 Thread MarcioRibeiro
Hi again... I will get an array with 5 matrix 2x2, with dimension 2x2x5 This code below works fine... And I am applying the same procedure... The problem might be when I do the permutation of the array, but I checked the dimension and its all right... array1 <- array(1:30,dim=c(3,2,5)) array2 <-

Re: [R] Matrix multiplication - code problem

2009-04-02 Thread Uwe Ligges
MarcioRibeiro wrote: Hi listers, I am having some trouble in a matrix multiplication... I have already checked some posts, but I didn't find my problem... I have the following code... But I am not getting the right multiplication... I checked the dimension and they are fine... id_y <- array(1:

[R] matrix vectorization or something else??

2009-04-02 Thread Kutlwano Ramaboa
Hello This may have been answered elsewhere, and I have looked on the web, but nothing helps. I am trying to do the following: X<-matrix(c(1:15),nrow=3,byrow=T) Y<-matrix(c(2,4,6,8,10),ncol=1) I need to sum the product of each row of X by the remaining j rows multiplied by j y values (i.e s

Re: [R] Matrix multiplication - code problem

2009-04-02 Thread MarcioRibeiro
Hi again, I understood what you guys explained... But, there isn't a way to do a multiplication of matrix with a FOR command or otherelse where one o my dimension is ONE... Well, as my data file is small, I did the procedure at the excel... But, this is not the good procedure... Thanks, Marcio U

Re: [R] Matrix multiplication - code problem

2009-04-02 Thread Patrick Burns
You need to put in calls to 'as.matrix'. It's a bit tricky though -- what you want depends on whether it is the first or second subscript that has length 1. as.matrix(id_y[,,i]) if the second dimension has length 1. t(as.matrix(id_y[,,i])) if the first dimension has length 1. Patrick Burns

Re: [R] Matrix multiplication - code problem

2009-04-02 Thread Ben Bolker
I think this works in general, although it's a little bit clunky: id_y <- array(1:10,dim=c(2,1,5)) id_yt <- aperm(id_y,c(2,1,3)) m_id <- array(dim=c(dim(id_y)[1],dim(id_y)[1],dim(id_y)[3])) for (i in 1:dim(id_y)[3]){ m1 <- array(id_y[,,i],dim=dim(id_y)[1:2]) m2 <- array(id_yt[,,i],dim=di

Re: [R] matrix filtering and reordering

2009-04-07 Thread Peter Alspach
Kia ora Juan ?merge HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Juan Pablo Fededa > Sent: Wednesday, 8 April 2009 8:55 a.m. > To: r-help@r-project.org > Subject: [R] ma

[R] Matrix multiplication and random numbers

2009-09-09 Thread RFish
Dear All I new to using R and am struggling with some matrix multiplication. I have two matrices, one containing random numbers, these are multiplied together to get another matrix which is different each time. When I put in another for loop to repeat this process a multiple times the matrices

[R] matrix row product and cumulative product

2008-08-17 Thread Jeff Laake
I spent a lot of time searching and came up empty handed on the following query. Is there an equivalent to rowSums that does product or cumulative product and avoids use of apply or looping? I found a rowProd in a package but it was a convenience function for apply. As part of a likelihood calc

Re: [R] matrix elementwise average with NA's

2007-11-21 Thread Matthew Keller
Maybe there is a more elegant solution, but here is one possibility: mat1[is.na(mat1)]<-mat2[is.na(mat1)] mat2[is.na(mat2)]<-mat1[is.na(mat2)] (mat1+mat2)/2 On Nov 21, 2007 12:30 PM, Gregory Gentlemen <[EMAIL PROTECTED]> wrote: > Hello fellow R users, > > I have a matrix computation that I imagi

Re: [R] matrix elementwise average with NA's

2007-11-21 Thread Marc Schwartz
On Wed, 2007-11-21 at 14:30 -0500, Gregory Gentlemen wrote: > Hello fellow R users, > > I have a matrix computation that I imagine should be relatively easy > to do, however I cannot figure out a nice way to do it. I have two > matrices, for example > > mat1 <- matrix(c(1:5,rep(NA,5), 6:10), nro

[R] Matrix of dummies from a vector

2007-11-22 Thread Serguei Kaniovski
Hallo >From a variable "x" that defines, say, four classes, I would like to define the matrix "mat" of dummy variables indicating the classes, i.e. x <- c(1,1,1,1,2,2,2,3,3,3,4,4) mat <- matrix(c(1,0,0,0, 1,0,0,0, 1,0,0,0, 1,0,0,0, 0,1,0,0, 0,1,0,0, 0,1,0,0, 0,0,1,0, 0,0,1,0, 0,0,1,0, 0,0,0,1, 0

Re: [R] matrix (column-wise) multiple regression

2007-11-23 Thread Gabor Grothendieck
Perhaps something like this: > idx <- 1:2 > lm(as.matrix(iris[idx]) ~., iris[-idx]) Call: lm(formula = as.matrix(iris[idx]) ~ ., data = iris[-idx]) Coefficients: Sepal.Length Sepal.Width (Intercept) 3.682982 3.048497 Petal.Length0.905946 0.154676 Pet

Re: [R] matrix (column-wise) multiple regression

2007-11-23 Thread Gabor Grothendieck
You can look at the components of the output using str and pick out what you want using $ and attr. idx <- 1:2 z <- lm(as.matrix(iris[idx]) ~., iris[-idx]) str(z) str(summary(z)) On Nov 23, 2007 1:10 PM, Morgan Hough <[EMAIL PROTECTED]> wrote: > Hi Gabor, > > Thanks for your reply. I have it work

Re: [R] matrix (column-wise) multiple regression

2007-11-23 Thread Morgan Hough
Hi Gabor, Thanks for your reply. I have it working now. A couple of follow-ups if I may. I have a shell script parsing the output to find the brain areas where there is a significant effect of diagnosis but its a bit of a hack. I was wondering whether there are R specific tools for parsing/sum

[R] 'matrix' returns integer instead of decimal

2008-01-20 Thread Brant Inman
R-helpers: I am experiencing some odd behavior with the 'matrix' function that I have not experienced before and was wondering if there is something that I was missing in my code. - > sessionInfo() R version 2.6.1 (2007-11-26) i386-pc-mingw32 locale: LC_COLLATE

Re: [R] Matrix: Problem with the code

2009-01-09 Thread Sarah Goslee
Well, mat doesn't have any dimensions / isn't a matrix, and we don't know what p is supposed to be. But leaving aside those little details, do you perhaps want something like this: x<-c(23,67,2,87,9,63,8,2,35,6,91,41,22,3) p <- 5 mat<- matrix(0, nrow=p, ncol=length(x)) for(

Re: [R] Matrix: Problem with the code

2009-01-09 Thread Charlotte Wickham
One of those more elegant ways: outer(x, 1:p, "^") Charlotte On Fri, Jan 9, 2009 at 4:24 PM, Sarah Goslee wrote: > Well, mat doesn't have any dimensions / isn't a matrix, and we don't > know what p is supposed to be. But leaving aside those little details, > do you perhaps want something like th

Re: [R] Matrix: Problem with the code

2009-01-09 Thread markleeds
Charlotte: I ran your code because I wasn't clear on it and your way would cause more matrices than the person requested. So I think the code below it, although not too short, does what the person asked. Thanks though because I understand outer better now. temp <- matrix(c(1,2,3,4,5,6),ncol=2)

Re: [R] Matrix: Problem with the code

2009-01-09 Thread Kingsford Jones
On Fri, Jan 9, 2009 at 6:36 PM, wrote: > Charlotte: I ran your code because I wasn't clear on it and your way would > cause more matrices than the person requested. Bhargab gave us x<-c(23,67,2,87,9,63,8,2,35,6,91,41,22,3) and said: "I want to have a matrix with p columns such that each c

Re: [R] Matrix: Problem with the code

2009-01-09 Thread markleeds
Thanks Kingsford. I thought the column power was supposed to be just for that column but you're probably correct. English has its oddities because if one reads the actual sentence the person wrote it's still not clear, atleast to me. "Actually I want to have a matrix with p columns such that

[R] Matrix entries not recognised as numeric

2007-09-17 Thread snapperball
Hello, I am using a number of large matrices in a project. I read a couple of the matrices using the read.csv command. However in some instances, R does not recognize the resulting matrices as consisting of numerical values (I suspect R considers them as strings or factors) for instance when I

Re: [R] matrix vectorization or something else??

2009-04-02 Thread David Winsemius
Generally unambiguous questions get answered quickly. Perhaps other readers are having the same difficulties I am experiencing. So let's try to parse what you are asking: On Apr 2, 2009, at 8:26 AM, Kutlwano Ramaboa wrote: Hello This may have been answered elsewhere, and I have looked on t

Re: [R] matrix vectorization or something else??

2009-04-02 Thread Kutlwano Ramaboa
Agree, it is ambiguous. Will try again Suppose I have the following X<-matrix(c(1:20),nrow=4,byrow=T), hence this is a 4 by 5 matrix Y<-matrix(c(2,4,6,8),ncol=1), and this is a 4 by 1 vector, each value denote y1, y2,y3, y4 Step 1 - write each row of X as a vector, so I have vectors t(x_

Re: [R] matrix vectorization or something else??

2009-04-03 Thread David Winsemius
On Apr 3, 2009, at 1:36 AM, Kutlwano Ramaboa wrote: Agree, it is ambiguous. Will try again Suppose I have the following X<-matrix(c(1:20),nrow=4,byrow=T), hence this is a 4 by 5 matrix Y<-matrix(c(2,4,6,8),ncol=1), and this is a 4 by 1 vector, each value denote y1, y2,y3, y4 Step 1

[R] Matrix package,solve() errors and crashes"

2009-04-17 Thread Surendar Swaminathan
Hello All, I am working on graph object using IGRAPH package wanted to do Bonacich Power. This is my graph object. The file 'Graph.RData' (4.2 MB) is available for download at http://dropbox.unl.edu/uploads/20090424/cfe4fcb854bb17f2/Graph.RData Graph size Vertices: 20984 Edges: 326033 Direct

[R] Matrix package,solve() errors and crashes

2009-04-20 Thread Surendar Swaminathan
Hello All, I am working on graph object using IGRAPH package wanted to do Bonacich Power. This is my graph object. The file 'Graph.RData' (4.2 MB) is available for download at http://dropbox.unl.edu/uploads/20090424/cfe4fcb854bb17f2/Graph.RData Graph size Vertices: 20984 Edges: 326033 Direct

[R] matrix subsetting assignment with logical mask

2009-07-16 Thread Ross Boylan
If m is a matrix and s is a logical matrix of the same dimensions, I'd like to be able to update m with m[s] <- 0 If m2 is another matrix, I'd also like to be able to do m[s] <- m2 where elements of m for which s is TRUE get the corresponding element of m2. However, this doesn't work in R 2.7.1.

Re: [R] Matrix multiplication and random numbers

2009-09-09 Thread jim holtman
I am not sure what you mean by being the same each time. If I make successive calls to the function, I get different results: > z [,1] [1,] 0. [2,] 0. [3,] 201.6382 [4,] 0. [5,] 0. [6,] 0. [7,] 0. > matmult(InitialPop,1) [,1] [1,] 0.000 [2,]

Re: [R] Matrix multiplication and random numbers

2009-09-09 Thread Chris Stubben
RFish wrote: > > I new to using R and am struggling with some matrix multiplication. > I'm not sure what you're trying to print, but you could place this vector in an expression mat3<-expression(c(0,rnorm(1,0.6021,0.0987),0,0,0,0,0,0,0,rnorm(1,0.6021,0.0987),0,0,0,0,1.9,0,0,rnorm(1,0.6021,0.

Re: [R] Matrix multiplication and random numbers

2009-09-09 Thread RFish
Sorry I probably wasn't clear with my description. The reason i put for loop in was that I want to do the matrix multiplication about 1000 times to get a 1000 different matrices. Therefore I was hoping the for loop would be able to automate this then use write.table to write to an external documen

Re: [R] Matrix multiplication and random numbers

2009-09-11 Thread RFish
Hi Sorry I don't seem to have explained what I'm trying to do very clearly. The piece of code below multiplies the two matrices together a number of times based on the value in the matmult(InitialPop,1) term in this case one (year), this gives me the end population for the analysis. InitialPop<

Re: [R] Matrix multiplication and random numbers

2009-09-11 Thread Henrique Dallazuanna
If I understand you can use replicate: replicate(10, matmult(InitialPop, 1)) On Fri, Sep 11, 2009 at 1:11 PM, RFish wrote: > > Hi > > Sorry I don't seem to have explained what I'm trying to do very clearly. > The piece of code below multiplies the two matrices together a number of > times base

Re: [R] matrix row product and cumulative product

2008-08-17 Thread Charles C. Berry
On Sun, 17 Aug 2008, Jeff Laake wrote: I spent a lot of time searching and came up empty handed on the following query. Is there an equivalent to rowSums that does product or cumulative product and avoids use of apply or looping? I found a rowProd in a package but it was a convenience function

Re: [R] matrix row product and cumulative product

2008-08-17 Thread Moshe Olshansky
needed to multiply N pairs of numbers. --- On Mon, 18/8/08, Jeff Laake <[EMAIL PROTECTED]> wrote: > From: Jeff Laake <[EMAIL PROTECTED]> > Subject: [R] matrix row product and cumulative product > To: r-help@r-project.org > Received: Monday, 18 August, 2008, 12:49 PM

Re: [R] matrix row product and cumulative product

2008-08-18 Thread Jeff Laake
Thanks for the tips on inline, jit and Reduce. The latter was exactly what I wanted although the loop is still the fastest for the simple product (accumulate=TRUE for reduce). With regards to Moshe's comment, I was just surprised by the timing difference. I tend to use apply without giving it

Re: [R] matrix row product and cumulative product

2008-08-18 Thread Jeff Laake
Sorry a correction to my last posting. I had accumulate switched between prod and cumprod and I had also forgotten to included time for conversion from list back to matrix for cumprod. Now as Chuck stated the results for Reduce are about the same or worse than a loop. regards--jeff

Re: [R] Matrix of dummies from a vector

2007-11-22 Thread Dimitris Rizopoulos
)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: "Serguei Kaniovski" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, November 22, 2007 11:14 AM

Re: [R] 'matrix' returns integer instead of decimal

2008-01-20 Thread Marc Schwartz
Brant Inman wrote: > R-helpers: > > I am experiencing some odd behavior with the 'matrix' function that I have > not experienced before and was wondering if there is something that I was > missing in my code. > > - > > sessionInfo() > R version 2.6.1 (2007-11-26

Re: [R] 'matrix' returns integer instead of decimal

2008-01-20 Thread Thomas Lumley
On Sun, 20 Jan 2008, Brant Inman wrote: > > Note the problems in rows 15, 21, 37 and 43. They should read [0.5, 45.5], > [14.5, 21.5], etc... The matrix function seems to be rounding the second > column up to the next integer. Why would this occur? Can I do something to > prevent this? > > I

Re: [R] 'matrix' returns integer instead of decimal

2008-01-20 Thread Henrik Bengtsson
Check your getOption("digits"). Default is typically 7. Either you or a package/function sets it to a small value. You get that **output** with options(digits=n) where n=1,2,3. /Henrik On Jan 20, 2008 7:13 PM, Thomas Lumley <[EMAIL PROTECTED]> wrote: > On Sun, 20 Jan 2008, Brant Inman wrote: >

Re: [R] 'matrix' returns integer instead of decimal

2008-01-20 Thread Brant Inman
*As usual, the R-helpers were bang on. Some package must have modified my digits option without me noticing.* ** *--* ** *> test <- matrix(c(7,47,4,38,20,96,1,14,10,48,2,101,12,161, + 1,28,1,19,22,49,25,162,31,200,9,39,22,193, + 0.5,45.5,31,131,4,75,31,220,7,55,3,91,14.5, + 25.5,3,

Re: [R] 'matrix' returns integer instead of decimal

2008-01-20 Thread Ben Bolker
Brant Inman gmail.com> writes: > > *As usual, the R-helpers were bang on. Some package must have modified my > digits option without me noticing.* I'm pretty certain that the arm package is the problem. > options("digits") $digits [1] 7 > library(arm) Loading required package: MASS Loadin

[R] Matrix starting at [0,0] instead of [1,1]?

2008-10-15 Thread Guillaume Filteau
Hello all, When I create a matrix, is there a way to make it start at [0,0], instead of [1,1]? That way, a 2x2 matrix would go from [0,0] to [1,1], instead of [1,1] to [2,2]. Best, Guillaume __ R-help@r-project.org mailing list https://stat.ethz.

Re: [R] Matrix entries not recognised as numeric

2007-09-17 Thread Paul Smith
On 9/17/07, snapperball <[EMAIL PROTECTED]> wrote: > I am using a number of large matrices in a project. I read a couple of the > matrices using the read.csv command. However in some instances, R does not > recognize the resulting matrices as consisting of numerical values (I > suspect R considers

Re: [R] Matrix entries not recognised as numeric

2007-09-17 Thread Ted Harding
On 17-Sep-07 13:18:10, snapperball wrote: > > Hello, > > I am using a number of large matrices in a project. I read a > couple of the matrices using the read.csv command. However > in some instances, R does not recognize the resulting matrices > as consisting of numerical values (I suspect R con

[R] Matrix package problem: dsyMatrix %*% vector gives error

2007-11-01 Thread Gerrit Eichner
Dear UseRs, here is an example scenario presenting my problem: Multiplying a dsyMatrix with a numeric vector results in an error (unfortunately in German due to my locale): > (M1 <- Matrix( c( 1, 2, 2, 2, 1, 2, 2, 2, 1), nrow = 3)) 3 x 3 Matrix of class "dsyMatrix" [,1] [,2] [,3] [1,]

Re: [R] Matrix package,solve() errors and crashes

2009-04-21 Thread Martin Maechler
> "SS" == Surendar Swaminathan > on Mon, 20 Apr 2009 12:10:47 -0700 writes: SS> Hello All, I am working on graph object using IGRAPH SS> package wanted to do Bonacich Power. This is my graph SS> object. SS> The file 'Graph.RData' (4.2 MB) is available for SS> dow

Re: [R] Matrix package,solve() errors and crashes

2009-04-22 Thread Surendar Swaminathan
Hello Martin, Thanks for looking in to the problem. My mistake, I pasted the code for sparse matrix for the graph that was created by test.g <- simplify(ba.game(1000,m=2)) What I was intending to show was I have a graph object "g" created by IGRPAH. Please find the link that has the graph objec

Re: [R] matrix subsetting assignment with logical mask

2009-07-16 Thread David Winsemius
On Jul 16, 2009, at 6:41 PM, Ross Boylan wrote: If m is a matrix and s is a logical matrix of the same dimensions, I'd like to be able to update m with m[s] <- 0 If m2 is another matrix, I'd also like to be able to do m[s] <- m2 where elements of m for which s is TRUE get the corresponding el

[R] matrix operations on grobs and grid units

2009-09-19 Thread baptiste auguie
Dear list, As a minimal test of a more complex grid layout, I'm trying to find a clean and efficient way to arrange text grobs in a rectangular layout. The labels may be expressions, or text with a fontsize different of the default, which means that the cell sizes should probably be calculated usi

[R] matrix with different type of column [SEC=UNCLASSIFIED]

2008-10-01 Thread ZHU, Justin
Hi, I would like to create a matrix. Say 5*4. The first column is integer, the second column is date, the third column is character and the rest columns are integers. So it's a combination of different types. I am wondering how can I do that? "matrix" command only allow one type. **

Re: [R] Matrix starting at [0,0] instead of [1,1]?

2008-10-15 Thread Gabor Grothendieck
If you are willing to use character instead of numeric you can: > xx <- matrix(1:4, 2, 2, dimnames = list(as.character(0:1), as.character(0:1))) > xx 0 1 0 1 3 1 2 4 > xx["0", "1"] [1] 3 On Wed, Oct 15, 2008 at 9:29 PM, Guillaume Filteau <[EMAIL PROTECTED]> wrote: > Hello all, > > When I creat

Re: [R] Matrix starting at [0,0] instead of [1,1]?

2008-10-15 Thread Rolf Turner
On 16/10/2008, at 2:29 PM, Guillaume Filteau wrote: Hello all, When I create a matrix, is there a way to make it start at [0,0], instead of [1,1]? That way, a 2x2 matrix would go from [0,0] to [1,1], instead of [1,1] to [2,2]. First, see fortune(36). Then, if you ***MUST***, install packag

Re: [R] Matrix package problem: dsyMatrix %*% vector gives error

2007-11-01 Thread Prof Brian Ripley
As the posting guide says: If you are using an old version of R and think it does not work properly. upgrade to the latest version and try that, before posting. This works in current R and current Matrix (0.999375-3) It also says If the question relates to a contributed package , e.g.,

Re: [R] matrix operations on grobs and grid units

2009-09-19 Thread baptiste auguie
A few amendments might make this improved code more readable, e = expression(alpha,"testing very large width", hat(beta), integral(f(x)*dx, a, b)) library(grid) rowMax.units <- function(u, nrow){ # rowMax with a fake matrix of units  matrix.indices <- matrix(seq_along(u), nrow=nrow)  do.call(uni

[R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Avraham . Adler
Hello. I am trying to invert a matrix, and I am finding that I can get different answers depending on whether I set LAPACK true or false using "qr". I had understood that LAPACK is, in general more robust and faster than LINPACK, so I am confused as to why I am getting what seems to be invalid an

Re: [R] matrix with different type of column [SEC=UNCLASSIFIED]

2008-10-02 Thread John Kane
?data.frame Lists and data.frames allow mixed components, matrices do not --- On Thu, 10/2/08, ZHU, Justin <[EMAIL PROTECTED]> wrote: > From: ZHU, Justin <[EMAIL PROTECTED]> > Subject: [R] matrix with different type of column [SEC=UNCLASSIFIED] > To: r-help@r-project.org

[R] matrix multiplication, tensor product, block-diagonal and fast computation

2009-03-11 Thread Camarda, Carlo Giovanni
Dear R-users, I am searching to the "best" way to compute a series of n matrix multiplications between each matrix (mXm) in an array (mXmXn), and each column of a matrix (mXn). Please find below an example with four possible solutions. The first is a simple for-loop which one might avoid; the se

Re: [R] Matrix package,solve() errors and crashes Please help

2009-05-15 Thread Surendar Swaminathan
> > Hello All, > Please help me with this problem.I have been having this problem for over a month now and I could not find any information.I later realised that error is with MATRIX package. I am working on graph object using IGRAPH version 0.5.2-2 package & wanted to do Bonacich Power. What I

Re: [R] Matrix package,solve() errors and crashes Please help

2009-05-16 Thread Martin Maechler
> "SS" == Surendar Swaminathan > on Fri, 15 May 2009 15:55:23 -0700 writes: >> Hello All, >> SS> Please help me with this problem.I have been having this problem for over a SS> month now and I could not find any information.I later realised that error SS> is wit

Re: [R] Matrix package,solve() errors and crashes Please help

2009-05-18 Thread Surendar Swaminathan
Hello Martin, Thank you very much for the reply. Thanks for solving the problem earlier I was not aware of it.I did not receive any message and that is what made me to post it again. Thank you once again. I will let the person know about the solve(a,Matrix(b)) I still have this doubt.I still g

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Avraham . Adler
Subject RE: [R] Matrix inversion-different answers from LAPACK a

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Albyn Jones
As you seem to be aware, the matrix is poorly conditioned: > kappa(PLLH,exact=TRUE) [1] 115868900869 It might be worth your while to think about reparametrizing. albyn On Wed, Jun 17, 2009 at 11:37:48AM -0400, avraham.ad...@guycarp.com wrote: > > Hello. > > I am trying to invert a matrix, and

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Douglas Bates
On Wed, Jun 17, 2009 at 2:02 PM, Albyn Jones wrote: > As you seem to be aware, the matrix is poorly conditioned: > >> kappa(PLLH,exact=TRUE) > [1] 115868900869 > > It might be worth your while to think about reparametrizing. Also, if it is to be a variance-covariance matrix then it must be positiv

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Avraham . Adler
am.ad...@guycarp.com, r-help@r-project.org 06/17/2009 05:55 Subject PM Re: [R] Matrix inversion-different answers fro

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Ravi Varadhan
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of avraham.ad...@guycarp.com Sent: Wednesday, June 17, 2009 6:11 PM To: Douglas Bates Cc: dmba...@gmail.com; r-help@r-project.org Subject: Re: [R] Matrix

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Ravi Varadhan
-help-boun...@r-project.org] On Behalf Of avraham.ad...@guycarp.com Sent: Wednesday, June 17, 2009 6:11 PM To: Douglas Bates Cc: dmba...@gmail.com; r-help@r-project.org Subject: Re: [R] Matrix inversion-different answers from LAPACK and LINPACK I will be the first one to admit I may be doing s

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-18 Thread Avraham . Adler
Subject RE: [R] Matrix inversion-different

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-18 Thread Ravi Varadhan
- Original Message - From: avraham.ad...@guycarp.com Date: Thursday, June 18, 2009 10:54 am Subject: RE: [R] Matrix inversion-different answers from LAPACK and LINPACK To: Ravi Varadhan Cc: r-help@r-project.org > Thank you. One question, though. In the case where I have closed form > f

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Ravi Varadhan
edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h tml -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of avraham.ad...@guycarp.com Sent: Wednesday, June

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Ravi Varadhan
alf Of avraham.ad...@guycarp.com Sent: Wednesday, June 17, 2009 11:38 AM To: r-help@r-project.org Subject: [R] Matrix inversion-different answers from LAPACK and LINPACK Hello. I am trying to invert a matrix, and I am finding that I can get different answers depending on whether I set LAPACK

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Avraham . Adler
cc Subject RE: [R] Matrix inversion-different

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Ravi Varadhan
eople/Faculty_personal_pages/Varadhan.h tml -Original Message- From: avraham.ad...@guycarp.com [mailto:avraham.ad...@guycarp.com] Sent: Wednesday, June 17, 2009 1:10 PM To: Ravi Varadhan Cc: r-help@r-project

[R] matrix inversion using solve() and matrices containing large/small values

2008-03-05 Thread gerardus vanneste
Hello I've stumbled upon a problem for inversion of a matrix with large values, and I haven't found a solution yet... I wondered if someone could give a hand. (It is about automatic optimisation of a calibration process, which involves the inverse of the information matrix) code: ***

Re: [R] matrix multiplication, tensor product, block-diagonal and fast computation

2009-03-12 Thread Charles C. Berry
On Wed, 11 Mar 2009, Camarda, Carlo Giovanni wrote: Dear R-users, I am searching to the "best" way to compute a series of n matrix multiplications between each matrix (mXm) in an array (mXmXn), and each column of a matrix (mXn). Please find below an example with four possible solutions. The fi

Re: [R] matrix multiplication, tensor product, block-diagonal and fast computation

2009-03-16 Thread Camarda, Carlo Giovanni
Thursday, March 12, 2009 4:25 PM To: Camarda, Carlo Giovanni Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] matrix multiplication, tensor product, block-diagonal and fast computation On Wed, 11 Mar 2009, Camarda, Carlo Giovanni wrote: > Dear R-users, > > I am searching to the "bes

[R] Matrix as input to xyplot {lattice} - proper extended formula syntax

2009-09-05 Thread Bryan Hanson
Hello R Folks... I have a list with the following structure: > str(df) List of 3 $ y: num [1:4, 1:1242] -0.005379 0.029874 -0.023274 0.000655 -0.004537 .. $ x: num [1:1242] 501 503 505 507 509 ... $ names: Factor w/ 4 levels "PC Loading 1",..: 1 2 3 4 I want to plot each row of df$y a

Re: [R] matrix inversion using solve() and matrices containing large/small values

2008-03-05 Thread Duncan Murdoch
On 3/5/2008 8:21 AM, gerardus vanneste wrote: > Hello > > I've stumbled upon a problem for inversion of a matrix with large values, > and I haven't found a solution yet... I wondered if someone could give a > hand. (It is about automatic optimisation of a calibration process, which > involves the

Re: [R] matrix inversion using solve() and matrices containing large/small values

2008-03-05 Thread Charilaos Skiadas
Sorry, I meant to send this to the whole list. On Mar 5, 2008, at 8:46 AM, Charilaos Skiadas wrote: > The problem doesn't necessarily have to do with the range of data. > At first level, it has to do with the simple fact that dfdb has > rank 6 at most, (7 at most in general, though in your ca

Re: [R] matrix inversion using solve() and matrices containing large/small values

2008-03-05 Thread Douglas Bates
On Wed, Mar 5, 2008 at 7:43 AM, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > On 3/5/2008 8:21 AM, gerardus vanneste wrote: > > Hello > > > > I've stumbled upon a problem for inversion of a matrix with large values, > > and I haven't found a solution yet... Someone with experience in numerical l

Re: [R] Matrix as input to xyplot {lattice} - proper extended formula syntax

2009-09-05 Thread David Winsemius
I'm not exactly sure what structure df has. Here's my effort to duplicate it: df <- data.frame(y=matrix(rnorm(24), nrow=6), x=1:6) > df y.1y.2y.3y.4 x 1 0.1734636 0.2348417 -1.2375648 -1.3246439 1 2 1.9551669 -1.1027262 -0.7307332 0.3953752 2 3 -0.7645778 1

Re: [R] Matrix as input to xyplot {lattice} - proper extended formula syntax

2009-09-05 Thread Bryan Hanson
Thanks David, your way of constructing df is much more compact than what I was using, so I've incorporated it. I also had my rows and columns transposed relative to how xyplot wanted them (though I had tested for that, other problems interfered). In my case, I may have varying numbers of y column

Re: [R] Matrix as input to xyplot {lattice} - proper extended formula syntax

2009-09-05 Thread Gabor Grothendieck
For the example df below this also works: library(lattice); library(zoo) xyplot(zoo(df[1:4], df$x), type = "p") On Sun, Sep 6, 2009 at 12:51 AM, David Winsemius wrote: > I'm not exactly sure what structure df has. Here's my effort to duplicate > it: > > df <- data.frame(y=matrix(rnorm(24), nrow=6

Re: [R] Matrix as input to xyplot {lattice} - proper extended formula syntax

2009-09-06 Thread Deepayan Sarkar
On Sat, Sep 5, 2009 at 10:43 PM, Bryan Hanson wrote: > Thanks David, your way of constructing df is much more compact than what I > was using, so I've incorporated it.  I also had my rows and columns > transposed relative to how xyplot wanted them (though I had tested for that, > other problems int

Re: [R] Matrix as input to xyplot {lattice} - proper extended formula syntax

2009-09-06 Thread David Winsemius
On Sep 6, 2009, at 12:51 AM, David Winsemius wrote: I'm not exactly sure what structure df has. Here's my effort to duplicate it: df <- data.frame(y=matrix(rnorm(24), nrow=6), x=1:6) > df y.1y.2y.3y.4 x 1 0.1734636 0.2348417 -1.2375648 -1.3246439 1 2 1.9551

[R] Matrix _0.999375-14 "Note" under CRAN Check, Hmisc_3.4-3 has Warning, Dpackage_1.0-5 has an Error

2008-09-24 Thread NManganaro
As context, I am a newbie, but preparing for a moderately deep dive into new areas af analysis while becoming familiar with R, at the same time. I have looked at the dependencies, amd imports for the Baysean and Econometrics View related analytics in R and have found that the Matrix package refere

[R] Matrix _0.999375-14 "Note" under CRAN Check, Hmisc_3.4-3 has "Warning", Dpackage_1.0-5 has an "Error"

2008-09-25 Thread n . manganaro
Sorrry for re-sending this message as 1) a non-subscriber initially, then 2) from an un-subscribed e-mail. As context, I am a newbie, but preparing for a moderately deep dive into new areas af analysis while becoming familiar with R, at the same time. I have looked at the dependencies, amd im

<    1   2   3