Hi,
Part of my program is to calculate the number of time series in a zoo
object. It works well if it has more than one time series, but it fails if
it has only one. How can I access the number of column (i.e. the number of
time series) when I have only one column? Why is the number of an objec
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
Even when indices (dates) of two zoo object don't match, I can cbind
them. It works for me!
Thanks,
Miao
2012/7/31 R. Michael Weylandt
> On Mon, Jul 30, 2012 at 11:18 PM, jpm miao wrote:
> > Hi,
> >
> >I let xzoo be an empty object:
> >
>
Hi,
I let xzoo be an empty object:
> xzoo<-{}
and I have an existing zoo object x1zoo_f. I would like to combine
the two to make a new zoo object, and continue doing so in a loop,
which is not shown here. However, when I type
> xzoo<-cbind(xzoo, x1zoo_f)
An error message emerges
ect.org [mailto:r-help-boun...@r-project.org]
> > On Behalf Of jpm miao
> > Sent: Thursday, July 26, 2012 9:12 PM
> > To: r-help
> > Subject: [R] How can I access the title of a table read via read.csv?
> >
> > Hi,
> >
> >I have a table which I can read via
Hi,
I have a table which I can read via read.csv:
fx1<-read.csv(file="A_FX_M.csv", header=TRUE)
TIME REERNTDJPY GBPHKD
1 198001 124.26 36.030 237.96 2.263980 4.8366
2 198002 126.59 36.030 244.05 2.290426 4.8765
3 198003 128.33 36.026 248.62 2.206045 4.9960
4 198004 127.
hey are read in thru stringsAsFactors=FALSE or
> > otherwise as explained therein -- or convert them with as.character()
> > when you access them, e.g.
>
> x1<-read.csv(file=as.character(m2q[1,2]))
>
> -- Bert
>
> >
> > On Thu, Jul 26, 2012 at 7:53 AM,
Dear All,
I would like to read the data file via read.csv (the 3rd line of the
following program) and the file name is stored in a dataframe. Since I have
several files to read, I store the file names as well as the sample period
inside a file “B_M2Q.csv” and I read the file name first, and th
Hello,
In zoo package, if I would like the time frame to be 1981M01 to 1982M12,
then I code
time_0<-as.yearmon("1981-01")+(0:23)/12
However, if the time frame of interest becomes 1981M01 to 2011M12, it is
relatively hard to calculate the number of months. Is there any faster way
to do it?
Hello,
I have a large number of time series, which needs to be transformed by
log or difference. Some of them are just processed by "level" (LV) without
any transformation. For that purpose, I produce a text file (.csv or .xls)
as follows:
DLN DLNDLN LV LV LV...
How can I read the
Hi,
I am using RStudio as my R editor.
After someday I accidentally hit something, the whole program is
repeated in the Console whenever I compile it. How can I fix it so that the
whole program won't be repeated in the future?
Thanks,
miao
[[alternative HTML version deleted]]
It seems to only works for zoo or ts objects?
I tried to run it for xts objects, and error message occurs. Once I
coerce it to be an zoo object (by as.zoo), it works.
Error message:
Error in model.frame.default(formula = dynformula(PIh - PI ~ L(X, 0:i) + :
variable lengths differ (found for
BTW, zoo is like ts in the application of lag.
In other words, zoo and xts are opposite in this issue.
2012/4/12 jpm miao
> Example:
> Will ts objects be obsolete or modified?
>
> > a[,1]
> 1983 Q1 2.747365190
> 1983 Q2 2.791594762
> 1983 Q
Example:
Will ts objects be obsolete or modified?
> a[,1]
1983 Q1 2.747365190
1983 Q2 2.791594762
1983 Q3 -0.009953715
1983 Q4 -0.015059485
1984 Q1 -1.190061246
1984 Q2 -0.553031799
1984 Q3 0.686874720
1984 Q4 0.953911035> lag(a,4)[,1]
1983 Q1 NA
1983
the time indices while keeping
> all the data, [so the fourth data point is the same value -- just a
> different time point] what you may want to do is cbind() the objects
> to see how they line up now.
>
> cbind(PI1, lag(PI1,4))
>
> Hope this helps,
> Michael
>
> On Tue
Hello,
I am writing codes for time series computation but encountering some
problems
Given the quarterly data from 1983Q1 to 1984Q2
PI1<-ts(c(2.747365190,2.791594762, -0.009953715, -0.015059485,
-1.190061246, -0.553031799, 0.686874720, 0.953911035),
start=c(1983,1), frequency=4)
> PI1
Hello,
Is there a function in R that calculates the year-on-year growth rate of
some time series?
In EView the function is @pchy.
Thanks,
miao
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.et
Hello,
I would like to find the maximum element in a matrix or an array but it
does not return what I want.
For example, If I have a 2*2 matrix A whose maximum element is the
A(1,2). I would like the answer (1,2), but it returns 3, which is the
ordinal if one counts by columns. Is there any
Hello,
I am new to the construction of user defined functions in R. I do see
the syntax of the function in many R reference but don't see the structures
/ paths issue. Two basic questions:
1. Should the function embedded in the main program? Could a function be a
separate R file (like Matlab)?
Hello,
I intend to perform FORECASTING with the "dynlm" package since I have a
bunch of time series data, and my model is a little deviating from the
standard AR. Therefore my first attempt is to perform AR forecasting based
on dynlm package.
First of all, I generate an ARIMA model and then
Hi,
I have three time series and I would like to plot them on the same graph
such that two of them share left y-axis and the third uses right y-axis.
rm(list=ls())
library(zoo)
x1 <- read.csv(file="120322DBCdata.csv", header=TRUE)
x1date<-as.yearqtr(1979)+seq(0,nrow(x1)-1)/4
x1zoo<-zoo(x1, x1d
Hello,
I would like to produce a few time series graphs with R. My data is
usually quarterly or monthly. I sometimes need to have two y-axes, one at
the left, the other right. Is there any toolbox producing nice looking time
series graphs?
Thanks,
miao
[[alternative HTML version d
at is so incommensurate with the
> heights of the histogram bars?
>
>cheers,
>
>Rolf Turner
>
>
> On 12/03/12 20:42, jpm miao wrote:
>
>> Hello,
>>
>>I have problem running the histogram function "hist". The area under
>> the
>>
Hello,
I have problem running the histogram function "hist". The area under the
histogram is much lower than 1. Could anyone tell me what the problem is?
Thanks,
(The total number of observation is 992 (close to 1000), so the
probability that 0https://stat.ethz.ch/mailman/listinfo/r-help
PLE
866.77333
70.110002.462.70319166.8733369.48.723.386667329466.58667
69.79.213.20
2012/2/17 jpm miao
> Hello,
>
>I have a question on how to tabulate the time series data. I use
> RStudio, but if can be done in any other R editor, it should work in
> R
Hello,
I am using RStudio and have trouble finding out the problematic line in
the presence of a bug. Could I view the line NUMBER which contains a bug?
Is there any R editor able to do it?
Thanks,
Miao
[[alternative HTML version deleted]]
___
Hello,
I try to handle the data using read.csv , zoo and aggregate functions.
The data contains NA values. After aggregating monthly data into quarterly
data, all data become NA. Is it because I don't properly aggregate the data
in the presence of NAs? What can I do?
Another problem is t
Hello,
I have a question on how to tabulate the time series data. I use
RStudio, but if can be done in any other R editor, it should work in
RStudio as well.
> a1<-11:22
> a1ts<-ts(a1, frequency=4, start=c(1978,1))
> a1ts Qtr1 Qtr2 Qtr3 Qtr4
1978 11 12 13 14
1979 15 16 17
a1tsw[2:3][1] 14 15
>
2012/2/16 R. Michael Weylandt
> ?window may help.
>
> Michael
>
> On Thu, Feb 16, 2012 at 3:08 AM, jpm miao wrote:
> > Hello,
> >
> > Let us convert a vector to a time series object starting in 1978Q1:
> > FRW<-ts(FRW0, freq
Hello,
Let us convert a vector to a time series object starting in 1978Q1:
FRW<-ts(FRW0, frequency=4, start=c(1978,1))
FRW[3:6] represents the data from 1978Q3 to 1979Q2. Could we access the
data by the time (1978Q3 to 1979Q2) instead of FRW[3:6]?
Thanks,
miao
[[alternative
A question on p-value of Unit Root Tests using urca toolbox
Theres a function punitroot on unit root probability value
punitroot(q, N = Inf, trend = c("c", "nc", "ct", "ctt"), statistic = c("t",
"n"), na.rm = FALSE)
To my knowledge, c means const or intercept, nc means no const
Hello,
I have a question on unit root test with urca toolbox.
First, to run a unit root test with lags selected by BIC, I type:
> CPILD4UR<-ur.df(x1$CPILD4[5:nr1], type ="drift", lags=12, selectlags ="BIC")
> summary(CPILD4UR)
The results indicate that the optimal lags selected by BIC
101 - 132 of 132 matches
Mail list logo