Skip to content

addEventLines & yearmon index #353

Closed
@paessens

Description

@paessens

Description

I could not use addEventLines having both xts' indexed with yearmon format

Expected behavior

same as with YYYY-MM-DD indexes

Minimal, reproducible example

require(magrittr)
require(xts)
require(ecb)

data.frame(
  begin = c("1998-10-01","2000-04-01","2001-10-01","2008-10-01","2009-10-01","2020-04-01"),
  events = c("LTCM","dot com bubble","9/11","Lehman Bros.","Eurozone Crisis","Pandemic")) %>%
  read.zoo(FUN=as.yearmon) %>%
  as.xts() -> historical

'ICP.M.U2.N.000000.4.ANR' %>% ecb::get_data() %>%
  .[c('obstime','obsvalue')] %>%
  read.zoo(FUN=as.yearmon) %>% as.xts() -> HICP

plot(HICP,
     col='navy',lty=1,lwd=1.5, cex=0.5,
     grid.ticks.lty="dotted")
addEventLines(historical, col="#3357FF", cex=1,lty=1.5,lwd=2, srt=90, pos=2,offset=-.6,on=0)

Session Info

R version 4.0.5 (2021-03-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 10 (buster)

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.5.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] magrittr_2.0.1 ecb_0.4.0 xts_0.12.1 zoo_1.8-9

loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 lattice_0.20-44 XML_3.99-0.6 rsvg_2.1.2 digest_0.6.27 plyr_1.8.6 R6_2.5.0 grid_4.0.5
[9] rsdmx_0.6 evaluate_0.14 httr_1.4.2 quantmod_0.4.18 rlang_0.4.11 cachem_1.0.4 renv_0.13.2 curl_4.3.1
[17] TTR_0.24.2 rmarkdown_2.8 tools_4.0.5 xfun_0.22 yaml_2.2.1 fastmap_1.1.0 compiler_4.0.5 htmltools_0.5.1.1
[25] memoise_2.0.0 knitr_1.33

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions