Well, it's not quite the dput(head(X, 25)) I asked for, but it
worksthank you :-)
Do take a look at the examples for aggregate -- then the right syntax
is pretty clear
z <- aggregate(x, timeSequence(from = start(x), to = end(x), by = "day"), sum)
but there seems to be some little issue that
Thank you, Michael :)
Michael Weylandt wrote
>
> If that doesn't nail it down, I'll need you to answer the questions I
> asked in my previous email.
Previously I made a mistake with *dput()*, this is the correct output:
> dput(X)
new("timeSeries"
, .Data = structure(c(124.3, 124.38, 124.67,
Fascinating... dput() has never given me anything that looks like
that I would have expected something much more like
z <- structure(c(123.53, 123.78, 124.24, 124.2, 124.07, 123.91, 123.44,
123.0616, 123.06, 123.13, 123.745, 123.96, 123.99, 123.99, 124.3,
124.38, 124.67, 125.19, 124.9, 125.27,
Michael Weylandt wrote
>
> Can you provide a reproducible example?
>
Of course, Michael.
Consider the following time series:
11/2/2011 14:30 123.53
11/2/2011 15:00 123.78
11/2/2011 15:30 124.24
11/2/2011 16:00 124.2
11/2/2011 16:30 124.07
11/2/2011 17:00 123.91
11/2/2011 17:30 123.44
11/2/20
Can you provide a reproducible example? use dput() to send your data
in a reproducible and user-friendly format. (It might not look user
friendly, but trust me, it is) If x is really long, perhaps just
dput(head(x, 25)) will suffice.
Just a guess as to your problem: I'm not familiar with the
timeS
Thank you for your help, Michael.
I used *aggregate(x, by = timeSequence(by = "day"), FUN = sum)* but the
results is very different from *sum(x[1:13])*, where 13 is the number of
daily observations I've sampled.
Michael Weylandt wrote
>
> How are you using aggregate()? It seems to sum for me...
How are you using aggregate()? It seems to sum for me...
z <- zoo(1:50, seq.POSIXt(from = Sys.time(), by = "30 min", length.out = 50))
aggregate(z, as.Date(time(z)), sum)
Best,
Michael
On Tue, May 15, 2012 at 11:52 AM, Cren wrote:
> Hello,
>
> I have a time series with intraday datas, sampled
Hello,
I have a time series with intraday datas, sampled every 30'; I would need to
aggregate them in this way: summing up all datas within a day.
I tried to use *aggregate(...)* function to get my goal, but it aggregates
in wrong way (I did not understand how so far); what I need is like
*sum(.
Try this:
rowsum(Income, format(Date, '%m-%Y'))
or
tapply(Income, format(Date, '%m-%Y'), sum)
On Wed, Sep 9, 2009 at 7:51 AM, clair.crossup...@googlemail.com <
clair.crossup...@googlemail.com> wrote:
> Dear all,
>
> Lets say I have a data frame as follows:
>
>
> > Date <- as.Date(c('2006-08-23
Hi Clair,
try to use this code
aggregate(toto$Income,by=list((substr(toto$Date,1,7))),sum)
Regards
mohamed
clair.crossup...@googlemail.com a écrit :
Dear all,
Lets say I have a data frame as follows:
Date <- as.Date(c('2006-08-23', '2006-08-30', '2006-09-06', '2006-09-13',
'2006-09-20'
Dear all,
Lets say I have a data frame as follows:
> Date <- as.Date(c('2006-08-23', '2006-08-30', '2006-09-06', '2006-09-13',
> '2006-09-20'))
> Income <- c(73.79, 72.46, 76.32, 72.43, 72.62)
> data.frame(Date, Income)
Date Income
1 2006-08-23 73.79
2 2006-08-30 72.46
3 2006-09-06 7
11 matches
Mail list logo