Coder Social home page Coder Social logo

calendarrr's People

Contributors

claytonjy avatar davisvaughan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

calendarrr's Issues

Clean up cpp file structure

Should be more like:

src/myfiles.cpp

src/ql/include/allheaders-mimicking-qlcppfilestructure.hpp

src/ql/cppfilestructure.cpp <- with folders here too

It would require the Makevars to point to:

-I ./ql/include ../../inst/include <- my headers

Also would maybe need the OBJECT thing to point to everything in src/ql/*.cpp?

Missing mathconstants.hpp - can't install

Hey Davis,

Wanted to mess around with this but having issues installing with R 3.4.4 on a 64-bit linux system. Looks like it's missing a source/ql/mathconstants.hpp?

> devtools::install_github("DavisVaughan/calendarrr")
Downloading GitHub repo DavisVaughan/calendarrr@master
from URL https://api.github.com/repos/DavisVaughan/calendarrr/zipball/master
Installing calendarrr
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/RtmpvrbyJD/devtools531f15c54bbc/DavisVaughan-calendarrr-dd7bfba' --library='/home/claytonjy/R/x86_64-pc-linux-gnu-library/3.4'  \
  --install-tests 

* installing *source* packagecalendarrr...
** libs
g++  -I/usr/share/R/include -DNDEBUG -I . -I ../inst/include -I"/home/claytonjy/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/claytonjy/R/x86_64-pc-linux-gnu-library/3.4/BH/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c cal_identifiers.cpp -o cal_identifiers.o
In file included from ./ql/errors.hpp:28:0,
                 from ./ql/time/calendar.hpp:29,
                 from cal_identifiers.cpp:1:
./ql/qldefines.hpp:126:32: fatal error: ql/mathconstants.hpp: No such file or directory
compilation terminated.
/usr/lib/R/etc/Makeconf:168: recipe for target 'cal_identifiers.o' failed
make: *** [cal_identifiers.o] Error 1
ERROR: compilation failed for packagecalendarrr* removing/home/claytonjy/R/x86_64-pc-linux-gnu-library/3.4/calendarrrInstallation failed: Command failed (1)

Created on 2018-08-23 by the reprex package (v0.2.0).
(not really; messages didn't show up in reprex so I did that interactively)

Session info
devtools::session_info()
#> Session info -------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.4.4 (2018-03-15)
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  tz       America/Detroit             
#>  date     2018-08-23
#> Packages -----------------------------------------------------------------
#>  package   * version date       source        
#>  backports   1.1.2   2017-12-13 CRAN (R 3.4.4)
#>  base      * 3.4.4   2018-03-16 local         
#>  compiler    3.4.4   2018-03-16 local         
#>  curl        3.2     2018-03-28 CRAN (R 3.4.4)
#>  datasets  * 3.4.4   2018-03-16 local         
#>  devtools    1.13.6  2018-06-27 CRAN (R 3.4.4)
#>  digest      0.6.15  2018-01-28 CRAN (R 3.4.4)
#>  evaluate    0.11    2018-07-17 CRAN (R 3.4.4)
#>  git2r       0.23.0  2018-07-17 CRAN (R 3.4.4)
#>  graphics  * 3.4.4   2018-03-16 local         
#>  grDevices * 3.4.4   2018-03-16 local         
#>  htmltools   0.3.6   2017-04-28 CRAN (R 3.4.4)
#>  httr        1.3.1   2017-08-20 CRAN (R 3.4.4)
#>  knitr       1.20    2018-02-20 CRAN (R 3.4.4)
#>  magrittr    1.5     2014-11-22 CRAN (R 3.4.4)
#>  memoise     1.1.0   2017-04-21 CRAN (R 3.4.4)
#>  methods   * 3.4.4   2018-03-16 local         
#>  R6          2.2.2   2017-06-17 CRAN (R 3.4.4)
#>  Rcpp        0.12.18 2018-07-23 CRAN (R 3.4.4)
#>  rmarkdown   1.10    2018-06-11 CRAN (R 3.4.4)
#>  rprojroot   1.3-2   2018-01-03 CRAN (R 3.4.4)
#>  stats     * 3.4.4   2018-03-16 local         
#>  stringi     1.2.4   2018-07-20 CRAN (R 3.4.4)
#>  stringr     1.3.1   2018-05-10 CRAN (R 3.4.4)
#>  tools       3.4.4   2018-03-16 local         
#>  utils     * 3.4.4   2018-03-16 local         
#>  withr       2.1.2   2018-03-15 CRAN (R 3.4.4)
#>  yaml        2.2.0   2018-07-25 CRAN (R 3.4.4)

Simplify interface

Overall goal is to remove the external pointer from the R6 object. This would allow a number of benefits including:

Pros:

  • S3 rather than R6
  • Serializable object
  • Multiple instances of the same calendar with different holidays
  • No issues with .Last.value holding up the finalizer

Cons:

  • Have to create a cpp version of the calendar with the extra holidays + clean it up every time a fn is run. This should be a small price to pay as it should be fast.

Impl:

cal_create() should return S3
cal_create_cpp() should take that S3 list and actually create the cal but only when called by another function like cal_adjust()

S3 should be a list
calendar = list(cal = "TARGET", extra_holidays = NULL)

Same print method as now

tibbles of holiday info for each calendar

To make it easy to know what is already included in calendar holidays

Something like:

UnitedStates
tibble::tibble(holiday = "New Years", timing = "First day of January")

Export functionality

  • cal_add_holidays()
  • cal_remove_holidays()
  • cal_is_weekend()
  • cal_is_holiday()
  • cal_create()
  • cal_end_of_month()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.