Re: [R] R beginner: matrix algebra

2012-12-18 Thread kevj1980
Thanks to all for help. The filter function appears most straightforward way for this problem. Kevin -- View this message in context: http://r.789695.n4.nabble.com/R-beginner-matrix-algebra-tp4653335p4653414.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] R beginner: matrix algebra

2012-12-18 Thread Patrick Burns
Convenient ways of computing both simple and log returns are at the very end of: http://www.portfolioprobe.com/2012/11/05/an-easy-mistake-with-returns/ Those work whether you have a vector or a matrix. Pat On 17/12/2012 17:16, kevj1980 wrote: Hi, I have an n x m matrix of numerical observati

Re: [R] R beginner: matrix algebra

2012-12-17 Thread William Dunlap
ct.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Richard M. Heiberger > Sent: Monday, December 17, 2012 1:54 PM > To: kevj1980 > Cc: r-help@r-project.org > Subject: Re: [R] R beginner: matrix algebra > > I think this is what you are looking for. > > > t

Re: [R] R beginner: matrix algebra

2012-12-17 Thread Richard M. Heiberger
I think this is what you are looking for. > tmp <- matrix(sample(20), 5, 4) > tmp [,1] [,2] [,3] [,4] [1,]6 15 18 20 [2,]45 10 19 [3,]7913 [4,]8 14 11 13 [5,] 17 12 162 > t(apply(tmp, 1, diff)) [,1] [,2] [,3] [1,]932 [

[R] R beginner: matrix algebra

2012-12-17 Thread kevj1980
Hi, I have an n x m matrix of numerical observations. ie. stock prices I wish to convert the matrix of observations to a matrix of simple returns (by taking the differences between (column) observations.) Can any good soul suggest a function for this? -- View this message in context: http://