Skip to content

Adding translations for clock::date_count_between() #1495

@edward-burn

Description

@edward-burn

To go with existing clock translations (like these

add_days = function(x, n, ...) {
), one other function from clock that I think would be very useful to translate would be date_count_between, so code like below would work if the data were in a database.

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(clock)

test_data <- data.frame(
  person = 1L,
  date_1 = as.Date("1980-01-01"),
  date_2 = as.Date("2010-01-01")
) 

test_data |> 
  mutate(days = date_count_between(date_1, date_2, "day"))
#>   person     date_1     date_2  days
#> 1      1 1980-01-01 2010-01-01 10958

Created on 2024-05-04 with reprex v2.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementfunc trans 🌍Translation of individual functions to SQL

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions