簡體   English   中英

xy.coords(x,y)中的錯誤:'x'和'y'的長度不同圖表.PerformanceSummary R XTS

[英]Error in xy.coords(x, y) : 'x' and 'y' lengths differ charts.PerformanceSummary R XTS

運行以下代碼:

charts.PerformanceSummary( xts(c(.05,.01,-0.1),as.POSIXct(c('2018-02-28','2018-03-29','2018-04-24'))))

我收到錯誤:

Error in xy.coords(x, y) : 'x' and 'y' lengths differ

這是sessionInfo()的結果:

    R version 3.4.4 (2018-03-15)
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    Running under: Windows >= 8 x64 (build 9200)

    Matrix products: default

    locale:
    [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252            LC_MONETARY=English_United States.1252
    [4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

    attached base packages:
    [1] compiler  parallel  stats     graphics  grDevices utils     datasets  methods   base     

    other attached packages:
     [1] googlesheets_0.2.2         PerformanceAnalytics_1.5.2 doParallel_1.0.11          iterators_1.0.9            foreach_1.4.4             
     [6] TTR_0.23-3                 xts_0.10-2                 zoo_1.8-1                  RMySQL_0.10.14             DBI_0.8                   

    loaded via a namespace (and not attached):
     [1] Rcpp_0.12.16     bindr_0.1.1      magrittr_1.5     lattice_0.20-35  R6_2.2.2         rlang_0.2.0      quadprog_1.5-5   dplyr_0.7.4     
     [9] tools_3.4.4      grid_3.4.4       assertthat_0.2.0 tibble_1.4.2     bindrcpp_0.2     purrr_0.2.4      codetools_0.2-15 curl_3.1        
    [17] glue_1.2.0       pillar_1.2.1     cellranger_1.1.0 pkgconfig_2.0.1 

我正在使用XTS的0.10-2版和PerformanceAnalytics的1.5.2版。

您的問題在這里解決了Github PerfomanceAnalytics

第一:

charts.PerformanceSummary(xts(c(.05,.01,-0.1), as.POSIXct(c('2018-02-28','2018-03-29','2018-04-24'), tz = "UTC")))

第二:

charts.PerformanceSummary(xts(c(.05,.01,-0.1), as.Date(c('2018-02-28','2018-03-29','2018-04-24'))))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM