# Counting Business Days spent for shipping etc

**URL:** <https://community.exploratory.io/t/counting-business-days-spent-for-shipping-etc/1718>\
**Category:** Uncategorized\
**Created:** [July 17, 2019, 10:29pm UTC](https://community.exploratory.io/t/counting-business-days-spent-for-shipping-etc/1718 "2019-07-17T22:29:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hideaki\_Hayashi](https://community.exploratory.io/user_avatar/community.exploratory.io/hideaki_hayashi/32/10_2.png) [@Hideaki\_Hayashi](https://community.exploratory.io/u/Hideaki_Hayashi)\
**Post date:** [July 17, 2019, 10:29pm UTC](https://community.exploratory.io/t/counting-business-days-spent-for-shipping-etc/1718/1 "2019-07-17T22:29:17Z")

</div>

For example, if you want to count how many business days were spent between the days your business received orders and the days you shipped for the orders, you can do the following.

1. Install bizdays R package in Exploratory.

2. Define a calendar (named ‘MyCalendar’ here.) for your business days in Custom R Script.  
Here is example script.

```auto
library(bizdays)
holidays <- as.character(c("2000-01-01", "2019-07-04", "2019-09-02", "2019-10-14", "2050-01-01")) #4th of July and Labor day and Columbus day

bizdays::create.calendar(name='MyCalendar', holidays=holidays, weekdays=c('sunday', 'saturday'),
                                adjust.from=adjust.next, adjust.to=adjust.previous)
                                
TRUE #This is just to pass validation of this script.

```

 ![image](https://community.exploratory.io/uploads/default/original/1X/7f9498892ac70bd008cb7e29f7ced1acacd93608.png)

1. Use it from mutate step.

When I have table like this…

 ![image](https://community.exploratory.io/uploads/default/original/1X/c2c33c2a1923cd23801bb32b8959e78024f3d8a9.png)

With this mutate step…

```auto
bizdays(`Order Date`, `Ship Date`, "MyCalendar")

```

 ![image](https://community.exploratory.io/uploads/default/original/1X/b4900bcb7265c582f659fed71518f637b4f90db1.png)

I can get the following Data Frame with the column for business days spent for shipping.

 ![image](https://community.exploratory.io/uploads/default/original/1X/ec9561f926fdac07cf40002841f663fb45cd0fb3.png)
