metrumresearchgroup / pmtables

TeX tables for pharmacometrics.
https://metrumresearchgroup.github.io/pmt-book
11 stars 1 forks source link

st_notes behavior unclear #296

Closed andreashandel closed 2 years ago

andreashandel commented 2 years ago

From reading the help file for st_notes(), I got the impression that with the append = FALSE setting, a new note leads to removal of old one(s). That doesn't seem to be the case (pmtables 0.5.0). Here is a reprex to illustrate:

Expected behavior (by me): the notes text only shows up once. Actual behavior: Notes are appended so they show up 10 times.

dat <- ptdata() dat <- dat %>% mutate(AGE = as.numeric(AGE), ALB = as.numeric(ALB), WT = as.numeric(WT), ID = 1:nrow(dat)) ob <- dat %>% pmtables::pt_cont_long(cols = c("AGE","ALB","WT")) %>% st_new() for (n in 1:10) { tab <- ob %>% pmtables::st_notes("This is some additional informational text.", append = FALSE) %>% pmtables::stable() } pmtables::st_as_image(tab)

kylebaron commented 2 years ago

Hi @andreashandel -

I can point out the relevant sections of the documentation here.

The description tells you that notes can accumulate

The function can be called multiple times and can accumulate notes data in various ways.

This lets you know that notes are accumulated (in a list).

Looking at the documentation for the append argument

logical; if TRUE, then incoming notes are appended to the previous, single note in the notes list. When ... contains multiple notes, then the notes are pasted together first.

This lets you know that append means the incoming note gets concatenated to the previous note in that note list. Maybe using concatenate would make it clearer.

Kyle