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

Documentation: derive_locf_records lose LOCF records. only 12 records there without any LOCF action #2461

Open
WangLaoK opened this issue Jun 7, 2024 · 13 comments · May be fixed by #2475
Open
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@WangLaoK
Copy link

WangLaoK commented Jun 7, 2024

Please select a category the issue is focused on?

Function Documentation

Let us know where something needs a refresh or put your idea here!

#> # A tibble: 22 × 8
#> STUDYID USUBJID PARAMCD PARAMN AVAL AVISITN AVISIT DTYPE
#>
#> 1 CDISC01 01-701-1015 DIABP 2 51 0 BASELINE NA
#> 2 CDISC01 01-701-1015 DIABP 2 50 2 WEEK 2 NA
#> 3 CDISC01 01-701-1015 DIABP 2 51 4 WEEK 4 NA
#> 4 CDISC01 01-701-1015 DIABP 2 50 6 WEEK 6 NA
#> 5 CDISC01 01-701-1015 PULSE 1 61 0 BASELINE NA
#> 6 CDISC01 01-701-1015 PULSE 1 60 6 WEEK 6 NA
#> 7 CDISC01 01-701-1015 SYSBP 3 121 0 BASELINE NA
#> 8 CDISC01 01-701-1015 SYSBP 3 121 2 WEEK 2 NA
#> 9 CDISC01 01-701-1015 SYSBP 3 121 4 WEEK 4 NA
#> 10 CDISC01 01-701-1015 SYSBP 3 121 6 WEEK 6 NA
#> # ℹ 12 more rows

Should have 12 more rows below, then user can see the LCOF creation there.

@WangLaoK WangLaoK added the documentation Improvements or additions to documentation label Jun 7, 2024
@bms63
Copy link
Collaborator

bms63 commented Jun 7, 2024

Thank you @WangLaoK for the feedback!

@pharmaverse/admiral is there a way to display more of the rows in the examples?

@manciniedoardo
Copy link
Collaborator

manciniedoardo commented Jun 10, 2024

Thank you @WangLaoK for the feedback!

@pharmaverse/admiral is there a way to display more of the rows in the examples?

Would print(dataset, n = 30) or similar work?

@WangLaoK
Copy link
Author

Thank you @WangLaoK for the feedback!
@pharmaverse/admiral is there a way to display more of the rows in the examples?

Would print(dataset, n = 30) or similar work?

Not sure if we can put LOCF record in the first 12 rows. please check the example in this link. https://pharmaverse.github.io/admiral/reference/derive_locf_records.html

@manciniedoardo
Copy link
Collaborator

Thank you @WangLaoK for the feedback!
@pharmaverse/admiral is there a way to display more of the rows in the examples?

Would print(dataset, n = 30) or similar work?

Not sure if we can put LOCF record in the first 12 rows. please check the example in this link. https://pharmaverse.github.io/admiral/reference/derive_locf_records.html

{admiral} doesn't sort the output datasets usually. Maybe in the example we would need to combine print(dataset, n = 30) with a call to dplyr::arrange() to make the order more intutive.

@bundfussr
Copy link
Collaborator

I would change the subject ids such that the second subject is displayed first and sort the output dataset by USUBJID, PARAMCD, and AVISITN.

@manciniedoardo
Copy link
Collaborator

Hi @WangLaoK how come you closed this issue? I don't think we actioned it yet. I'm reopening it for now.

@WangLaoK
Copy link
Author

Hi @WangLaoK how come you closed this issue? I don't think we actioned it yet. I'm reopening it for now.

Hi @manciniedoardo , sorry for the actions. I thought this query had been aware and solved from a new release.

I will not close issues next time. hope this is fine for you,.

Regards,
Hans

jimrothstein added a commit to jimrothstein/admiral that referenced this issue Jul 5, 2024
jimrothstein added a commit to jimrothstein/admiral that referenced this issue Jul 5, 2024
@jimrothstein
Copy link
Collaborator

@manciniedoardo … what do I need to do finish this? #2461. Thx (also reading a lot re: pharmaverse)

@bms63 bms63 linked a pull request Jul 17, 2024 that will close this issue
15 tasks
@manciniedoardo
Copy link
Collaborator

@manciniedoardo … what do I need to do finish this? #2461. Thx (also reading a lot re: pharmaverse)

Will review, thanks for the reminder.

@jimrothstein
Copy link
Collaborator

I think now done. And it is better than mine! Still learning

@manciniedoardo

@jimrothstein
Copy link
Collaborator

jimrothstein commented Jul 23, 2024

@manciniedoardo

Before I push again to #2475, I want to check this is right path: (intermediate variable X will NOT be in push)

Now:

