-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bizdays
& bizdiff
function not functioning, returning error instead.
#98
Comments
Same problem with Example usage: |
bizdays
function not functioning, returning error instead.bizdays
& bizdiff
function not functioning, returning error instead.
I created the following reprex and I couldn't reproduce the problems you reported. If you run library(bizdays)
#>
#> Attaching package: 'bizdays'
#> The following object is masked from 'package:stats':
#>
#> offset
cal <- load_calendar("C:/Users/wilso/Dev/R/R-bizdays/test.json")
calendars()
#> Calendars:
#> actual, Brazil/ANBIMA, Brazil/B3, Brazil/BMF, kospi, weekends
bizdays(as.Date("2019-01-07"), as.Date("2020-01-03"), "kospi")
#> [1] 250
bizdays("2019-01-07", "2020-01-03", "kospi")
#> [1] 250
bizdiff(c("2019-01-07", "2020-01-03"), "kospi")
#> [1] 250 Created on 2022-10-15 with reprex v2.0.2 |
Even without the package loading the code worked here. cal <- bizdays::load_calendar("C:/Users/wilso/Dev/R/R-bizdays/test.json")
bizdays::calendars()
#> Calendars:
#> kospi
bizdays::bizdays(as.Date("2019-01-07"), as.Date("2020-01-03"), "kospi")
#> [1] 250
bizdays::bizdays("2019-01-07", "2020-01-03", "kospi")
#> [1] 250
bizdays::bizdiff(c("2019-01-07", "2020-01-03"), "kospi")
#> [1] 250 Created on 2022-10-15 with reprex v2.0.2 |
I keep receiving the following error:
Error in cal$adjust.from(new.from, cal) : attempt to apply non-function
when using
bizdays
, in the following manner:bizdays::bizdays(as.Date("2019-01-07"), as.Date("2020-01-03"), cal)
Or simply as:
bizdays::bizdays("2019-01-07", "2020-01-03", cal)
Cal is a user-created calendar using 'create.calendars', which I loaded manually. It functions normally with the other functions of bizdays.
Details of the calendar are as following, in json format:
{ "name": "kospi", "weekdays": [ "saturday", "sunday" ], "holidays": [ "2019-01-01", "2019-01-21", "2019-02-18", "2019-04-19", "2019-05-27", "2019-07-04", "2019-09-02", "2019-11-28", "2019-12-25", "2020-01-01", "2020-01-24", "2020-01-27", "2020-04-30", "2020-05-01", "2020-05-05", "2020-08-30", "2020-10-01", "2020-10-02", "2020-10-09", "2020-12-25", "2020-10-31" ], "adjust.from": "following", "adjust.to": "preceding", "financial": true }
The text was updated successfully, but these errors were encountered: