Files in the top-level directory in any check-in
- pkg
- yat
- Makefile
- notes.org
- notes.txt
- README.md
Design notes
These are some names I played with:
aod :: arangment of data
yat :: yet another table
drc :: data in rows and columns
rcd :: rows and columns data
mft :: my friend's table
mftf :: my friend's table functions
rcd :: rows and columns data
tbl :: table
tay :: tables
able :: a short table
tapi :: table API
apit :: API for tables
yast :: yet another summary table
yadt :: yet another descriptive table
yalmt :: yet another lm table
yalmert :: yet another lmer table
dst :: descriptive statistics table
But then I realized there can't be one function
to do everything. For example, the code to generate
a table of descriptive statistics would be quite
different from the code to extract coef(summary(fit))
and put it into a table.
So this is what I have
tods
ortoss
is a function to create a table of descriptive statisicstolm
creates a table from anlm
model- etc.
Table of summary statistics
The formula interface would look like this:
toss(margin(group) + group + p(group) ~
mediqr(age) +
npc(sex),
data = dat)
The functions mediqr
(for median and IQR) and npc
(for number and
percent) are functions that calculate the desired summaries. These
could take up multiple rows in the table like this:
Total | Group A | Group B | P-value | |
---|---|---|---|---|
Age, median (IQR) | ||||
Sex, n (%) | ||||
<tab>Men | ||||
<tab>Women |
There can be some formating in functions like mediqr
with
the first argument being something like didits
.
mediqr
This function and others like it have a fmt
argument that is similar
in spirit to the (first) fmt
argument of sprintf
.
mediqr(age, fmt = "%f (%f, %f)")
The fmt
string could be extended to encode stying
issues like alignment and border.
I guess these summary functions can return an object of
descriptive_statistic
(or shorter name) and since the object has an
fmt
element the print method can look at this element?
Table headers and caption
I can imagine something like this:
tods(group ~ mediqr(age, th = "Age, years"),
data = dat,
caption = "Summary table",
header = ???
I don't know good syntax for the column headers. In HTML5 these
are <tr>
tags with a scope (I think).
What about this:
header = c(tr(th("Name", rowspan = 2),
th("ID", rowspan = 2),
th("Membership", colspan = 2),
th("Balance", rowspan = 2)),
tr(th("Joined"),
th("Cancelled")))
Revisiting the package notes (July 27, 2025)
I forgot that yat
is already useful. It creates a data frame
of summary statistics. If yat
is for the descriptives
should there be something like yatlm
or should yat
be yatd
(yet another table of descriptives).
The package can be yatp
for "yet another table package".
Or should it be yat1
for yat another table 1.
?
Formatting
Currently the data frame holding the table content has formatted values and the underlying values are lost. Is this OK? I am tempted to try to retain the numerical summary statistics but that is probably more overhead than I need. I could see how far I can go with the formatted values. (I could have a function output the raw values but a value like "3.8 (1.7)" would have two raw values. Is that a list?
If I have toOrg(yatd(...))
then toOrg
can sort out whether
I have formatted cells or raw values. This tells me that the
basic use would be to store formatted values in the cells.