As written, the example code must display all records to see LOCF populated in the DTYPE field.
This might be a simple fix: (variable X is NOT appear in the push)

#' X= derive_locf_records(
#'   dataset = advs,
#'   dataset_ref = advs_expected_obsv,
#'   by_vars = exprs(STUDYID, USUBJID, PARAMCD),
#'   order = exprs(AVISITN, AVISIT),
#'   keep_vars = exprs(PARAMN)
#' )
#' X |> print(n=30)

Proposed

However, If I understand bundfussr's ... suggestion correctly, better to display USUBJID column first, followed by PARAMCD, AVISIT.

But this still requires printing all rows to see LOCF*, as follows:
Proposed code (X will NOT appear in the push)

#' X |> relocate(USUBJID) |> arrange(USUBJID, PARAMCD, AVISIT) |> print(n=30)


#' X= derive_locf_records(
#'   dataset = advs,
#'   dataset_ref = advs_expected_obsv,
#'   by_vars = exprs(STUDYID, USUBJID, PARAMCD),
#'   order = exprs(AVISITN, AVISIT),
#'   keep_vars = exprs(PARAMN)
#' )
#'  #### X |> print(n=30)
#' X |> relocate(USUBJID) |> arrange(USUBJID, PARAMCD, AVISIT) |> print(n=30)

output from proposed solution

# A tibble: 22 × 8
   USUBJID     STUDYID PARAMCD PARAMN  AVAL AVISITN AVISIT   DTYPE
   <chr>       <chr>   <chr>    <dbl> <dbl>   <dbl> <chr>    <chr>
 1 01-701-1015 CDISC01 DIABP        2    51       0 BASELINE NA   
 2 01-701-1015 CDISC01 DIABP        2    50       2 WEEK 2   NA   
 3 01-701-1015 CDISC01 DIABP        2    51       4 WEEK 4   NA   
 4 01-701-1015 CDISC01 DIABP        2    50       6 WEEK 6   NA   
 5 01-701-1015 CDISC01 PULSE        1    61       0 BASELINE NA   
 6 01-701-1015 CDISC01 PULSE        1    60       6 WEEK 6   NA   
 7 01-701-1015 CDISC01 SYSBP        3   121       0 BASELINE NA   
 8 01-701-1015 CDISC01 SYSBP        3   121       2 WEEK 2   NA   
 9 01-701-1015 CDISC01 SYSBP        3   121       4 WEEK 4   NA   
10 01-701-1015 CDISC01 SYSBP        3   121       6 WEEK 6   NA   
11 01-701-1028 CDISC01 DIABP        2    79       0 BASELINE NA   
12 01-701-1028 CDISC01 DIABP        2    80       2 WEEK 2   NA   
13 01-701-1028 CDISC01 DIABP        2    80       4 WEEK 4   LOCF 
14 01-701-1028 CDISC01 DIABP        2    NA       4 WEEK 4   NA   
15 01-701-1028 CDISC01 DIABP        2    80       6 WEEK 6   LOCF 
16 01-701-1028 CDISC01 DIABP        2    NA       6 WEEK 6   NA   
17 01-701-1028 CDISC01 PULSE        1    65       0 BASELINE NA   
18 01-701-1028 CDISC01 PULSE        1    65       6 WEEK 6   LOCF 
19 01-701-1028 CDISC01 SYSBP        3   130       0 BASELINE NA   
20 01-701-1028 CDISC01 SYSBP        3   132       2 WEEK 2   NA   
21 01-701-1028 CDISC01 SYSBP        3   132       4 WEEK 4   LOCF 
22 01-701-1028 CDISC01 SYSBP        3   132       6 WEEK 6   LOCF 

@manciniedoardo
Copy link
Collaborator

@jimrothstein the arrange call looks right, but I think no need to use relocate(). What @bundfussr meant was to literally switch the two USUBJIDs (01-701-1015 and 01-701-1028) around, as the LOCF records for the second one will display better.

Please feel free to make a PR and tag us for review - it's not a problem at all if then we request some changes, that's what the review is for!

@jimrothstein
Copy link
Collaborator

jimrothstein commented Jul 24, 2024

@jimrothstein the arrange call looks right, but I think no need to use relocate(). What @bundfussr meant was to literally switch the two USUBJIDs (01-701-1015 and 01-701-1028) around, as the LOCF records for the second one will display better.

@manciniedoardo This push sorts the missing LOCF near top; BUT does so with

desc(USUBJID)

I suspect you meant tinkering with the original adsv switching the USUBJID values.
Sorry to need so much hand-holding, but have no context and resort to guessing.

Unrelated, I hope

Could not build() , vignette errors with vists_periods.Rm and a png file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Development

Successfully merging a pull request may close this issue.

5 participants