-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Introduce teal_data class #75
Conversation
@@ -12,6 +12,7 @@ options(shiny.useragg = FALSE) | |||
|
|||
nest_logo <- "https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png" | |||
|
|||
|
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.
Usually there is only one blank line between nest_logo
and everything that comes after
reproducible solution
|
||
# <code | ||
# set join_keys | ||
data@join_keys <- cdisc_join_keys(!!!datanames) |
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.
we need to fix this:
We need to reconsider following functions to have a robust and easy api.
join_keys
cdisc_join_keys
get_cdisc_keys
get_join_keys
First though is:
jk <- join_keys() # constructor
join_keys(jk) <- # setter
join_keys(jk) # getter
Above means that if join_keys
could be a getter, then ``get_join_keyscould be removed. Setting
join_keys` should be possible using:
join_keys(data)["dataset", "dataset"] <- character
join_keys(data) <- join_keys # set or replace whole keys object
cdisc_join_keys is just a wrapper around join_keys constructor - not possible to set nor get keys using this function. Most probably should have the same assertion for ...
as join_keys
cdisc_join_keys()
get_cdisc_keys()
could change - now it returns a list, but it could return JoinKeys. Unfortunately, get_cdisc_keys()
is used widely across all packages. We will need to make a relevant changes there also (teal.transform :()
get_cdisc_keys(c("ADSL", "ADTTE", ...)) # returns JoinKeys
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.
How about getting and setting keys on cdisc
data with join_keys
methods?
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.
How about getting and setting keys on cdisc data with join_keys methods?
Not sure what you mean.
The way I see setting of the JoinKeys
data <- teal_data()
data <- within(data, {
ADSL <- synthetic_cdisc_data("latest")$adsl
ADRS <- synthetic_cdisc_data("latest")$adrs
ADLB <- synthetic_cdisc_data("latest")$adlb
ADELO <- ADLB
})
join_keys(data) <- join_keys() # technically it's (and should be) a default in teal_data()
datanames <- c("ADSL", "ADRS", "ADLB", "ADELO")
join_keys(data) <- default_cdisc_keys(datanames) # should warn about missing keys for any of the datasets
join_keys(data)["ADELO"] <- get_cdisc_keys("ADLB")
join_keys(data)["ADELO", "ADSL"] <- c("STUDYID", "USUBJID")
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.
If cdisc_data
is dropped as a class, this is almost exactly what I meant.
Can we have one function to generate the keys? join_keys(..., cdisc = FALSE)
I may be missing something.
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.
I don't know. I'm thinking there should be cdisc_data
package with cdisc_join_keys
and cdisc_data
function maybe?
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.
WHAT IF JoinKeys
will be just a list with S3 class??
We could then drop many dependencies in other packages where JoinKeys are needed (teal.transform)
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.
Sounds nice 👍
Opened a new PR to implement simplified JoinKeys api |
Following introduction of teal_data class