-
-
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
base: main
Are you sure you want to change the base?
Changes from 6 commits
94ca7ff
246bd30
427586b
bdcba9c
98bd4ca
243acf4
6d198da
3c224c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #' 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)data | ||
| #' | ||
| #' @export | ||
| append_join_keys <- function(x, values, after = length(join_keys(x))) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need the IIRC it has no practical effect (all join keys list elements are named and referenced as such).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right : D
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @averissimo so maybe we can change the name to
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Go for it! |
||
| checkmate::assert_class(x, "teal_data") | ||
| checkmate::assert_int(after, lower = 0, upper = length(join_keys(x)), null.ok = TRUE) | ||
|
|
||
|
m7pr marked this conversation as resolved.
|
||
| join_keys(x) <- append(join_keys(x), values, after = after) | ||
| x | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.