2013-08-02 143 views
-2

我有一個xts對象的列表。這些對象是每月的時間序列,我想將它們聚合到季度。使用兩種to.quarterlyapply.quarterly無法通過lapply錯誤try.xts(x,錯誤=「必須是xts強制或timeBased」)

l.qtr <- lapply(l.adj, function(x) apply.quarterly(x, mean)) 

結果:

Error in try.xts(x, error = "must be either xts-coercible or timeBased") : 
must be either xts-coercible or timeBased 

但是我可以xts對象的另一份名單我稱之爲lx做到這一點。這lx名單被髮送,轉換爲ts對象,X12調整和reclassed到xts並送回。不知何故,當它回來時,我得到的錯誤。我覈實了問題不存在於大小爲1的列表中,即使在將其發送給X12進行調整之後。

認爲這是一個像這個鏈接的問題,但似乎不是? Automatically plot (and save) list of xts objects

再好的幫助嗎?這讓我瘋狂。

更新: 我對最初缺乏重點表示歉意。我一直在試圖將這個縮小到一個可重複的例子。它似乎是我的幫手函數SeasAdj(它轉換爲ts,反季節化並轉換回xts)和我的data.framexts的初始轉換之間的交互。但是,如果我運行一個xts月度系列,通過quantmod'sgetSymbols下載我有理想的結果。它讓我相信麻煩在於SeasAdj助手函數在返回之前如何轉換回xts。最後我有dput(lax)。從那裏跑採購SeasAdj後,這四條線:

lax.xts <- xts(lax$value, order.by=lax$date) 
lax.adj <- SeasAdj(lax.xts) 
lax.qtr <- apply.quarterly(lax.adj, mean) 
lax.q <- apply.quarterly(lax.xts, mean) 


SeasAdj <- function(x) { 

require(x12) 
require(quantmod) 

freq <- switch(periodicity(x)$scale, 
      daily=365, 
      weekly=52, 
      monthly=12, 
      quarterly=4, 
      yearly=1) 

## determine the start date from xts 
pltStart <- as.POSIXlt(start(x)) 

# create 2 arg vector with year, month for start 
Start <- c(pltStart$year+1900,pltStart$mon+1) 

# capture xts series name 
names <- dimnames(x) 


#pass info as args to create ts 
x.ts <- ts(x, start=Start, frequency=freq) 

## use x12 automodel 
# do some seasonal adjustment using x12 
# return a TS object with data and seasonally adjusted data 
x12out <- x12work(x.ts, 
      x12path="C:\\x12arima\\x12a.exe", 
      transform.function="auto", 
      automdl=TRUE) 

# assign adjusted and original series to vectors 
x.adj <- as.ts(x12out$d11) 
x.orig <- as.ts(x12out$a1) 

# convert to XTS 
xts.adj <- as.xts(x.adj) 

# assign dimname back to series 
dimnames(xts.adj) <- names 

# return XTS object 
return(xts.adj) 

} 

這裏不嚴 dput的dput(LAX)

structure(list(series_id = c("LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003", 
"LAUCN55063003", "LAUCN55063003", "LAUCN55063003", "LAUCN55063003" 
), year = c(1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 1990L, 
1990L, 1990L, 1990L, 1990L, 1990L, 1991L, 1991L, 1991L, 1991L, 
1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1992L, 
1992L, 1992L, 1992L, 1992L, 1992L, 1992L, 1992L, 1992L, 1992L, 
1992L, 1992L, 1993L, 1993L, 1993L, 1993L, 1993L, 1993L, 1993L, 
1993L, 1993L, 1993L, 1993L, 1993L, 1994L, 1994L, 1994L, 1994L, 
1994L, 1994L, 1994L, 1994L, 1994L, 1994L, 1994L, 1994L, 1995L, 
1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 
1995L, 1995L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 
1996L, 1996L, 1996L, 1996L, 1996L, 1997L, 1997L, 1997L, 1997L, 
1997L, 1997L, 1997L, 1997L, 1997L, 1997L, 1997L, 1997L, 1998L, 
1998L, 1998L, 1998L, 1998L, 1998L, 1998L, 1998L, 1998L, 1998L, 
1998L, 1998L, 1999L, 1999L, 1999L, 1999L, 1999L, 1999L, 1999L, 
1999L, 1999L, 1999L, 1999L, 1999L, 2000L, 2000L, 2000L, 2000L, 
2000L, 2000L, 2000L, 2000L, 2000L, 2000L, 2000L, 2000L, 2001L, 
2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 
2001L, 2001L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 
2002L, 2002L, 2002L, 2002L, 2002L, 2003L, 2003L, 2003L, 2003L, 
2003L, 2003L, 2003L, 2003L, 2003L, 2003L, 2003L, 2003L, 2004L, 
2004L, 2004L, 2004L, 2004L, 2004L, 2004L, 2004L, 2004L, 2004L, 
2004L, 2004L, 2005L, 2005L, 2005L, 2005L, 2005L, 2005L, 2005L, 
2005L, 2005L, 2005L, 2005L, 2005L, 2006L, 2006L, 2006L, 2006L, 
2006L, 2006L, 2006L, 2006L, 2006L, 2006L, 2006L, 2006L, 2007L, 
2007L, 2007L, 2007L, 2007L, 2007L, 2007L, 2007L, 2007L, 2007L, 
2007L, 2007L, 2008L, 2008L, 2008L, 2008L, 2008L, 2008L, 2008L, 
2008L, 2008L, 2008L, 2008L, 2008L, 2009L, 2009L, 2009L, 2009L, 
2009L, 2009L, 2009L, 2009L, 2009L, 2009L, 2009L, 2009L, 2010L, 
2010L, 2010L, 2010L, 2010L, 2010L, 2010L, 2010L, 2010L, 2010L, 
2010L, 2010L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 
2011L, 2011L, 2011L, 2011L, 2011L, 2012L, 2012L, 2012L, 2012L, 
2012L, 2012L, 2012L, 2012L, 2012L, 2012L, 2012L, 2012L, 2013L, 
2013L, 2013L, 2013L, 2013L, 2013L), period = c("01", "02", "03", 
"04", "05", "06", "07", "08", "09", "10", "11", "12", "01", "02", 
"03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "01", 
"02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", 
"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", 
"12", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", 
"11", "12", "01", "02", "03", "04", "05", "06", "07", "08", "09", 
"10", "11", "12", "01", "02", "03", "04", "05", "06", "07", "08", 
"09", "10", "11", "12", "01", "02", "03", "04", "05", "06", "07", 
"08", "09", "10", "11", "12", "01", "02", "03", "04", "05", "06", 
"07", "08", "09", "10", "11", "12", "01", "02", "03", "04", "05", 
"06", "07", "08", "09", "10", "11", "12", "01", "02", "03", "04", 
"05", "06", "07", "08", "09", "10", "11", "12", "01", "02", "03", 
"04", "05", "06", "07", "08", "09", "10", "11", "12", "01", "02", 
"03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "01", 
"02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", 
"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", 
"12", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", 
"11", "12", "01", "02", "03", "04", "05", "06", "07", "08", "09", 
"10", "11", "12", "01", "02", "03", "04", "05", "06", "07", "08", 
"09", "10", "11", "12", "01", "02", "03", "04", "05", "06", "07", 
"08", "09", "10", "11", "12", "01", "02", "03", "04", "05", "06", 
"07", "08", "09", "10", "11", "12", "01", "02", "03", "04", "05", 
"06", "07", "08", "09", "10", "11", "12", "01", "02", "03", "04", 
"05", "06", "07", "08", "09", "10", "11", "12", "01", "02", "03", 
"04", "05", "06", "07", "08", "09", "10", "11", "12", "01", "02", 
"03", "04", "05", "06"), value = c(4.7, 5, 4.8, 3.6, 3.4, 3.5, 
4, 3.4, 3.1, 3.1, 4, 4.1, 4.7, 5.2, 5.2, 4.1, 3.7, 4.5, 4.3, 
3.6, 3.3, 3.5, 3.9, 4.2, 4.7, 5.3, 5, 4.1, 4.5, 5.2, 4.7, 4.3, 
4, 3.6, 3.8, 3.9, 4.7, 5.2, 4.6, 3.9, 3.8, 4.4, 4.7, 4, 3.8, 
3.6, 3.5, 3.8, 4.9, 5.1, 4.8, 3.9, 3.4, 3.9, 4.2, 3.5, 3, 2.6, 
2.7, 2.8, 4.3, 4.7, 4.5, 4.2, 3.5, 4.1, 3.8, 3.5, 3, 2.9, 3.2, 
3.2, 4.1, 4.5, 4.3, 3.2, 2.9, 3, 2.8, 2.6, 2.2, 2.1, 2.5, 2.6, 
3.7, 3.6, 3.9, 3.1, 2.5, 2.8, 2.6, 2.5, 2.2, 2.1, 2.4, 2.4, 3.3, 
3.3, 3.6, 2.3, 2.3, 3, 2.3, 2.6, 2.4, 2.4, 2.4, 2.5, 3.3, 3.7, 
3.1, 2.6, 2.5, 3.1, 2.5, 3.2, 2.8, 2.7, 2.7, 3, 3.7, 3.9, 3.9, 
3, 2.8, 3.5, 3.1, 3.1, 2.6, 2.5, 2.8, 2.9, 3.8, 4.1, 4.5, 3.7, 
3.4, 3.9, 3.5, 3.6, 3.3, 3.2, 3.6, 3.8, 4.8, 5, 5.2, 4.7, 4.1, 
4.6, 4.2, 4.2, 3.6, 3.5, 4, 4, 5.2, 5.6, 5.3, 4.6, 4.3, 5, 4.5, 
4.4, 3.9, 3.8, 4, 3.9, 5.1, 5.1, 5.5, 4, 3.8, 4.4, 3.8, 3.8, 
3.5, 3.3, 3.6, 3.5, 4.7, 5.1, 4.9, 3.8, 3.8, 4.3, 3.9, 3.8, 3.7, 
3.3, 3.7, 3.8, 4.3, 4.5, 4.4, 3.8, 3.4, 4, 3.7, 3.6, 3.3, 3.1, 
3.4, 3.6, 4.6, 4.5, 4.3, 3.8, 3.6, 4.2, 3.8, 3.6, 3.4, 3.3, 3.3, 
3.6, 4, 4, 3.9, 3.2, 3.3, 4.2, 3.9, 3.9, 3.6, 3.7, 4.1, 4.8, 
6.2, 7, 7.5, 6.7, 6.7, 7.6, 7, 6.9, 6.5, 6.3, 6.3, 6.7, 7.8, 
7.7, 7.7, 6.3, 6.1, 6.4, 6.5, 6.2, 5.6, 5.4, 5.5, 5.4, 6.4, 6.6, 
6.3, 5.6, 5.5, 6.6, 6.1, 5.9, 5.3, 5.1, 5, 5, 5.9, 6.2, 5.8, 
4.9, 5.1, 6, 5.8, 5.5, 4.7, 4.6, 4.7, 4.9, 6.3, 6.3, 5.7, 5.3, 
5.1, 5.7), footnote_codes = c("", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
"S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", 
"S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", 
"S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "E", "E", "E", 
"E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", 
"E", "E", "E", "E", "E", "E", "E", "E", "", "", "", "", "", "P" 
), date = structure(list(sec = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 7L, 8L, 9L, 10L, 11L, 0L, 1L, 
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 0L, 1L, 2L, 3L, 
4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 0L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 11L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 
8L, 9L, 10L, 11L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 
10L, 11L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 
0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 0L, 1L, 
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 0L, 1L, 2L, 3L, 
4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 0L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 11L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 
8L, 9L, 10L, 11L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 
10L, 11L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 
0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 0L, 1L, 
2L, 3L, 4L, 5L), year = c(90L, 90L, 90L, 90L, 90L, 90L, 90L, 
90L, 90L, 90L, 90L, 90L, 91L, 91L, 91L, 91L, 91L, 91L, 91L, 
91L, 91L, 91L, 91L, 91L, 92L, 92L, 92L, 92L, 92L, 92L, 92L, 
92L, 92L, 92L, 92L, 92L, 93L, 93L, 93L, 93L, 93L, 93L, 93L, 
93L, 93L, 93L, 93L, 93L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 
94L, 94L, 94L, 94L, 94L, 95L, 95L, 95L, 95L, 95L, 95L, 95L, 
95L, 95L, 95L, 95L, 95L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 
96L, 96L, 96L, 96L, 96L, 97L, 97L, 97L, 97L, 97L, 97L, 97L, 
97L, 97L, 97L, 97L, 97L, 98L, 98L, 98L, 98L, 98L, 98L, 98L, 
98L, 98L, 98L, 98L, 98L, 99L, 99L, 99L, 99L, 99L, 99L, 99L, 
99L, 99L, 99L, 99L, 99L, 100L, 100L, 100L, 100L, 100L, 100L, 
100L, 100L, 100L, 100L, 100L, 100L, 101L, 101L, 101L, 101L, 
101L, 101L, 101L, 101L, 101L, 101L, 101L, 101L, 102L, 102L, 
102L, 102L, 102L, 102L, 102L, 102L, 102L, 102L, 102L, 102L, 
103L, 103L, 103L, 103L, 103L, 103L, 103L, 103L, 103L, 103L, 
103L, 103L, 104L, 104L, 104L, 104L, 104L, 104L, 104L, 104L, 
104L, 104L, 104L, 104L, 105L, 105L, 105L, 105L, 105L, 105L, 
105L, 105L, 105L, 105L, 105L, 105L, 106L, 106L, 106L, 106L, 
106L, 106L, 106L, 106L, 106L, 106L, 106L, 106L, 107L, 107L, 
107L, 107L, 107L, 107L, 107L, 107L, 107L, 107L, 107L, 107L, 
108L, 108L, 108L, 108L, 108L, 108L, 108L, 108L, 108L, 108L, 
108L, 108L, 109L, 109L, 109L, 109L, 109L, 109L, 109L, 109L, 
109L, 109L, 109L, 109L, 110L, 110L, 110L, 110L, 110L, 110L, 
110L, 110L, 110L, 110L, 110L, 110L, 111L, 111L, 111L, 111L, 
111L, 111L, 111L, 111L, 111L, 111L, 111L, 111L, 112L, 112L, 
112L, 112L, 112L, 112L, 112L, 112L, 112L, 112L, 112L, 112L, 
113L, 113L, 113L, 113L, 113L, 113L), wday = c(1L, 4L, 4L, 
0L, 2L, 5L, 0L, 3L, 6L, 1L, 4L, 6L, 2L, 5L, 5L, 1L, 3L, 6L, 
1L, 4L, 0L, 2L, 5L, 0L, 3L, 6L, 0L, 3L, 5L, 1L, 3L, 6L, 2L, 
4L, 0L, 2L, 5L, 1L, 1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212L, 243L, 273L, 304L, 334L, 0L, 
31L, 59L, 90L, 120L, 151L, 181L, 212L, 243L, 273L, 304L, 
334L, 0L, 31L, 60L, 91L, 121L, 152L, 182L, 213L, 244L, 274L, 
305L, 335L, 0L, 31L, 59L, 90L, 120L, 151L, 181L, 212L, 243L, 
273L, 304L, 334L, 0L, 31L, 59L, 90L, 120L, 151L, 181L, 212L, 
243L, 273L, 304L, 334L, 0L, 31L, 59L, 90L, 120L, 151L, 181L, 
212L, 243L, 273L, 304L, 334L, 0L, 31L, 60L, 91L, 121L, 152L, 
182L, 213L, 244L, 274L, 305L, 335L, 0L, 31L, 59L, 90L, 120L, 
151L, 181L, 212L, 243L, 273L, 304L, 334L, 0L, 31L, 59L, 90L, 
120L, 151L, 181L, 212L, 243L, 273L, 304L, 334L, 0L, 31L, 
59L, 90L, 120L, 151L, 181L, 212L, 243L, 273L, 304L, 334L, 
0L, 31L, 60L, 91L, 121L, 152L, 182L, 213L, 244L, 274L, 305L, 
335L, 0L, 31L, 59L, 90L, 120L, 151L, 181L, 212L, 243L, 273L, 
304L, 334L, 0L, 31L, 59L, 90L, 120L, 151L, 181L, 212L, 243L, 
273L, 304L, 334L, 0L, 31L, 59L, 90L, 120L, 151L, 181L, 212L, 
243L, 273L, 304L, 334L, 0L, 31L, 60L, 91L, 121L, 152L, 182L, 
213L, 244L, 274L, 305L, 335L, 0L, 31L, 59L, 90L, 120L, 151L, 
181L, 212L, 243L, 273L, 304L, 334L, 0L, 31L, 59L, 90L, 120L, 
151L, 181L, 212L, 243L, 273L, 304L, 334L, 0L, 31L, 59L, 90L, 
120L, 151L, 181L, 212L, 243L, 273L, 304L, 334L, 0L, 31L, 
60L, 91L, 121L, 152L, 182L, 213L, 244L, 274L, 305L, 335L, 
0L, 31L, 59L, 90L, 120L, 151L, 181L, 212L, 243L, 273L, 304L, 
334L, 0L, 31L, 59L, 90L, 120L, 151L, 181L, 212L, 243L, 273L, 
304L, 334L, 0L, 31L, 59L, 90L, 120L, 151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 
1L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 
0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 1L)), .Names = c("sec", 
"min", "hour", "mday", "mon", "year", "wday", "yday", "isdst" 
), class = c("POSIXlt", "POSIXt"))), .Names = c("series_id", 
"year", "period", "value", "footnote_codes", "date"), row.names = c(40841L, 
40842L, 40843L, 40844L, 40845L, 40846L, 40847L, 40848L, 40849L, 
40850L, 40851L, 40852L, 40854L, 40855L, 40856L, 40857L, 40858L, 
40859L, 40860L, 40861L, 40862L, 40863L, 40864L, 40865L, 40867L, 
40868L, 40869L, 40870L, 40871L, 40872L, 40873L, 40874L, 40875L, 
40876L, 40877L, 40878L, 40880L, 40881L, 40882L, 40883L, 40884L, 
40885L, 40886L, 40887L, 40888L, 40889L, 40890L, 40891L, 40893L, 
40894L, 40895L, 40896L, 40897L, 40898L, 40899L, 40900L, 40901L, 
40902L, 40903L, 40904L, 40906L, 40907L, 40908L, 40909L, 40910L, 
40911L, 40912L, 40913L, 40914L, 40915L, 40916L, 40917L, 40919L, 
40920L, 40921L, 40922L, 40923L, 40924L, 40925L, 40926L, 40927L, 
40928L, 40929L, 40930L, 40932L, 40933L, 40934L, 40935L, 40936L, 
40937L, 40938L, 40939L, 40940L, 40941L, 40942L, 40943L, 40945L, 
40946L, 40947L, 40948L, 40949L, 40950L, 40951L, 40952L, 40953L, 
40954L, 40955L, 40956L, 40958L, 40959L, 40960L, 40961L, 40962L, 
40963L, 40964L, 40965L, 40966L, 40967L, 40968L, 40969L, 40971L, 
40972L, 40973L, 40974L, 40975L, 40976L, 40977L, 40978L, 40979L, 
40980L, 40981L, 40982L, 40984L, 40985L, 40986L, 40987L, 40988L, 
40989L, 40990L, 40991L, 40992L, 40993L, 40994L, 40995L, 40997L, 
40998L, 40999L, 41000L, 41001L, 41002L, 41003L, 41004L, 41005L, 
41006L, 41007L, 41008L, 41010L, 41011L, 41012L, 41013L, 41014L, 
41015L, 41016L, 41017L, 41018L, 41019L, 41020L, 41021L, 41023L, 
41024L, 41025L, 41026L, 41027L, 41028L, 41029L, 41030L, 41031L, 
41032L, 41033L, 41034L, 41036L, 41037L, 41038L, 41039L, 41040L, 
41041L, 41042L, 41043L, 41044L, 41045L, 41046L, 41047L, 41049L, 
41050L, 41051L, 41052L, 41053L, 41054L, 41055L, 41056L, 41057L, 
41058L, 41059L, 41060L, 41062L, 41063L, 41064L, 41065L, 41066L, 
41067L, 41068L, 41069L, 41070L, 41071L, 41072L, 41073L, 41075L, 
41076L, 41077L, 41078L, 41079L, 41080L, 41081L, 41082L, 41083L, 
41084L, 41085L, 41086L, 41088L, 41089L, 41090L, 41091L, 41092L, 
41093L, 41094L, 41095L, 41096L, 41097L, 41098L, 41099L, 41101L, 
41102L, 41103L, 41104L, 41105L, 41106L, 41107L, 41108L, 41109L, 
41110L, 41111L, 41112L, 41114L, 41115L, 41116L, 41117L, 41118L, 
41119L, 41120L, 41121L, 41122L, 41123L, 41124L, 41125L, 41127L, 
41128L, 41129L, 41130L, 41131L, 41132L, 41133L, 41134L, 41135L, 
41136L, 41137L, 41138L, 41140L, 41141L, 41142L, 41143L, 41144L, 
41145L), class = "data.frame") 
+1

