-
Notifications
You must be signed in to change notification settings - Fork 29
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
left_join or mutate for new variables #199
Comments
To add to @tonggne comment it would also be good to see if you could add an external Example Below:
|
The implementation of the Currently I don't think there is an easy way around this issue without manually modifying the data in library(dplyr)
library(xpose)
# 1. Define the NONMEM problem to be changed
pb_no <- 1
# 2. Get the xpose example data
xpdb <- xpdb_ex_pk
# 3. Modify the xpdb "data"
## Note: this is only a dummy example by you could use your _join() here
xpdb$data$data[pb_no][[1]] <- xpdb %>%
get_data(.problem = pb_no) %>%
mutate(DV2 = DV * 2)
# 4. Declare the new column in the "index"
index_df <- xpdb$data$index[pb_no][[1]]
xpdb$data$index[pb_no][[1]] <- index_df %>%
slice(1) %>%
mutate(table = "external", col = "DV2", type = "na") %>%
bind_rows(index_df)
# 5. Ensure the xpdb class not broken by the changes above
xpdb <- as.xpdb(xpdb)
# 6. Check wether the new column is recognized by xpose
## Note in this case we asigned the type "na" and it works
list_vars(xpdb, .problem = pb_no)
# 7. Now we can now define DV2 as the new DV using standard xpose features
xpdb <- set_var_types(xpdb, dv = "DV2", .problem = pb_no)
# 8. We check that the new DV2 is now default
list_vars(xpdb, .problem = pb_no)
## 9. You can now use it in plots
dv_vs_ipred(xpdb) A word of warning though, with the |
Thanks Ben for the information. Looking forward to it!
Best,
Tong
…On Mon, Mar 14, 2022 at 1:39 PM Benjamin ***@***.***> wrote:
Hello,
The implementation of the xxx_join() family is on the todo list. I would
be something similar to what @ldbro0 <https://github.com/ldbro0> is
suggesting, although there are some subtleties I still need to figure out
(i.e., it is not as straight forward as it seems).
Best,
Ben
—
Reply to this email directly, view it on GitHub
<#199 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIDQ2EKT6OIGWWVLIN2EN7DU76PW3ANCNFSM5PVUOU4Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@guiastrennec thanks for the example, I'm curious if PR #153 is another approach? |
Hello Xpose developer, is there a way to bring new variables into xpose_data object? for example, I forgot including certain variable in the .tab output and would like to bring it from the .csv file using left_join or mutate.
Thanks a lot!
Tong
The text was updated successfully, but these errors were encountered: