You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been using ts objects for a while but not too much xts, so i was trying to calculate mean, sum, last, first... (FUN) for every year in economic time series. When i try it i have weird result.
This is a quick example: Considering x and y like monthly series, for two consecutive years:
x <- 1:12
y <- 1:12
serie <- c(x,y)
Then i create a ts object
serie <- ts(serie,1990,,12)
now i convert it to xts object
ene 1990 1
feb 1990 2
mar 1990 3
abr 1990 4
may 1990 5
jun 1990 6
jul 1990 7
ago 1990 8
sep 1990 9
oct 1990 10
nov 1990 11
dic 1990 12
ene 1991 1
feb 1991 2
mar 1991 3
abr 1991 4
may 1991 5
jun 1991 6
jul 1991 7
ago 1991 8
sep 1991 9
oct 1991 10
nov 1991 11
dic 1991 12
Then comes my problem
for example, i try to get the last value for every year, as far i know this is what this function do:
apply.yearly(serie.xts,FUN = "last")
but i get this:
ene 1990 1
ene 1991 1
dic 1991 12
I was expecting this: dic 1990 12 dic 1991 12
i try this:
period.apply(INDEX = endpoints(x = serie.xts, on = "years"), x = serie.xts, FUN = "last")
but also give me the same result:
ene 1990 1
ene 1991 1
dic 1991 12
i'm using
R 3.3.3
xts 0.9-7
zoo 1.8-0
The text was updated successfully, but these errors were encountered:
You are right, i don't use the github to install packages so much, i didn't notice that.
Do you have any plan to update the cran version?
The last cran version was published 2014-01-02. so i suppose there is a lot of bugs that has been already fixed. Thanks for your amazing packages.
I have been using ts objects for a while but not too much xts, so i was trying to calculate mean, sum, last, first... (FUN) for every year in economic time series. When i try it i have weird result.
This is a quick example: Considering x and y like monthly series, for two consecutive years:
Then i create a ts object
serie <- ts(serie,1990,,12)
now i convert it to xts object
as far i see, the series is properly created
serie.xts
The series looks ok
Then comes my problem
for example, i try to get the last value for every year, as far i know this is what this function do:
apply.yearly(serie.xts,FUN = "last")
but i get this:
I was expecting this: dic 1990 12 dic 1991 12
i try this:
but also give me the same result:
i'm using
R 3.3.3
xts 0.9-7
zoo 1.8-0
The text was updated successfully, but these errors were encountered: