Re: [R] Vectorized expression to extrapolate matrix columns with columns of another matrix

2010-05-13 Thread Abiel X Reinhart
at2.locf)[ix] mat1 } Abiel Reinhart -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: Wednesday, May 12, 2010 12:00 PM To: Abiel X Reinhart Cc: r-help@r-project.org Subject: Re: [R] Vectorized expression to extrapolate matrix columns with colu

Re: [R] Vectorized expression to extrapolate matrix columns with columns of another matrix

2010-05-12 Thread Gabor Grothendieck
.approx() followed by na.locf(). For instance: >> >> m <- zoo(cbind(c(1, 2, NA, NA, 5, NA, NA), seq(7)^2), as.Date(1:7)) >> na.approx(m[, 1], x = m[, 2], rule=2) >> >> 1970-01-02 1970-01-03 1970-01-04 1970-01-05 1970-01-06 1970-01-07 1970-01-08 >>       1.0        2.0        2.

Re: [R] Vectorized expression to extrapolate matrix columns with columns of another matrix

2010-05-12 Thread Abiel X Reinhart
May 12, 2010 10:40 AM To: Abiel X Reinhart Cc: r-help@r-project.org Subject: Re: [R] Vectorized expression to extrapolate matrix columns with columns of another matrix Use rule = 2 as in the extrapolation examples in the na.approx help file. On Wed, May 12, 2010 at 10:10 AM, Abiel X Reinhart wr

Re: [R] Vectorized expression to extrapolate matrix columns with columns of another matrix

2010-05-12 Thread Abiel X Reinhart
2010 8:37 AM To: Abiel X Reinhart Cc: r-help@r-project.org Subject: Re: [R] Vectorized expression to extrapolate matrix columns with columns of another matrix Try this using the zoo package. See ?na.approx for more and note that this functionality requires zoo 1.6-3 or later. .> m <- zoo(

Re: [R] Vectorized expression to extrapolate matrix columns with columns of another matrix

2010-05-12 Thread Gabor Grothendieck
grothendi...@gmail.com] > Sent: Wednesday, May 12, 2010 10:40 AM > To: Abiel X Reinhart > Cc: r-help@r-project.org > Subject: Re: [R] Vectorized expression to extrapolate matrix columns with > columns of another matrix > > Use rule = 2 as in the extrapolation examples in the na.approx

Re: [R] Vectorized expression to extrapolate matrix columns with columns of another matrix

2010-05-12 Thread Gabor Grothendieck
> extrapolated so that there are seven values. Is there a workaround? > > Abiel Reinhart > > -Original Message- > From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] > Sent: Wednesday, May 12, 2010 8:37 AM > To: Abiel X Reinhart > Cc: r-help@r-project.org >

Re: [R] Vectorized expression to extrapolate matrix columns with columns of another matrix

2010-05-12 Thread Gabor Grothendieck
Try this using the zoo package. See ?na.approx for more and note that this functionality requires zoo 1.6-3 or later. .> m <- zoo(cbind(c(1, 2, NA, NA, 5, NA, 7), seq(7)^2), as.Date(1:7)) > na.approx(m[, 1], x = m[, 2]) 1970-01-02 1970-01-03 1970-01-04 1970-01-05 1970-01-06 1970-01-07 1970-01-08

Re: [R] Vectorized expression to extrapolate matrix columns with columns of another matrix

2010-05-12 Thread Jeffrey J. Hallman
Abiel X Reinhart writes: > I have two identically sized matrices of data that represent time series (I > am storing the data in zoo objects, but the idea should apply to any matrix > of data). The time series in the second matrix extend further than in the > first matrix, and I would like to u

[R] Vectorized expression to extrapolate matrix columns with columns of another matrix

2010-05-11 Thread Abiel X Reinhart
I have two identically sized matrices of data that represent time series (I am storing the data in zoo objects, but the idea should apply to any matrix of data). The time series in the second matrix extend further than in the first matrix, and I would like to use the data in matrix 2 to extrapol