ill=NA)
df3<-rollapply(df,3,mean,na.pad=TRUE)
identical(df2,df3)
[1] TRUE
A.K.
- Original Message -
From: Stathis Kamperis
To: r-help@r-project.org
Cc:
Sent: Sunday, July 8, 2012 10:31 AM
Subject: [R] How to replace a column in a data frame with another one with a
different si
Your
On Sun, Jul 8, 2012 at 12:22 PM, Stathis Kamperis wrote:
> 2012/7/8 Michael Weylandt :
>>
>>
>> On Jul 8, 2012, at 9:31 AM, Stathis Kamperis wrote:
>>
>>> Hello everyone,
>>>
>>> I have a dataframe with 1 column and I'd like to replace that column
>>> with a moving average.
>>> Example:
>>>
On Jul 8, 2012, at 9:31 AM, Stathis Kamperis wrote:
> Hello everyone,
>
> I have a dataframe with 1 column and I'd like to replace that column
> with a moving average.
> Example:
>
>> library('zoo')
>> mydat <- seq_len(10)
>> mydat
> [1] 1 2 3 4 5 6 7 8 9 10
>> df <- data.frame("V1"
Hello everyone,
I have a dataframe with 1 column and I'd like to replace that column
with a moving average.
Example:
> library('zoo')
> mydat <- seq_len(10)
> mydat
[1] 1 2 3 4 5 6 7 8 9 10
> df <- data.frame("V1" = mydat)
> df
V1
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
4 matches
Mail list logo