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

Fix footnote issue in prepare_ae_specific() #4

Closed
nanxstats opened this issue May 9, 2022 · 2 comments
Closed

Fix footnote issue in prepare_ae_specific() #4

nanxstats opened this issue May 9, 2022 · 2 comments
Assignees

Comments

@nanxstats
Copy link
Collaborator

nanxstats commented May 9, 2022

I tentatively fixed the R CMD check issue in prepare_ae_specific() by wrapping the rtf_encode() call inside a try() call.

Although the RTF output looks ok, the root cause is not fixed. I suspect this is related to how r2rtf handles vector inputs (specifically, footnotes), perhaps relevant to Merck/r2rtf#88. Therefore, this might need a proper fix from upstream.

To reproduce the issue:

library(metalite.ae)

meta <- meta_ae_dummy()

outdata <- meta |>
  prepare_ae_specific(
    population = "apat",
    observation = "wk12",
    parameter = "rel"
  ) |>
  format_ae_specific() |> tlf_ae_specific(
    footnotes = c("Footnote 1", "Footnote 2"),
    source = "Source:  [CDISCpilot: adam-adsl; adae]",
    medra_version = "24.0",
    path_outdata = "zzz.rda",
    path_outtable = "zzz.rtf"
  )
Warning messages:
1: In matrix(text_rtf, nrow = nrow(text), ncol = ncol(text)) :
  data length differs from size of matrix: [2 != 1 x 1]
2: In matrix(text_rtf, nrow = nrow(text), ncol = ncol(text)) :
  data length differs from size of matrix: [2 != 1 x 1]
3: In matrix(text_rtf, nrow = nrow(text), ncol = ncol(text)) :
  data length differs from size of matrix: [2 != 1 x 1]
4: In matrix(text_rtf, nrow = nrow(text), ncol = ncol(text)) :
  data length differs from size of matrix: [2 != 1 x 1]

The warning can be located to the footnote handling lines. The call chain is:

tlf_ae_specific -> rtf_output ->
rtf_encode -> rtf_encode_table -> as_rtf_footnote -> rtf_table_content -> rtf_text -> matrix

To reproduce this locally, one will need to use R CMD check --as-cran which takes warnings generated by code examples and vignettes seriously.

FYI @wangben718 @LittleBeannie

@elong0527
Copy link
Collaborator

Wow, the issue seems more complicated than I thought. I will check from my end.

@nanxstats
Copy link
Collaborator Author

I'm closing this as it is now fixed by r2rtf v0.3.5 + ccff57b + ccbca87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants