[R-SIG-Finance] getEndOfMonth and getEndOfBizWeek in RcppBDT broken?
Dirk Eddelbuettel
edd at debian.org
Wed Aug 8 19:42:52 CEST 2012
On 8 August 2012 at 11:17, David Reiner wrote:
| At least on my setup, they don't seem to work:
|
| > getEndOfBizWeek(date=as.Date('2012-09-05'))
| [1] "2012-08-10"
| > getEndOfMonth(date=as.Date('2012-09-05'))
| [1] "2012-08-31"
Dang. The functions hang off a package-global instance of the BDT module
class, and that one doesn't seem to get updated from the date you feed. Not
good.
Workaround: init a new object using the explicit constructor with the date
you want and compute off that:
R> mynewdate <- new(bdtDate, 2012,9,5)
R> mynewdate
[1] "2012-09-05"
R> mynewdate$getEndOfBizWeek( )
[1] "2012-09-07"
R> mynewdate$getEndOfMonth( )
[1] "2012-09-30"
R>
R>
Dirk
| > sessionInfo()
| R version 2.15.1 Patched (2012-06-25 r59634)
| Platform: x86_64-pc-mingw32/x64 (64-bit)
|
| 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] stats graphics grDevices utils datasets methods base
|
| other attached packages:
| [1] RcppBDT_0.2.0 Rcpp_0.9.13
|
| loaded via a namespace (and not attached):
| [1] codetools_0.2-8 tools_2.15.1
|
| Many thanks to Dirk for all of his contributions to our community!
| (and to anyone else who can help here!)
| -- David
|
|
|
| This e-mail and any materials attached hereto, including, without limitation, all content hereof and thereof (collectively, "XR Content") are confidential and proprietary to XR Trading LLC ("XR") and/or its affiliates, and are protected by intellectual property laws. Without the prior written consent of XR, the XR Content may not (i) be disclosed to any third party or (ii) be reproduced or otherwise used by anyone other than current employees of XR or its affiliates, on behalf of XR or its affiliates.
|
| THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY KIND. TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.
|
| [[alternative HTML version deleted]]
|
| _______________________________________________
| R-SIG-Finance at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-sig-finance
| -- Subscriber-posting only. If you want to post, subscribe first.
| -- Also note that this is not the r-help list where general R questions should go.
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the R-SIG-Finance
mailing list