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

feat: make $otherwise optional in when-then-otherwise expressions #836

Merged
merged 11 commits into from
Feb 24, 2024

Conversation

eitsupi
Copy link
Collaborator

@eitsupi eitsupi commented Feb 23, 2024

Close #599

@eitsupi eitsupi changed the title fix: allow ending with $then(...) feat: allow ending with $then(...) Feb 23, 2024
@eitsupi eitsupi marked this pull request as ready for review February 23, 2024 15:53
@eitsupi eitsupi changed the title feat: allow ending with $then(...) feat: make $otherwise optional in when-then-otherwise expressions Feb 23, 2024
Copy link
Collaborator

@etiennebacher etiennebacher left a comment

Choose a reason for hiding this comment

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

That looks great, thanks! Just some minor comments on docs

NEWS.md Outdated Show resolved Hide resolved
#' `$otherwise()` when you arrive at the end of your chain.
#' Note that one difference with the Python implementation is that we *must*
#' end the chain with an `$otherwise()` statement.
#' `when-then-otherwise` is similar to R [`ifelse()`]. Always initiated by a
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#' `when-then-otherwise` is similar to R [`ifelse()`]. Always initiated by a
#' `when-then-otherwise` is similar to R [`ifelse()`]. It is always initiated by a

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In fact, this text is copied from the Python package, so I would like to leave it as is.

#' * `<ChainedThen>$otherwise()`returns an [Expression][Expr_class] object.
#' If none of the conditions are `true`, an optional
#' `$otherwise(<value if all statements are false>)` can be appended at the end.
#' If not appended, and none of the conditions are `true`, `null` will be returned.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#' If not appended, and none of the conditions are `true`, `null` will be returned.
#' If not appended, and none of the conditions are `true`, it will return `null`.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ditto.

R/functions__whenthen.R Outdated Show resolved Hide resolved
R/functions__whenthen.R Outdated Show resolved Hide resolved
R/functions__whenthen.R Outdated Show resolved Hide resolved
R/functions__whenthen.R Outdated Show resolved Hide resolved
@etiennebacher etiennebacher merged commit 9a09cb4 into main Feb 24, 2024
34 checks passed
@etiennebacher etiennebacher deleted the optional-otherwise branch February 24, 2024 06:29
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.

otherwise is not optional in r-polars's when-then
2 participants