Re: [R] Access column after hp filter
Sorry, typo. It should be names(e.hp) Pascal On Sun, Mar 16, 2014 at 3:42 PM, Pascal Oettli wrote: > Dear Sabina, > > If you carefully read the help page (always a good idea), examples > show you that it is "object$cycle", not "object$Cycle". Also, you can > use names, i.e. names(e.hp$). > > HTH, > Pascal > > On Sun, Mar 16, 2014 at 12:56 AM, Liana-Sabina Luncasu > wrote: >> Dear all, >> >> I am working with some time series data and I applied an HP filter to it >> using the following code: >> >> e.hp = hpfilter(empl) >> >> Now I am trying to access the last column (Cycle), that is, to save it in a >> separate vector. I tried with both e.hp$Cycle and e.hp[ , 3] but none of >> them works. I get the following: >> >>> e.hp$Cycle >> NULL >>> e.hp[,3] >> Error in e.hp[, 3] : incorrect number of dimensions >> >> >> Does anyone have any solution? >> >> Thank you in advance. >> >> Sabina >> >> P.S. Below I provide the result of the hpfilter >> >>> e.hp >> >> Title: >> Hodrick-Prescott Filter >> >> Call: >> hpfilter(x = empl) >> >> Method: >> hpfilter >> >> Filter Type: >> lambda >> >> Series: >> empl >> >> empl Trend Cycle >> 1980 Q1 929.6 929.9 -0.294800 >> 1980 Q2 929.8 930.1 -0.255385 >> 1980 Q3 930.3 930.2 0.105146 >> 1980 Q4 931.4 930.4 1.061102 >> 1981 Q1 932.7 930.5 2.142883 >> 1981 Q2 933.6 930.7 2.879701 >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > > > -- > Pascal Oettli > Project Scientist > JAMSTEC > Yokohama, Japan -- Pascal Oettli Project Scientist JAMSTEC Yokohama, Japan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Access column after hp filter
Dear Sabina, If you carefully read the help page (always a good idea), examples show you that it is "object$cycle", not "object$Cycle". Also, you can use names, i.e. names(e.hp$). HTH, Pascal On Sun, Mar 16, 2014 at 12:56 AM, Liana-Sabina Luncasu wrote: > Dear all, > > I am working with some time series data and I applied an HP filter to it > using the following code: > > e.hp = hpfilter(empl) > > Now I am trying to access the last column (Cycle), that is, to save it in a > separate vector. I tried with both e.hp$Cycle and e.hp[ , 3] but none of > them works. I get the following: > >> e.hp$Cycle > NULL >> e.hp[,3] > Error in e.hp[, 3] : incorrect number of dimensions > > > Does anyone have any solution? > > Thank you in advance. > > Sabina > > P.S. Below I provide the result of the hpfilter > >> e.hp > > Title: > Hodrick-Prescott Filter > > Call: > hpfilter(x = empl) > > Method: > hpfilter > > Filter Type: > lambda > > Series: > empl > > empl Trend Cycle > 1980 Q1 929.6 929.9 -0.294800 > 1980 Q2 929.8 930.1 -0.255385 > 1980 Q3 930.3 930.2 0.105146 > 1980 Q4 931.4 930.4 1.061102 > 1981 Q1 932.7 930.5 2.142883 > 1981 Q2 933.6 930.7 2.879701 > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Pascal Oettli Project Scientist JAMSTEC Yokohama, Japan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Access column after hp filter
Dear all, I am working with some time series data and I applied an HP filter to it using the following code: e.hp = hpfilter(empl) Now I am trying to access the last column (Cycle), that is, to save it in a separate vector. I tried with both e.hp$Cycle and e.hp[ , 3] but none of them works. I get the following: > e.hp$Cycle NULL > e.hp[,3] Error in e.hp[, 3] : incorrect number of dimensions Does anyone have any solution? Thank you in advance. Sabina P.S. Below I provide the result of the hpfilter > e.hp Title: Hodrick-Prescott Filter Call: hpfilter(x = empl) Method: hpfilter Filter Type: lambda Series: empl empl Trend Cycle 1980 Q1 929.6 929.9 -0.294800 1980 Q2 929.8 930.1 -0.255385 1980 Q3 930.3 930.2 0.105146 1980 Q4 931.4 930.4 1.061102 1981 Q1 932.7 930.5 2.142883 1981 Q2 933.6 930.7 2.879701 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.