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
.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.
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
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(
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
> 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
>
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
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
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
9 matches
Mail list logo