Displaying 20 results from an estimated 10000 matches similar to: "Up- or downsampling time series in R"
2017 Oct 06
2
Time series: xts/zoo object at annual (yearly) frequency
Hi,
I'd like to make a time series at an annual frequency.
> a<-xts(x=c(2,4,5), order.by=c("1991","1992","1993"))
Error in xts(x = c(2, 4, 5), order.by = c("1991", "1992", "1993")) :
order.by requires an appropriate time-based object
> a<-xts(x=c(2,4,5), order.by=1991:1993)
Error in xts(x = c(2, 4, 5), order.by =
2010 Jun 17
1
Help with interpolation of time series
I'm quite new to R. I have a time series of annual state population
estimates from census.gov, and I'd like to get a time series of monthly
estimates, by a nonlinear interpolation.
How can I do this in R?
Thanks!
[[alternative HTML version deleted]]
2009 Jan 23
1
extract certain months toyears (zoo)
Dear useRs and developeRs,
In my diploma thesis I work with a daily time series of glacier runoff
data.
I did already aggregate them to monthly means etc.
Now i want to use just the summer values (I am indecisive by now what
that means, but let's make it easy and use months like June).
Is there a way to extract the data off this zoo into another zoo with
frequency=1 ?
Do you have
2008 Sep 22
1
as.day() Function (zoo question)
I am was going to look at the as.yearmon function in the zoo package
and write a as.day function to aggregate a time series of 96
observations per day into the mean for each day, but I don't know how
to look at the code so that I can convert it into something I can use.
On top of that I believe that it is probably an S3 method and I
haven't quite gotten that far in my programming
2009 Dec 22
1
Using zoo() to aggregate daily data to monthly means
I am trying to get monthly means for a daily data series using zoo(). I have
found an odd problem, that seems to be caused by zoo()'s handling of leap
years.
Here's my R script with 2 methods (freq=365, 366) for aggregating the daily
data to monthly series:
library(zoo)
J_link <- "http://www.ijis.iarc.uaf.edu/seaice/extent/plot.csv"
JAXA_data <- read.table(J_link,
2010 Aug 11
2
Sweeping a zoo series
Given a long zoo matrix, the goal is to "sweep" out a statistic from the
entire length of the
sequences.
longzoomatrix<-zoo(matrix(rnorm(720),ncol=6),as.yearmon(outer(1900,seq(0,length=120)/12,"+")))
cnames<-c(12345,23456,34567,45678,56789,67890)
colnames(longzoomatrix)<-cnames
longzoomatrix[1:24,]
12345 23456 34567 45678
2009 Apr 27
2
series at low freq expanded into high freq
Folks,
If I have a series mm of, say, monthly observations, and a series dd of
daily dates, what's a good way of expanding mm such that corresponding
to each day in dd within the corresponding month in mm, the values of mm
are repeated?
So e.g., if I have mm:
mm <- c(15, 10, 12, 13, 11)
names(mm)<-c("Nov 2008", "Dec 2008", "Jan 2009", "Feb
2009 Sep 25
0
differing behaviour between xts (0.6-7) and zoo (1.5-8)
Folks,
I have some weekly dataseries that I convert to monthly xts (with
yearmon indices), and obtain the two following extracts:
> str(sig)
An 'xts' object from Apr 1998 to Sep 1998 containing:
Data: num [1:6, 1] 0.0083 0.2799 -0.2524 -0.0119 0.18 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr "e1"
Indexed by objects of class: [yearmon] TZ:
2006 Apr 07
1
rownames for as.matrix.zoo
On Fri, 7 Apr 2006 16:09:53 +0200 Brandt, T. (Tobias) wrote:
> Hi
>
> Is there a reason why as.matrix.zoo doesn't set the rownames to the
> index like as.data.frame.zoo does?
Yes, oversight, I think ;-)
Added to the devel-version of zoo. I'll try to get it out to CRAN in
the next days.
Z
> Thanks
>
> Tobias
>
>
> > library(zoo)
> > x.Date
2011 Oct 27
2
Simple time series question with zoo
New user here. My goal is pull daily averages from a long dataset.
I've been working with some code I got from this list from
https://stat.ethz.ch/pipermail/r-help/2009-March/191302.html
The code how I have been using it is as follows:
library(zoo)
library(chron)
DB<-read.table("/Users/me/Desktop/R/data.csv", sep=",", header=TRUE, as.is
=TRUE)
z<-zoo(LTER6$temp,
2009 Aug 01
2
xyplot: superpose 2 time series with different time intervals
I could use some advice regarding xyplot.
I've got 2 time series. Both cover approximately the same period of
time (ie, 1940 to 2009). But one series has annual data and the other
has monthly data. One refers to university enrollment; the other to
unemployment rates. Both are currently in the same data frame.
I'd like to use the monthly times series as a light grayscale
background for a
2009 Feb 17
2
annual maximum value
hi everyone!
hope you can help me here.
i am a new R user. what i am trying to do is to find the maximum annual
discharge from a daily record. i have a data.frame which includes date and
the discharge. somewhat like this..
10/1/1989 2410
10/2/1989 2460
10/3/1989 2890
...
...
...
12/31/2005 5730
i have been browsing through the archives and fount out about the aggregate
2010 Nov 23
2
Plot two zoo object with different indexes
Dear R community, I have the following two zoo objects:
MONTHLY CPI
> plot(z)
> par("usr")
[1] 1977.76333 2011.15333 70.39856 227.03744
> z=zooreg(cpius$Value,as.yearmon("1979-11"),frequency=12)
> str(z)
?zooreg? series from Nov 1979 to Oct 2010
Data: num [1:372] 76.2 77 77.8 78.5 79.5 80.3 81.1 82 82 82.6 ...
Index: Class 'yearmon' num [1:372]
2010 Aug 20
1
differecing a zoo series
A quick question
x <- as.yearmon(2000 + seq(0, 23)/12)
x
[1] "Jan 2000" "Feb 2000" "Mar 2000" "Apr 2000" "May 2000" "Jun 2000" "Jul
2000" "Aug 2000" "Sep 2000" "Oct 2000" "Nov 2000" "Dec 2000" "Jan 2001"
[14] "Feb 2001" "Mar 2001" "Apr
2010 Dec 03
0
Calculating weekly/bi-monthly average for time series data
Dear all, given a daily time series data, I am able to calculate monthly average, quarterly average like:
library(zoo)
dat <- zooreg(rnorm(500), start=as.Date("2000-01-01"), frequency=1)
mo.ave <- aggregate(dat, as.yearmon(index(dat)), "mean")
head(dat)
head(mo.ave)
However is there any direct way like above to calculate the weekly average, bi-monthly average?
Thanks
2010 Dec 21
1
lm() on a matrix of zoo series
I have a matrix of zoo series. each series is in a column.
x <- as.yearmon(2000 + seq(0, 23)/12)
# 24 months of data, lets make 20 sets of random data
testData <- matrix(rnorm(480),ncol=20)
# make a zoo object and columns will hold the 20 series
TestZoo <- zoo(testData,order.by=x)
# now run lm for just one series.
m <- lm(TestZoo[,1]~time(TestZoo))$coeff[2]
m
time(TestZoo)
2010 Jan 01
1
Chainging monthly data to daily data
Hi, I have a zoo object with monthly frequency :
library(zoo)
dat <- zooreg(rnorm(50), as.yearmon("2000-01-01"), frequency=12)
Now I want to make a zoo object with daily frequency from "dat" wherein
value for a each day for a particular month will be value of "dat" at that
particular month.
Is there any easy way to do that?
Thanks,
--
View this message in
2012 Aug 03
1
How can I read time series data to create zoo objects if I have two title lines?
Hello,
This is a standard example in which I read the time series data from a
csv file and create a zoo object:
x0 <- read.csv(file="CPI.csv", header=TRUE)
time_0<-as.yearmon("1981-01")+(0:371)/12
x0zoo<-zoo(x0, time_0)
The data look like this:
TIME CPI CPI_food CPI_Clothes CPI_House CPI_Rent 198101 62.1 55.34
103.45 65.24 61.43 198102 63.16 56.95
2009 Apr 15
2
From daily series to monthly and viceversa
I have the following daily exchange rate series (from january 1st 1996 to
december 31st 2008) and I want to obtain them monthly series from it. I've
read about the 'zoo' library but I'm not getting it how to do it. These are
the data (left column day-month-year, right column the index)
31/12/1993 1,12509
03/01/1994 1,12509
04/01/1994 1,12558
05/01/1994 1,1258
06/01/1994 1,12596
2010 Apr 12
1
N'th of month working day problem
Dear Gabor,
Thanks for your reply. however:
> tail(DJd)
^DJI.Close
2010-04-01 10927.07
2010-04-05 10973.55
2010-04-06 10969.99
2010-04-07 10897.52
2010-04-08 10927.07
*2010-04-09 10997.35*
> tail(ag)
2009-11-30 10344.84
2009-12-31 10428.05
2010-01-31 10067.33
2010-02-28 10325.26
2010-03-31 10856.63
*2010-04-30 10997.35
*
It seems the script "makes up"