也許你有嵌套列表或東西?如何[可重現的例子](http:// stackoverflow。COM /問題/ 5963269 /如何對做 - 一個偉大-R-重複性,例如)? – GSee

+0

我試圖縮小它,使其重現。謝謝你的耐心。 – tjbrooks

+0

解決方案是將SeasAdj函數中的'dimnames(xts.adj)< - names'註釋掉。 – tjbrooks

回答

1

對我的作品

library(quantmod) 
e <- new.env() 
s <- c("SPY", "DIA", "GLD") 
getSymbols(s, env=e) 
l.adj <- eapply(e, Ad)[s] 
l.qtr <- lapply(l.adj, function(x) apply.quarterly(x, mean)) 

編輯

該代碼仍然不可重複(或最小),但dimnames(xts.adj) <- names看起來可疑。它看起來像要設置dimnames爲NULL(見lapply(split(lax.xts, "quarters"), dimnames)

如果設置了XTS爲NULL的dimnames,你最終把它變成東西as.xts不能轉換爲xts。我認爲這可能不是xts:::`dimnames<-.xts`的預期行爲。


因爲我無法運行你的代碼,我不知道是肯定的,這是問題,但如果是這樣,這裏是一個更簡潔的可重複的例子。

x <- xts(1:5, .POSIXct(0)+1:5) 
dimnames(x) <- dimnames(x) 
as.xts(x) 
#Error in as.xts.matrix(x) : 
# order.by must be either 'rownames()' or otherwise specified 
+0

這也適用於我,這表明我的問題在別處。我已經更新了最初的問題以提供數據和一些可重複性。 – tjbrooks

+0

'Gsee'感謝您的耐心和幫助。你的懷疑是正確的。在我的幫助函數中註釋掉'dimnames'解決了這個問題。我很抱歉,因爲它是我生成的'xts'對象與下載的'xts'對象之間的差異的一部分,在我最後一次編輯之後它應該是顯而易見的。再次感謝。 – tjbrooks

+0

看起來Joshua在R-forge的修訂版784中修補了這個bug(https://r-forge.r-project.org/tracker/index.php?func=detail&aid=4794&group_id=118&atid=516)。 – GSee

相關問題