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

Implement $str$to_date(), $str$to_time(), $str$to_datetime() #558

Merged
merged 6 commits into from
Dec 5, 2023

Conversation

etiennebacher
Copy link
Collaborator

@etiennebacher etiennebacher commented Dec 2, 2023

They were already there but not available through the namespace $str because they were only used in $str$strptime()

Also updated the arguments because some were deprecated/removed upstream

Merge branch 'main' into to-date

# Conflicts:
#	R/extendr-wrappers.R
@etiennebacher etiennebacher marked this pull request as draft December 2, 2023 10:46
@etiennebacher etiennebacher changed the title Implement $str$to_date() and $str$to_datetime() Implement $str$to_date(), $str$to_time(), $str$to_datetime() Dec 4, 2023
@etiennebacher etiennebacher marked this pull request as ready for review December 4, 2023 18:24
Copy link
Collaborator

@eitsupi eitsupi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

Just a minor comment.

Comment on lines +118 to +121
ExprStr_to_date = function(format = NULL, strict = TRUE, exact = TRUE, cache = TRUE) {
.pr$Expr$str_to_date(self, format, strict, exact, cache) |>
unwrap("in $str$to_date():")
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably applicable to other functions as well, but such functions may be better off using ... to enforce named arguments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but then you lose the description of each param in the docs, no? In any case, if that concerns several other functions it can be done in another PR so I'm merging this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but then you lose the description of each param in the docs, no?

I'm sorry, but I don't understand. Here's what I mean:

ExprStr_to_date = function(..., format = NULL, strict = TRUE, exact = TRUE, cache = TRUE)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, could be added later but that could also apply to basically all functions that have several args

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.
I think it's safer to do this for most of the functions that have a lot of arguments.

@etiennebacher etiennebacher merged commit 71e9880 into main Dec 5, 2023
31 checks passed
@etiennebacher etiennebacher deleted the to-date branch December 5, 2023 12:46
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

Successfully merging this pull request may close these issues.

None yet

2 participants