Re: [R] Matrix Multiplication, Floating-Point, etc.

2007-07-31 Thread Daniel Nordlund
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Talbot Katz Sent: Monday, July 30, 2007 10:55 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Subject: Re: [R] Matrix Multiplication, Floating-Point, etc. Thank you

Re: [R] Matrix Multiplication, Floating-Point, etc.

2007-07-31 Thread Prof Brian Ripley
-5351 cell From: Charles C. Berry [EMAIL PROTECTED] To: Talbot Katz [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] Matrix Multiplication, Floating-Point, etc. Date: Mon, 30 Jul 2007 09:27:42 -0700 7.31 Why doesn't R think these numbers are equal? On Fri, 27 Jul 2007

[R] Matrix nesting (was Re: Obtaining summary of frequencies of value occurrences for a variable in a multivariate dataset.)

2007-07-30 Thread Allan Kamau
Hi !-- @page { size: 21cm 29.7cm; margin: 2cm } P { margin-bottom: 0.21cm } -- I would like to nest matrices, is there a way of doing so, I am getting “number of items to replace is not

[R] Matrix Multiplication, Floating-Point, etc.

2007-07-30 Thread Talbot Katz
Hi. I recently tried the following in R 2.5.1 on Windows XP: ev2-c(0.8,-0.6) ev1-c(0.6,0.8) ev1%*%ev2 [,1] [1,] -2.664427e-17 sum(ev1*ev2) [1] 0 (I got the same result with R 2.4.1 on a different Windows XP machine.) I expect this issue is very familiar and probably has been

[R] matrix output in R, and file name creating

2007-07-30 Thread Dong GUO 郭东
Hi, I want to save a matrix (say, matrix[6,7,8]) write a cvs file. How can I do that??? can I write in one file? if I could not write in one file, i want to use a loop to save in different files (in the matrix[6,7,8], should be 8 csv files), such as the filename structure should be: file

Re: [R] Matrix Multiplication, Floating-Point, etc.

2007-07-30 Thread Doran, Harold
Of Talbot Katz Sent: Friday, July 27, 2007 6:31 PM To: r-help@stat.math.ethz.ch Subject: [R] Matrix Multiplication, Floating-Point, etc. Hi. I recently tried the following in R 2.5.1 on Windows XP: ev2-c(0.8,-0.6) ev1-c(0.6,0.8) ev1%*%ev2 [,1] [1,] -2.664427e-17 sum(ev1*ev2

Re: [R] Matrix nesting (was Re: Obtaining summary of frequencies of value occurrences for a variable in a multivariate dataset.)

2007-07-30 Thread Allan Kamau
someList-list(frequency=residuesFrequencies) x[i]-someList } #The output x[16:18] $PR12 I 10 $PR13 K R 8 2 $PR14 I V 2 8 - Original Message From: Patrick Burns [EMAIL PROTECTED] To: Allan Kamau [EMAIL PROTECTED] Sent: Monday, July 30, 2007 12:01:32 PM Subject: Re: [R

Re: [R] Matrix Multiplication, Floating-Point, etc.

2007-07-30 Thread Charles C. Berry
7.31 Why doesn't R think these numbers are equal? On Fri, 27 Jul 2007, Talbot Katz wrote: Hi. I recently tried the following in R 2.5.1 on Windows XP: ev2-c(0.8,-0.6) ev1-c(0.6,0.8) ev1%*%ev2 [,1] [1,] -2.664427e-17 sum(ev1*ev2) [1] 0 (I got the same result with R

Re: [R] Matrix Multiplication, Floating-Point, etc.

2007-07-30 Thread Talbot Katz
@stat.math.ethz.ch Subject: Re: [R] Matrix Multiplication, Floating-Point, etc. Date: Mon, 30 Jul 2007 09:27:42 -0700 7.31 Why doesn't R think these numbers are equal? On Fri, 27 Jul 2007, Talbot Katz wrote: Hi. I recently tried the following in R 2.5.1 on Windows XP: ev2-c(0.8,-0.6) ev1-c(0.6,0.8

Re: [R] Matrix Multiplication, Floating-Point, etc.

2007-07-30 Thread Doran, Harold
, Harold Subject: Re: [R] Matrix Multiplication, Floating-Point, etc. Thank you for responding! I realize that floating point operations are often inexact, and indeed, the difference between the two answers is within the all.equal tolerance, as mentioned in FAQ 7.31 (cited by Charles

Re: [R] Matrix Multiplication, Floating-Point, etc.

2007-07-30 Thread jim holtman
] CC: r-help@stat.math.ethz.ch Subject: Re: [R] Matrix Multiplication, Floating-Point, etc. Date: Mon, 30 Jul 2007 09:27:42 -0700 7.31 Why doesn't R think these numbers are equal? On Fri, 27 Jul 2007, Talbot Katz wrote: Hi. I recently tried the following in R 2.5.1 on Windows XP

Re: [R] Matrix Multiplication, Floating-Point, etc.

2007-07-30 Thread Moshe Olshansky
of significant digits. -- TMK -- 212-460-5430 home 917-656-5351 cell From: Charles C. Berry [EMAIL PROTECTED] To: Talbot Katz [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] Matrix Multiplication, Floating-Point, etc. Date: Mon, 30 Jul 2007 09:27:42 -0700

[R] matrix of scatterplots

2007-07-12 Thread livia
Hi, I would like to use the function pairs() to plot a matrix of scatterplots. For each scatterplot, the data are plotted in circles, can I add some argument to change the circles into dots? Could anyone give me some advice?Many thanks -- View this message in context:

Re: [R] matrix of scatterplots

2007-07-12 Thread Adaikalavan Ramasamy
m - matrix( rnorm(300), nc=3 ) pairs(m, pch=20) or pairs(m, pch=.) See help(par) for more details. livia wrote: Hi, I would like to use the function pairs() to plot a matrix of scatterplots. For each scatterplot, the data are plotted in circles, can I add some argument to change the circles

Re: [R] matrix of scatterplots

2007-07-12 Thread livia
Thank you very much for your help. Adaikalavan Ramasamy wrote: m - matrix( rnorm(300), nc=3 ) pairs(m, pch=20) or pairs(m, pch=.) See help(par) for more details. livia wrote: Hi, I would like to use the function pairs() to plot a matrix of scatterplots. For each scatterplot, the

[R] matrix of bins with different length

