Displaying 20 results from an estimated 20000 matches similar to: "Convert daily to weekly ts ?"
2008 Jun 26
1
How to turn Time Series daily values into weekly means (aggregate?)
#this is a daily series of precipitation data. I would like to condense it
into weekly means. How can I do this
#as a side note I would like to do this same thing to two years worth of
fifteen minute interval data and make it into
#a series of daily averages (there are 96 readings per day)
#is aggregate the right function? or...
y <- c(1.23, 0, 0, 0, 0, 0, 0, 0, 0, 0.27, 0, 0.29, 0, 0, 0,
2007 Jan 26
2
how to create daily / weekly ts object?
Dear All,
Monthly and Quarterly ts obj. is easy to understand. But I couldn't
find an example in R manual how to create daily or weekly ts object.
Could you please shed some light on it?
I really appreciate it.
2008 Jan 06
1
aggregate.ts help
Hi,
I have a ts object with a frequency of 4, i.e., quarterly data, and I would
like to calculate the mean for each quarter. So for example:
> ts.data=ts(1:20,start=c(1984,2),frequency=4)
> ts.data
Qtr1 Qtr2 Qtr3 Qtr4
1984 1 2 3
1985 4 5 6 7
1986 8 9 10 11
1987 12 13 14 15
1988 16 17 18 19
1989 20
If I do this manually, the mean
2011 Jun 21
1
Doubit about ts() functions
Hi everyone
Please, I need one more help you
I have some data that need to make a forecast.
I´m using the command: Yst<-print(ts<-ts(Y,start=c(1,5),freq=7),calendar=T)
to create the dayly time series by the dataframe Y.
My data Y means: Y=measure dayly , start at 01/jul/2010 (thursday), for this
reason that I use c(1,5).
I need to create the time series aggregate by weakly (and not dayly as
2003 Sep 30
2
ts - unit conversion
I've been using R for a while, but now find myself needing to understand
time-series objects for a short course I am teaching. I am putting
together some daily financial datasets for illustration, but having some
trouble in aggregating the data to months or weeks. I am getting a
"cannot change frequency from 1 to 12" message.
I am not sure that aggregation is where I want to go
2010 Aug 01
1
aggregating a daily zoo object to a weekly zoo object
Dear R People:
I'm trying to convert a daily zoo object to a weekly zoo object:
xdate <- seq(as.Date("2002-01-01"),as.Date("2010-07-10"),by="day")
library(zoo)
length(xdate)
xt <- zoo(rnorm(3113),order=xdate)
xdat2 <- seq(index(xt)[1],index(xt)[3113],by="week")
xt.w <- aggregate(xt,by=xdat2,mean)
Error: length(time(x)) ==
1999 Dec 16
1
aggregate.ts (PR#376)
I'm having some problems with aggregate.ts, e.g.
R> x <- ts(1:20)
R> frequency(x)
[1] 1
R> aggregate(x, nfreq=1/3)
Error in aggregate.ts(x, nfreq = 1/3) : cannot change frequency from 1 to
0.333333333333333
In fact aggregate.ts only accepts a new frequency that is a negative
power of two in this example.
The problem with the current test for compatible frequencies
if
2007 Jul 23
3
Aggregate daily data into weekly sums
Dear Lest,
I have a two-variable data frame as follows (the time peirod of the
actual data set is 10 years):
Date Amount
1 6/1/2007 1
2 6/1/2007 1
3 6/4/2007 2
4 6/5/2007 2
5 6/11/2007 3
6 6/12/2007 3
7 6/12/2007 3
8 6/13/2007 3
9 6/13/2007 3
10 6/18/2007 4
11 6/18/2007 4
12 6/25/2007 5
13 6/28/2007 5
2002 Feb 11
2
Time Series ts() Objects
Hi,
Is it possible to create a ts() object, whose data is daily based BUT
measured only on working days?
In other words, suppose I have a data set with 255 observations, measured
from 29 June 1959 to 30 June 1960. How would I create such a data? I
tried something like:
ts(c(...), start(1959, 180))
but I'm not sure what to use for frequency. In other words I don't know
how to
2002 Dec 12
1
improving ts object
Dear all,
Currently, a ts object behaves like an array, and it would be very useful to have a similar object, which would behave like a data.frame, i.e. it could be indexed, named, etc. like a data.frame. What would be the most efficient way to construct such an object? I have tried to make one on my own following the directions of class design from "S Programming" (2000) as a
2012 Aug 09
1
POSIXct to ts
Hi,
I have a dataframe (try.1) with date/time and temperature columns, and the date/time is in POSIXct fomat. Sample included below.
I would like to to try decompose () or stl() to look at the trends and seasonality in my data, eventually so that I can look at autocorrelation. The series is 3 years of water temperature with clearly visible seasonal periods.
Right now, if I try decompose,
2018 May 29
2
Convert daily data to weekly data
Dear all,
I have daily data in wide-format from 01/01/1986 to 31/12/2016 by ID. I
would like to convert this to weekly average data. The data has been
generated by an algorithm.
I know that I can use the lubridate package but that would require me to
first convert the data to long-form (which is what I want). I am at a bit
of loss of how to extract the date from the variable names and then
2011 Mar 24
2
Help with creating a ts (time series) object with daily sampling values
Hi All,
I have a data set of daily measurements of river flow. I would like to
create a "ts" object from this data.
Here's a sample data set:
date <- as.Date(c(1:300), format="%Y")
year=as.numeric(format(date, format = "%Y"))
month=as.numeric(format(date, format = "%m"))
julianday=as.numeric(format(date, format = "%j"))
2003 Nov 20
2
ts format for daily time serie
Hi R-users:
How can I format a daily time serie with ts function
so the plot of the time shows the date right
(dd/mm/yy) or yy.xxxx ?
Excerp of the database:
FECHA TRM
1 01/01/2000 1873.77
2 02/01/2000 1873.77
3 03/01/2000 1873.77
4 04/01/2000 1874.35
5 05/01/2000 1895.97
.
.
.
1397 10/11/2003 2843.82
1398 11/11/2003 2840.41
1399 12/11/2003 2840.41
1400 13/11/2003
2004 Jun 22
2
ts & daily timeseries
I have defined a daily timeseries for the 365 days of 2003 issuing:
myts = ts(dati[,2:10],frequency=365,)
> myts
Time Series:
Start = c(1, 1)
End = c(1, 365)
Frequency = 365
and
mytime = as.POSIXct(strptime(as.character(dati[,1]),format="%Y-%m-%d"))
contains the dates from "2003-01-01" to "2003-12-31"
How can I combine mytime and myts in order to list
2018 May 29
0
Convert daily data to weekly data
Hi
Based on your explanation I would advice to use
?cut.POSIXt
with breaks "week". However your data are rather strange, you have data frame with names which looks like dates
names(test)
[1] "X1986.01.01.10.30.00" "X1986.01.02.10.30.00" "X1986.01.03.10.30.00"
[4] "X1986.01.04.10.30.00" "X1986.01.05.10.30.00"
2006 Oct 12
3
ts vs zoo
> Hello,
>
> I have lots of data in zoo format and would like to do some time
> series analysis. (using library(zoo), library(ts) )
>
> My data is usually from one year, and I try for example stl() to find
> some seasonalities or trends.
>
> I have now accepted, that I might have to convert my series into ts()
> but still I am not able to execute the comand since
2004 Apr 30
1
daily time series in R
I have some daily data and would like to apply some of the time series functions to it.
I have read various notes in the help archive on this, the latest I found suggested
that I need to use the irts class (Irregularly spaced time series) for daily data
since a year does not divide into an integer number of days.
I see why I would have to do that if I have gaps (e.g. only data on weekdays)
but
2005 May 16
1
Omitting NAs in aggregate.ts()
I have a time series vector (not necessarily ts class) that has NAs in
it.
How can I omit the NAs when using aggregate.ts() to compute a function
on each window? If there is at least one non-NA value in each window,
I'd like to proceed with evaluating the function; otherwise, I would
like NA returned. I'm not wedded to aggregate.ts and don't need ts
class if there is another fast,
2018 May 29
0
Convert daily data to weekly data
Forgot the year if you also want to summarise by that.
> x <- structure(list(X1986.01.01.10.30.00 = c(16.8181762695312,
16.8181762695312,
+ 18.8294372558594, 16 ....
[TRUNCATED]
> library(tidyverse)
> library(lubridate)
> # convert to long form
> x_long <- gather(x, key = 'date', value = "value", -ID)
> #