Skip to contents

Calculate Number of Days Between Two Dates

Usage

days_between(df, from, to = NULL)

Arguments

df

<data.frame> or <tibble>

from

[character] column of start dates

to

[character] column of end dates

Value

a tibble

Examples

mock_claims(10)[c(
  "date_service",
  "charges",
  "payer")] |>
  days_between(date_service)
#> # A tibble: 10 × 4
#>    date_service charges payer             days_elapsed
#>    <date>         <dbl> <fct>                    <int>
#>  1 2024-07-01      311. Omaha                       21
#>  2 2024-06-29       45. American                    23
#>  3 2024-06-28       67. Equitable                   24
#>  4 2024-06-28      369. Allianz                     24
#>  5 2024-06-07       60. HCSC                        45
#>  6 2024-06-01      221. Molina                      51
#>  7 2024-05-20       49. Equitable                   63
#>  8 2024-05-20       17. BCBS MI                     63
#>  9 2024-05-02      122. Kaiser Permanente           81
#> 10 2024-04-19      149. American                    94