2007-07-10 Thread Balazs Torma
Dear users, please help to define the following data structure: I would like to have a matrix, where every element is a container of different size , containing real numbers. The containers (bins) are addressed by an index pair [i,j] (i is number of corresponding row of the matrix, j

Re: [R] matrix of bins with different length

2007-07-10 Thread Gabor Grothendieck
Try this: m - matrix(list(1, 1:2, 1:3, 1:4), 2) m[[1,1]] [1] 1 m[[2,1]] [1] 1 2 m [,1] [,2] [1,] 1 Integer,3 [2,] Integer,2 Integer,4 On 7/10/07, Balazs Torma [EMAIL PROTECTED] wrote: Dear users, please help to define the following data structure: I would like to

[R] Matrix multiplication (with multidimensional array)

2007-06-24 Thread Tong Wang
Hi All, I am wondering if there is an efficient way to do the following matrix multiplication, a[1,,] 1, 2 3, 4 a[2,,] 4, 3 2, 1 b[1,,]5,6 7,8 b[2,,]8,7 6,5 I need the result c, with c[1,,] =

[R] Matrix library, CHOLMOD error: problem too large

2007-06-22 Thread Jose Quesada
I have a pretty large sparse matrix of integers: dim(tasa) [1] 91650 37651 I need to add one to it in order to take logs, but I'm getting the following error: tasa = log(tasa + 1) CHOLMOD error: problem too large Error in asMethod(object) : Cholmod error `problem too large' I have 2 Gb of

Re: [R] Matrix library, CHOLMOD error: problem too large

2007-06-22 Thread Duncan Murdoch
On 6/22/2007 1:26 PM, Jose Quesada wrote: I have a pretty large sparse matrix of integers: dim(tasa) [1] 91650 37651 I need to add one to it in order to take logs, but I'm getting the following error: tasa = log(tasa + 1) CHOLMOD error: problem too large Error in asMethod(object) :

Re: [R] Matrix *package*, CHOLMOD error: problem too large

2007-06-22 Thread Martin Maechler
[Jose, if you call the Matrix *package* library once more, ... GR! ..] DM == Duncan Murdoch [EMAIL PROTECTED] on Fri, 22 Jun 2007 14:04:03 -0400 writes: DM On 6/22/2007 1:26 PM, Jose Quesada wrote: I have a pretty large sparse matrix of integers: dim(tasa) [1]

Re: [R] Matrix library error: should never happen; please report

2007-06-20 Thread Martin Maechler
Hi Jose, JQ == Jose Quesada [EMAIL PROTECTED] on Tue, 19 Jun 2007 21:12:53 +0200 writes: JQ Hi, I got the following error. Sorry but this time I JQ couldn't reproduce it with a simple chunk of code: .TM.repl.i.2col(): drop 'matrix' case ... Error in .nextMethod(x = x, i = i, j

[R] Matrix library error: should never happen; please report

2007-06-19 Thread Jose Quesada
Hi, I got the following error. Sorry but this time I couldn't reproduce it with a simple chunk of code: .TM.repl.i.2col(): drop 'matrix' case ... Error in .nextMethod(x = x, i = i, j = j) : 'i' has no integer column number should never happen; please report In addition: Warning

[R] matrix and data frame

2007-06-08 Thread elyakhlifi mustapha
hello, I have just a question before the week end it's that I don't know how to do to paste matrixs and these matrix they have one same column and I'd like to paste its by this column and I wanna paste its not below but just at right side hand thanks good week end

Re: [R] matrix and data frame

2007-06-08 Thread Sarah Goslee
I'm not at all certain I understand your question, but try ?cbind Sarah On 6/8/07, elyakhlifi mustapha [EMAIL PROTECTED] wrote: hello, I have just a question before the week end it's that I don't know how to do to paste matrixs and these matrix they have one same column and I'd like to

[R] matrix in data.frame

2007-05-30 Thread Lina Hultin-Rosenberg
Dear list! I have run into a problem that seems very simple but I can't find any solution to it (have searched the internet, help-files and An introduction to R etc without any luck). The problem is the following: I would like to create a data.frame with two components (columns), the first

Re: [R] matrix in data.frame

2007-05-30 Thread michael watson \(IAH-C\)
10 x$b [1] 1 2 3 4 5 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lina Hultin-Rosenberg Sent: 30 May 2007 10:26 To: r-help@stat.math.ethz.ch Subject: [R] matrix in data.frame Dear list! I have run into a problem that seems very simple but I can't

Re: [R] matrix in data.frame

2007-05-30 Thread Prof Brian Ripley
You need to use I() or something similar. E.g. A - matrix(1:6, 2,3) data.frame(x=1:2, I(A)) X - data.frame(x=1:2) X$A - A both insert A as a single column. On Wed, 30 May 2007, Lina Hultin-Rosenberg wrote: Dear list! I have run into a problem that seems very simple but I can't find any

Re: [R] matrix in data.frame

2007-05-30 Thread Lina Hultin-Rosenberg
Thank you so much for your help, it worked of course! Best regards, Lina Hultin-Rosenberg -Ursprungligt meddelande- Från: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Skickat: den 30 maj 2007 12:44 Till: Lina Hultin-Rosenberg Kopia: r-help@stat.math.ethz.ch Ämne: Re: [R] matrix

Re: [R] Matrix package: writeMM

2007-05-17 Thread Douglas Bates
On 5/15/07, Jose Quesada [EMAIL PROTECTED] wrote: Hi, I'm finding that readMM() cannot read a file written with writeMM(). Example: library(Matrix) a = Matrix(c(1,0,3,0,0,5), 10, 10) a = as(a, CsparseMatrix) writeMM(a, kk.mm) b = readMM(kk.mm) Error in validObject(.Object) : invalid

[R] Matrix package: writeMM

2007-05-15 Thread Jose Quesada
Hi, I'm finding that readMM() cannot read a file written with writeMM(). Example: library(Matrix) a = Matrix(c(1,0,3,0,0,5), 10, 10) a = as(a, CsparseMatrix) writeMM(a, kk.mm) b = readMM(kk.mm) Error in validObject(.Object) : invalid class dgTMatrix object: all row indices must be between 0

[R] Matrix column name

2007-05-01 Thread alex lam \(RI\)
Dear R users, Having searched the mail archive I think the conclusion was that it is not possible to have a column name when there is only one column in the matrix. But I thought I'd check with the more experienced users. What I tried to do was: in a loop I pick a column, record the column name

Re: [R] Matrix column name

2007-05-01 Thread Marc Schwartz
On Tue, 2007-05-01 at 18:03 +0100, alex lam (RI) wrote: Dear R users, Having searched the mail archive I think the conclusion was that it is not possible to have a column name when there is only one column in the matrix. But I thought I'd check with the more experienced users. What I

Re: [R] Matrix column name

2007-05-01 Thread Prof Brian Ripley
You seem to be looking for matrix.a[,-1, drop = TRUE] On Tue, 1 May 2007, alex lam (RI) wrote: Dear R users, Having searched the mail archive I think the conclusion was that it is not possible to have a column name when there is only one column in the matrix. But I thought I'd check with

[R] Matrix: how to re-use the symbolic Cholesky factorization?

2007-04-24 Thread Gardar Johannesson
I have been playing around with sparse matrices in the Matrix package, in particularly with the Cholesky factorization of matrices of class dsCMatrix. And BTW, what a fantastic package. My problem is that I have to carry out repeated Cholesky factorization of a spares symmetric matrices, say

Re: [R] Matrix: how to re-use the symbolic Cholesky factorization?

2007-04-24 Thread Douglas Bates
On 4/24/07, Gardar Johannesson [EMAIL PROTECTED] wrote: I have been playing around with sparse matrices in the Matrix package, in particularly with the Cholesky factorization of matrices of class dsCMatrix. And BTW, what a fantastic package. My problem is that I have to carry out repeated

Re: [R] Matrix or grid conversion of spatial data

2007-04-20 Thread ONKELINX, Thierry
, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Marco Visser Verzonden: woensdag 18 april 2007 20:57 Aan: r-help@stat.math.ethz.ch Onderwerp: [R] Matrix or grid conversion

[R] matrix building with two variables

2007-04-19 Thread Schmitt, Corinna
Dear R-Experts, I have two variables coming from my calculations: Tissues -- WT sun41 Revertante NullPoint -- 0.826 0.871 0.859 Now I want to build a matrix, where row1=Tissues and row2=NullPoint is. How can I realize this? Thanks, Corinna __

Re: [R] Matrix or grid conversion of spatial data

2007-04-19 Thread John Kane
--- Marco Visser [EMAIL PROTECTED] wrote: Dear Happy R-users experts, I am in need of advice, While working with spatial data (x y coordinates of seed locations) I have come accross the problem that I need to convert my point data into a matrix or grid system. I then need to count how

Re: [R] matrix building with two variables

2007-04-19 Thread Julien Barnier
Now I want to build a matrix, where row1=Tissues and row2=NullPoint is. How can I realize this? ?rbind It seems you ask a lot of questions these times on the list. Maybe you should read the R mailing lists posting guide, it contains useful resources which could help you to find the answers by

Re: [R] matrix building with two variables

2007-04-19 Thread Schmitt, Corinna
, 19. April 2007 14:02 An: r-help@stat.math.ethz.ch Betreff: Re: [R] matrix building with two variables Now I want to build a matrix, where row1=Tissues and row2=NullPoint is. How can I realize this? ?rbind It seems you ask a lot of questions these times on the list. Maybe you should read the R

Re: [R] matrix building with two variables

2007-04-19 Thread Julien Barnier
Hi, I did read everything I could but could not understand everything. Hopefully with more programming practice it will become more less. Then maybe you read everything you could a bit too fast. Because the answer to your question is in the first document to read, An introduction to R, section

Re: [R] matrix building with two variables

2007-04-19 Thread Hans-Peter
2007/4/19, Schmitt, Corinna [EMAIL PROTECTED]: Thanks. I did read everything I could but could not understand everything. Hopefully with more programming practice it will become more less. Here is a great book: Uwe Ligges: Programmieren mit R. worth every Rappen :-)

[R] Matrix or grid conversion of spatial data

2007-04-18 Thread Marco Visser
Dear Happy R-users experts, I am in need of advice, While working with spatial data (x y coordinates of seed locations) I have come accross the problem that I need to convert my point data into a matrix or grid system. I then need to count how often a point falls into a certain position in

Re: [R] Matrix or grid conversion of spatial data

2007-04-18 Thread Charles C. Berry
On Wed, 18 Apr 2007, Marco Visser wrote: Dear Happy R-users experts, I am in need of advice, While working with spatial data (x y coordinates of seed locations) I have come accross the problem that I need to convert my point data into a matrix or grid system. I then need to count how

[R] Matrix manipulation

2007-04-16 Thread Markku Karhunen
Hi, This is a very basic question, but apparently I am too stupid for it. I have a large matrix A, and I need to avoid for loops. How could I apply a function f(a,r,c) on each element of A, using the subscript (row and column) of a as the other arguments? Thanks in advance, Markku Karhunen

Re: [R] Matrix manipulation

2007-04-16 Thread Dimitris Rizopoulos
@stat.math.ethz.ch Sent: Monday, April 16, 2007 2:52 PM Subject: [R] Matrix manipulation Hi, This is a very basic question, but apparently I am too stupid for it. I have a large matrix A, and I need to avoid for loops. How could I apply a function f(a,r,c) on each element of A, using the subscript

Re: [R] Matrix manipulation

2007-04-16 Thread Petr PIKAL
[EMAIL PROTECTED] napsal dne 16.04.2007 14:52:55: Hi, This is a very basic question, but apparently I am too stupid for it. I have a large matrix A, and I need to avoid for loops. How could I apply a function f(a,r,c) on each element of A, using the subscript (row and column) of a as

Re: [R] Matrix manipulation

