Skip to content
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

Adding translations for clock::date_count_between() #1495

Open
edward-burn opened this issue May 4, 2024 · 0 comments
Open

Adding translations for clock::date_count_between() #1495

edward-burn opened this issue May 4, 2024 · 0 comments

Comments

@edward-burn
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant