Questions tagged [bizdays]

An R package to calculate business days based on holidays.

27 questions
0
votes
1 answer

R unexpected behaviour of bizdays::adjust.previous when checking if date is NA

I trying to convert dates inside a dataframe to business days using bizdays package. This dataframe may have some missing values (NA), so I added an ifelse statement to ignore these empty cells, but it seems like it breaks the code and I don't know…
0
votes
1 answer

find average incidents per business day

I've a dataset as under: +----+-------+---------------------+ | ID | SUBID | date | +----+-------+---------------------+ | A | 1 | 2021-01-01 12:00:00 | | A | 1 | 2021-01-02 01:00:00 | | A | 1 | 2021-01-02 02:00:00 | |…
San Saw
  • 3
  • 2
0
votes
1 answer

How to exclude certain dates in bizdays() from Bizdays Package in R

I'm trying to exclude the following dates when using bizdays() in R: 2021-02-15 and 2021-02-16. I have the following code: library(bizdays) library(lubridate) create.calendar(name='MyCalendar', weekdays=c('sunday', 'saturday'), …
caproki
  • 348
  • 2
  • 18
0
votes
1 answer

How to include "from" day in bizdays() in R

Let's say I do the following: create.calendar(name='MyCalendar', weekdays=c('sunday', 'saturday'), adjust.from=adjust.next, adjust.to=adjust.previous) bizdays.options$set(default.calendar='MyCalendar') Now, I want to calculate the…
caproki
  • 348
  • 2
  • 18
0
votes
1 answer

R how to get sixth workday of the month

I have a vector of business dates: require(bizdays) cal <- create.calendar(name='MyCalendar', weekdays=c('sunday', 'saturday')) startdate = as.Date(Sys.Date()) %m-% years(5) # today minus 5yrs enddate = as.Date(Sys.Date()) dates =…
Jelle Jansen
  • 448
  • 4
  • 16
0
votes
1 answer

Trying to calculate a difference in dates, while excluding weekends - R-studio

IT_tickets[,"ticket_age"] <- NA {R aging_count for Tasks} IT_tickets$ticket_age[c(all_tasks)] <- difftime(IT_tickets$closed_at_date[c(all_tasks)], IT_tickets$sys_created_date[c(all_tasks)], units = "days") I have this column called "ticket age" in…
0
votes
0 answers

R bizdays::create.calendar Error in seq.int(0, to0 - from, by) : 'to' must be a finite number

Trying to use bizdays::create.calendar I am getting the following error Error in seq.int(0, to0 - from, by) : 'to' must be a finite number my holiday vector looks like > arsHol V1 1 2018-01-01 2 2018-01-15 3 2018-02-12 4 …
dmaz
  • 1
0
votes
1 answer

R: Include only business day observations in a data frame with observations for all days

I have a data frame with a date column and two columns of observations. I want to create a new data frame where only the observations that are from business days are included. I tried df=df[which(weekdays.Date(as.Date.dates(df$Date, format =…
axor93
  • 1
0
votes
0 answers

R - Impossible to install R package 'bizdays'

I am looking to install bizdays package for R. I tried the traditional method, and the one below, with not much success. Can someone please help to understand why this specific package cannot get installed but all the others are going through OK. I…
Rene Chan
  • 864
  • 1
  • 11
  • 25
0
votes
1 answer

How to find difference between two dates excluding Sunday in R

I have two dates and I want to find no. of days between these dates excluding Sunday. I tried it using bizdays() but it doesn't seem to be giving correct output. Here is what I've tried. library(bizdays) #Dates are in Y-m-d format Start_Date <-…
Kailash
  • 167
  • 1
  • 2
  • 12
0
votes
0 answers

creating list of objects with names from a list

hopefully it is not a duplicate, rather difficult to phrase it correctly (relatively new to R) So the problem is: I want to use sequences of dates excluding certain weekdays based on the row information. I can use bizdays and create calendar objects…
Slav
  • 469
  • 4
  • 18
-1
votes
4 answers

Round date to next weekday in R

I'm currently struggling with some date transformations in R. I have a large dataset of financial data with a date column. Since securities are not traded on the weekend, I need to have only weekdays in my dataset. How can I round the dates in this…
rbonac
  • 125
  • 2
  • 14
1
2