-
-
Notifications
You must be signed in to change notification settings - Fork 9
append_join_keys for teal_data object
#373
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
Open
m7pr
wants to merge
8
commits into
main
Choose a base branch
from
append@teal_reportable
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+80
−19
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
94ca7ff
WIP
gogonzo 246bd30
roxy
gogonzo 427586b
fix split_code error
gogonzo bdcba9c
cleanup: remove print debug
averissimo 98bd4ca
change message in show method for `teal_data` (#372)
m7pr 243acf4
append_join_keys to teal_data object
m7pr 6d198da
Update R/join_keys-append.R
m7pr 3c224c6
Update R/join_keys-append.R
m7pr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #' Append elements to join_keys | ||
| #' | ||
| #' This function appends elements to the join_keys slot of a teal_data object. | ||
| #' It follows the same pattern as base R's append() function. | ||
| #' | ||
| #' @param x A teal_data object | ||
| #' @param values (`join_keys`) object to append | ||
| #' @param after Integer, the position after which the elements are to be appended. | ||
| #' If negative or zero, the values are prepended to the join_keys. | ||
| #' If missing, the values are appended at the end. | ||
| #' | ||
| #' @return A teal_data object with updated join_keys | ||
| #' | ||
| #' @examples | ||
| #' data <- teal_data() | ||
| #' keys1 <- join_keys( | ||
| #' join_key("ADSL", "ADSL", "USUBJID"), | ||
| #' join_key("ADAE", "ADAE", "USUBJID"), | ||
| #' join_key("ADSL", "ADAE", c(USUBJID = "USUBJID")) | ||
| #' ) | ||
| #' data <- append_join_keys(data, keys1) | ||
| #' join_keys(data) | ||
| #' | ||
| #' @export | ||
| append_join_keys <- function(x, values, after = length(join_keys(x))) { | ||
| checkmate::assert_class(x, "teal_data") | ||
| checkmate::assert_int(after, lower = 0, upper = length(join_keys(x)), null.ok = TRUE) | ||
| checkmate::assert_class(value, "join_keys") | ||
|
|
||
m7pr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| join_keys(x) <- append(join_keys(x), values, after = after) | ||
| x | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the
afterargument?IIRC it has no practical effect (all join keys list elements are named and referenced as such).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right : D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@averissimo so maybe we can change the name to
add_join_keysThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go for it!