2007-04-16 Thread Markku Karhunen
/dimitris.htm - Original Message - From: Markku Karhunen [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, April 16, 2007 2:52 PM Subject: [R] Matrix manipulation Hi, This is a very basic question, but apparently I am too stupid for it. I have a large matrix A, and I need

[R] matrix construction

2007-03-26 Thread Schmitt, Corinna
Hallo, can anyone tell me how I can create a matrix in R? I have two arrays A = c(0:3), B=c(0:3). C should be the matrix. I just found the description that a matrix is just an array with two substricpts. Thanks, Corinna __ R-help@stat.math.ethz.ch

Re: [R] matrix construction

2007-03-26 Thread ONKELINX, Thierry
2007 11:34 Aan: r-help@stat.math.ethz.ch Onderwerp: [R] matrix construction Hallo, can anyone tell me how I can create a matrix in R? I have two arrays A = c(0:3), B=c(0:3). C should be the matrix. I just found the description that a matrix is just an array with two substricpts

[R] matrix similarity comparison

2007-03-19 Thread Carlos Guerra
Good morning to you all, I have a problem with a set of matrices that I want to compare. I want to see the similarity between them, and to be able to extract the differences between them. They have all the same number of columns and rows, and correspond presence absence data: for example:

Re: [R] matrix similarity comparison

2007-03-19 Thread Matthew Keller
hi Carlos, its not really clear what you're asking here. If all you want is to see what entries are the same and which are different between two matrices of the same dimensions, then this does it: #same m1==m2 #diff m1 != m2 If you want to extract the ones that are the same, indx - m1==m2 indx

Re: [R] matrix similarity comparison

2007-03-19 Thread Sarah Goslee
Hi Carlos, I want to see the similarity between them, and to be able to extract the differences between them. You need to explain a bit more. Are you looking for number of elements in common? How are your data set up? (eg species as columns and sites as rows) One way to get number of joint

Re: [R] matrix similarity comparison

2007-03-19 Thread Sarah Goslee
On 3/19/07, Sarah Goslee [EMAIL PROTECTED] wrote: Hi Carlos, I want to see the similarity between them, and to be able to extract the differences between them. You need to explain a bit more. Are you looking for number of elements in common? How are your data set up? (eg species as

Re: [R] matrix similarity comparison

2007-03-19 Thread Carlos Guerra
Let me see if I can explain my problem better, I have: m1 - matrix(c(1,0,0,0,1,0,1,1,1,1,1,1), 3, 4) rownames(m1) - c(station1, station2, station3) colnames(m1) - c(A,B,C,D) m2 - matrix(c(1,0,1,1,1,0,1,1,0,0,1,1), 3, 4) rownames(m2) - c(station1, station2, station3) colnames(m2) - c(A,B,C,D)

[R] Matrix conversion question

2007-03-09 Thread Johannes Graumann
Hello, Please help - I'm blanking on this ... I have a matrix like this: [,1] [,2] [1,]12 [2,]13 [3,]23 and would like to have a list of vectors, where a vector contains the entries in a matrix row ... Can somebody nudge me to the place I need to go? Thanks, Joh

Re: [R] Matrix conversion question

2007-03-09 Thread Christos Hatzis
Try split(x, row(x)) -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Johannes Graumann Sent: Friday, March 09, 2007 10:30 AM To: r-help@stat.math.ethz.ch Subject: [R] Matrix conversion question Hello, Please help - I'm blanking

Re: [R] Matrix conversion question

2007-03-09 Thread Johannes Graumann
Christos Hatzis wrote: Try split(x, row(x)) H! THE ELEGANCE! Thanks a lot! Joh __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Matrix/dataframe indexing

2007-03-06 Thread Marc Schwartz
On Mon, 2007-03-05 at 12:49 -0500, Guenther, Cameron wrote: Hi all, I am hoping someone can help me out with this: If I have dataframe of years and ages and the first column and first row are filled with leading values: Df- age1age2age3 Yr1 1 0.4

[R] Matrix/dataframe indexing

2007-03-05 Thread Guenther, Cameron
Hi all, I am hoping someone can help me out with this: If I have dataframe of years and ages and the first column and first row are filled with leading values: Df-age1age2age3 Yr1 1 0.4 0.16 Yr2 1.5 0 0 Yr3 0.9 0 0

[R] Matrix looping

2007-03-02 Thread Guenther, Cameron
Hi all, I am having a problem getting my fucntion to work correctly. Here is my problem. I have three ages: Nage-c(1,2,3) I have an weight matrix: Wt-c( 0.04952867, 0.23808432, 0.34263880) I have an age schedule of maturity: Mat-c(0,1,1) where 0 is not mature, and 1 is mature I have a

[R] Matrix Library failing to load

2007-03-01 Thread Luwis Diya
Dear R users I am trying to load the package lmer4 but it seems the Matrix library is failing to load and giving me the following error message : library(Matrix) Error in importIntoEnv(impenv, impnames, ns, impvars) : object 'Logic' is not exported by 'namespace:methods' Error:

[R] matrix manipulations

2007-02-28 Thread Anup Nandialath
Dear friends, I have a basic question with R. I'm generating a set of random variables and then combining them using the cbind statement. The code for that is given below. for (i in 1:100) { y - rpois(i,lambda=10) X0 - seq(1,1,length=i) X1 - rnorm(i,mean=5,sd=10) X2 -

Re: [R] matrix manipulations

2007-02-28 Thread Peter Dalgaard
Anup Nandialath wrote: Dear friends, I have a basic question with R. I'm generating a set of random variables and then combining them using the cbind statement. The code for that is given below. for (i in 1:100) { y - rpois(i,lambda=10) X0 - seq(1,1,length=i) X1 -

Re: [R] matrix manipulations

2007-02-28 Thread Alberto Monteiro
Anup Menon Nandialath wrote: I have a basic question with R. I'm generating a set of random variables and then combining them using the cbind statement. The code for that is given below. for (i in 1:100) { y - rpois(i,lambda=10) X0 - seq(1,1,length=i) X1 -

Re: [R] matrix manipulations

2007-02-28 Thread Petr Klasterecky
Don't know what's wrong - it works: data100 y X0 X1 X2 X3 ind [1,] 11 1 2.79581511 -23.5477 -33.6123061 1 [2,] 8 1 21.43289242 21.52826214 3.8415209 2 [3,] 6 1 6.18688631 21.51057247 -50.5547410 3 [4,] 12 1 -5.95172686

[R] Matrix manipulation

2007-02-13 Thread yoooooo
Hi, let's say I have this A = matrix(c(1, 2, 4), nrow=1) colnames(A)=c(YOO1, YOO2, YOO3) # ie # YOO1 YOO2 YOO3 #[1,]124 HELLO - NULL HELLO$YOO1=BOO HELLO$YOO2=BOO HELLO$YOO3=HOO and I want a matrix that will sum my categorization.. how can I do it efficiently without any

[R] Matrix manipulation

2007-02-13 Thread yoooooo
Hi, let's say I have this A = matrix(c(1, 2, 4), nrow=1) colnames(A)=c(YOO1, YOO2, YOO3) # ie # YOO1 YOO2 YOO3 #[1,]124 HELLO - NULL HELLO$YOO1=BOO HELLO$YOO2=BOO HELLO$YOO3=HOO and I want a matrix that will sum my categorization.. how can I do it efficiently without any

Re: [R] Matrix manipulation

2007-02-13 Thread Giovanni Petris
Hi, let's say I have this A = matrix(c(1, 2, 4), nrow=1) colnames(A)=c(YOO1, YOO2, YOO3) Why do you need A to be a matrix and not simply a vector? # ie # YOO1 YOO2 YOO3 #[1,]124 HELLO - NULL HELLO$YOO1=BOO HELLO$YOO2=BOO HELLO$YOO3=HOO Why do you need HELLO

[R] matrix of matrices

2007-02-01 Thread Federico Abascal
Dear all, it is likely a stupid question but I cannot solve it. I want to have a matrix of 100 elements. Each element must be a vector of 500 elements. If I do: imp-array(dim=100) imp[1]-vector(length=500) it does not work. Warning message: number of items to replace is not a multiple

Re: [R] matrix of matrices

2007-02-01 Thread Federico Abascal
For the case someone is interested in it, here it is the solution somebody suggested me: to use a list. imp - vector(list, 100) imp[[1]] - im[1:500,] names(imp[[1]]) = the list of labels of imp[1:500,] Thanks! Federico Federico Abascal wrote: Dear all, it is likely a stupid question but I

Re: [R] Matrix question: obtaining the square root of a positive definite matrix?

2007-01-24 Thread Prof Brian Ripley
On Wed, 24 Jan 2007, gallon li wrote: I want to compute B=A^{1/2} such that B*B=A. According to your subject line A is positive definite and hence symmetric? The usual definition of a matrix square root involves a transpose, e.g. B'B = A. There are many square roots: were you looking for a

Re: [R] Matrix question: obtaining the square root of a positive definite matrix?

2007-01-24 Thread Peter Dalgaard
Prof Brian Ripley wrote: On Wed, 24 Jan 2007, gallon li wrote: I want to compute B=A^{1/2} such that B*B=A. According to your subject line A is positive definite and hence symmetric? The usual definition of a matrix square root involves a transpose, e.g. B'B = A. There are

[R] Matrix subsetting {was ... vectorized nested loop...}

2007-01-24 Thread Martin Maechler
Hi Jose, I'm answering your second batch of questions, since Chuck Berry has already well done so with the first one Jose == Jose Quesada [EMAIL PROTECTED] on Tue, 23 Jan 2007 21:46:27 +0100 writes: [] Jose # example Jose library(Matrix) Jose x = as(x,CsparseMatrix)

[R] Matrix operations in a list

2007-01-23 Thread Doran, Harold
I have matrices stored within a list like something as follows: a - list(matrix(rnorm(50), ncol=5), matrix(rnorm(50), ncol=5)) b - list(matrix(rnorm(50), nrow=5), matrix(rnorm(50), nrow=5)) I don't recall how to perform matrix multiplication on each list element such that the result is a new

Re: [R] Matrix operations in a list

2007-01-23 Thread Marc Schwartz
On Tue, 2007-01-23 at 10:21 -0500, Doran, Harold wrote: I have matrices stored within a list like something as follows: a - list(matrix(rnorm(50), ncol=5), matrix(rnorm(50), ncol=5)) b - list(matrix(rnorm(50), nrow=5), matrix(rnorm(50), nrow=5)) I don't recall how to perform matrix

Re: [R] Matrix operations in a list

2007-01-23 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: Doran, Harold [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Tuesday, January 23, 2007 4:21 PM Subject: [R] Matrix operations

Re: [R] Matrix operations in a list

2007-01-23 Thread Christos Hatzis
Try, mapply('%*%', a, b, SIMPLIFY=FALSE) -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doran, Harold Sent: Tuesday, January 23, 2007 10:22 AM To: r-help@stat.math.ethz.ch Subject: [R] Matrix operations in a list I have matrices stored

[R] Matrix question: obtaining the square root of a positive definite matrix?

2007-01-23 Thread gallon li
I want to compute B=A^{1/2} such that B*B=A. For example a=matrix(c(1,.2,.2,.2,1,.2,.2,.2,1),ncol=3) so a [,1] [,2] [,3] [1,] 1.0 0.2 0.2 [2,] 0.2 1.0 0.2 [3,] 0.2 0.2 1.0 a%*%a [,1] [,2] [,3] [1,] 1.08 0.44 0.44 [2,] 0.44 1.08 0.44 [3,] 0.44 0.44 1.08 b=a%*%a i have

[R] matrix size

2007-01-01 Thread Armelini, Guillermo
Hello everyone Could anybody tell me how to set the following matrix? n2-matrix(nrow=10185,ncol=10185,seq(0,0,length=103734225)) R answer was Error: cannot allocate vector of size 810423 Kb Are there any solution? I tried to increase the memory size but it didn't work G This message has

Re: [R] matrix size

2007-01-01 Thread Martin Maechler
GArmelini == Armelini, Guillermo [EMAIL PROTECTED] on Mon, 1 Jan 2007 23:43:31 +0100 writes: GArmelini Hello everyone Could anybody tell me how to set GArmelini the following matrix? GArmelini n2-matrix(nrow=10185,ncol=10185,seq(0,0,length=103734225)) GArmelini R answer

Re: [R] matrix size

2007-01-01 Thread roger koenker
On Jan 1, 2007, at 4:43 PM, Armelini, Guillermo wrote: Hello everyone Could anybody tell me how to set the following matrix? n2-matrix(nrow=10185,ncol=10185,seq(0,0,length=103734225)) You can use: library(SparseM) as.matrix.coo(0,10185,10185) but then you need to find something

[R] matrix - change values

2006-12-14 Thread robert-mcfadden
Dear R Users, I have a matrix A, and I want to change every value of this matrix if these values are greater than an assuming value. For a vector it is simple, e.g. a-c(1:10); a[a5]-0. Of course, I can change matrix to vector, assign a value then change vector to matrix. But does there exist

Re: [R] matrix - change values

2006-12-14 Thread Duncan Murdoch
[EMAIL PROTECTED] wrote: Dear R Users, I have a matrix A, and I want to change every value of this matrix if these values are greater than an assuming value. For a vector it is simple, e.g. a-c(1:10); a[a5]-0. Of course, I can change matrix to vector, assign a value then change vector to

Re: [R] matrix - change values

2006-12-14 Thread apjaworski
cc Subject 12/14/2006 08:01 [R] matrix - change values AM

Re: [R] matrix - change values

2006-12-14 Thread robert-mcfadden
I would like to thanks everybody for helpful suggestion. Rob Od: [EMAIL PROTECTED] Do: r-help@stat.math.ethz.ch Data: 14 grudnia 2006 15:01 Temat: [R] matrix - change values Dear R Users, I have a matrix A, and I want to change every value of this matrix if these values are greater than

Re: [R] matrix - change values

2006-12-14 Thread Greg Snow
PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, December 14, 2006 7:01 AM To: r-help@stat.math.ethz.ch Subject: [R] matrix - change values Dear R Users, I have a matrix A, and I want to change every

[R] matrix comparison, and cbind issues.

2006-11-29 Thread H. Paul Benton
Hello, This should be a fairly simple question. I have 2 matrix's and I want to get the difference between them and then remove the difference from one of them. So A vs B, anything I see in B I want to remove from A, and then print out the final matrix. I have some code here but at the moment

Re: [R] matrix comparison, and cbind issues.

2006-11-29 Thread H. Paul Benton
this and remove that row from matrix A. Paul -Original Message- From: Leeds, Mark (IED) [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 29, 2006 12:12 PM To: H. Paul Benton Subject: RE: [R] matrix comparison, and cbind issues. If A and B are the same size ( I can't tell

Re: [R] Matrix-vector multiplication without loops

2006-11-15 Thread Richard Graham
On 11/14/06, Ravi Varadhan [EMAIL PROTECTED] wrote: I am trying to do the following computation: p - rep(0, n) coef - runif(K+1) U - matrix(runif(n*(2*K+1)), n, 2*K+1) for (i in 0:K){ for (j in 0:K){ p - p + coef[i+1]* coef[j+1] * U[,i+j+1] } }

Re: [R] Matrix-vector multiplication without loops

2006-11-14 Thread Dimitris Rizopoulos
[EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Tuesday, November 14, 2006 4:45 PM Subject: [R] Matrix-vector multiplication without loops Hi, I am trying to do the following computation: p - rep(0, n) coef - runif(K+1) U - matrix(runif(n*(2*K+1)), n, 2*K+1

[R] Matrix-vector multiplication without loops

2006-11-14 Thread Ravi Varadhan
Hi, I am trying to do the following computation: p - rep(0, n) coef - runif(K+1) U - matrix(runif(n*(2*K+1)), n, 2*K+1) for (i in 0:K){ for (j in 0:K){ p - p + coef[i+1]* coef[j+1] * U[,i+j+1] } } I would appreciate any suggestions on how

Re: [R] Matrix-vector multiplication without loops

2006-11-14 Thread Christos Hatzis
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dimitris Rizopoulos Sent: Tuesday, November 14, 2006 11:20 AM To: Ravi Varadhan Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Matrix-vector multiplication without loops I think you need something along these lines

Re: [R] Matrix-vector multiplication without loops

2006-11-14 Thread Ravi Varadhan
-Original Message- From: Christos Hatzis [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 14, 2006 2:49 PM To: 'Dimitris Rizopoulos'; 'Ravi Varadhan' Cc: r-help@stat.math.ethz.ch Subject: RE: [R] Matrix-vector

Re: [R] matrix manipulation with a for loop

2006-11-02 Thread Fabian Scheipl
Your for-loops aren't set up properly: try for(i in 1:NCOL(F.zoo)) HTH, Fabian Scheipl -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] matrix manipulation with a for loop

2006-11-01 Thread antonio rodriguez
Hi, Having a matrix F.zoo (6575,189) with NA's in some columns I'm trying to extract from each column the percent of days within an specific range, so I've wrote this procedure: length(subset(F.zoo[,86],(F.zoo[,86]=5) (F.zoo[,86]=

Re: [R] matrix manipulation with a for loop

2006-11-01 Thread Gabor Grothendieck
Try this where m is the matrix: 100 * colMeans(m 5 m 9, na.rm = TRUE) On 11/1/06, antonio rodriguez [EMAIL PROTECTED] wrote: Hi, Having a matrix F.zoo (6575,189) with NA's in some columns I'm trying to extract from each column the percent of days within an specific range, so I've wrote

Re: [R] matrix manipulation with a for loop

2006-11-01 Thread antonio rodriguez
Phil Spector escribió: Antonio - When you're operating on each column of a matrix, you really should consider the apply() function, which was written for the task. Also, it's usually easier to count things in R by taking the sum of a logical expression, rather than the length of a

Re: [R] matrix manipulation with a for loop

2006-11-01 Thread antonio rodriguez
Gabor Grothendieck escribió: Try this where m is the matrix: 100 * colMeans(m 5 m 9, na.rm = TRUE) Dear Gabor, Just perfect! Thanks a lot, Antonio On 11/1/06, antonio rodriguez [EMAIL PROTECTED] wrote: Hi, Having a matrix F.zoo (6575,189) with NA's in some columns I'm trying to

  1   2   3   4   5   >