Re: [R] Problems dealing with matrices

2013-12-01 Thread David Winsemius
On Nov 30, 2013, at 8:45 PM, halim10-fes wrote: Hi Arun, Thank you very much for your kind response. Sorry for my delayed response. Your solutions for the first two questions are quite good for my purpose. Since nobody responded, can you please have a look at the 3rd question? After

Re: [R] Problems dealing with matrices

2013-11-30 Thread halim10-fes
Hi Arun, Thank you very much for your kind response. Sorry for my delayed response. Your solutions for the first two questions are quite good for my purpose. Since nobody responded, can you please have a look at the 3rd question? It'll be my great help, if you can give me suggestions.

Re: [R] Problems dealing with matrices

2013-11-28 Thread halim10-fes
Hi, Sorry for continuous bothering. Continuum of the previous problem... I have the following matrices and vectors, dcmat-matrix(c(0.13,0.61,0.25,0.00,0.00,0.00,0.52,0.37,0.09,0.00,0.00,0.00, 0.58,0.30,0.11,0.00,0.00,0.00,0.46,0.22,0.00,0.00,0.00,0.00,

Re: [R] Problems dealing with matrices

2013-11-28 Thread arun
Hi Halim, For the first two questions, you may try: colsum1 - colSums(volyrdc1) min(which(colsum1=18)) #[1] 29 #or  head(which(colsum1=18),1) #140 # 29  colsum1[substr(colsum1,6,7)==00]  ## this is not very clear 305 45.37004  #or colsum1[colsum1=18][substr(colsum1[colsum1=18],6,7)==00]  

Re: [R] Problems dealing with matrices

2013-11-26 Thread halim10-fes
Hi Arun, Thanks for your help. Sorry for my late response. Take care and stay fine. Regards, Halim On Sun, 24 Nov 2013 07:45:24 -0800 (PST), arun wrote Hi Halim, I guess this works for you.  Modifying Jeff's solution: volinp-c(0,0.000467,0.002762,0.008621,0.020014,0.038907,0.067094)

Re: [R] Problems dealing with matrices

2013-11-24 Thread Jeff Newmiller
I think the following is a pretty literal translation from your description. Looks like a linear difference equation with a ramp forcing function. wt - matrix( c(1,0,0,0,0 ), nrow=5 ) vol - matrix( NA, nrow=5, ncol=length( volinp ) ) vol[ , 1 ] - dcmat %*% ( volmat + wt ) for ( idx in volinp[

Re: [R] Problems dealing with matrices

2013-11-24 Thread halim10-fes
Hi Jeff, Thank you very much for your response. Your code produced exactly the same as I described. I also like your idea of including 'wt' matrix. Can you please suggest me if the 'volinp' is not sequential? Consider a new 'volinp', like:

Re: [R] Problems dealing with matrices

2013-11-24 Thread arun
Hi Halim, I guess this works for you.  Modifying Jeff's solution: volinp-c(0,0.000467,0.002762,0.008621,0.020014,0.038907,0.067094) vol1 - dcmat %*% (volmat +wt) for(idx in seq_along(volinp)[-1]){  vol1 - cbind(vol1,dcmat %*% (vol1[,idx-1] + volinp[idx] *wt))  } #or vol - matrix( NA, nrow=5,

[R] Problems dealing with matrices

2013-11-23 Thread halim10-fes
Dear R-friends, Hope you doing well. I've been trying to deal with the following problem for the couple of days but couldn't come up with a solution. It would be great if any of you could give some insight into it. I have three matrices like:

Re: [R] Problems dealing with matrices

2013-11-23 Thread halim10-fes
Hi Arun, Thank you very much for your response. Sorry, if I couldn't explain clearly. I think, I should restate the problem to get exactly what I want. Here it goes: I have 2 matrices and 1 vector, namely, dcmat-matrix(c(0.13,0.61,0.25,0.00,0.00,0.00,0.52,0.37,0.09,0.00,0.00,0.00,

Re: [R] Problems dealing with matrices

2013-11-23 Thread halim10-fes
Please apologize me! Earlier I've sent a message erroneously. Following is the original problem for which I'm seeking help. Extremely sorry... Hi Arun, Thank you very much for your response. Sorry, if I couldn't explain clearly. I think, I should restate the problem to get exactly what I