Check-in [d74de910cb]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add some notes, comment out code that pseudocode/example code. 'yat' will now become 'yatd' or similar
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | version-0.0.4 | trunk
Files: files | file ages | folders
SHA3-256: d74de910cbb699480db3a4419e04aba7198fdab3eb965ae44252b0a325dcab42
User & Date: weigand 2025-07-30 02:34:30.127
Context
2025-07-31
18:54
More WIP check-in: 0046b0a6d4 user: weigand tags: trunk
2025-07-30
02:34
Add some notes, comment out code that pseudocode/example code. 'yat' will now become 'yatd' or similar check-in: d74de910cb user: weigand tags: version-0.0.4, trunk
2024-10-01
21:50
Changes from ~2022 check-in: 198c17bc14 user: weigand tags: trunk, version-0.0.3
Changes
Unified Diff Ignore Whitespace Patch
Changes to README.md.
98
99
100
101
102
103
104
























header = c(tr(th("Name", rowspan = 2),
              th("ID", rowspan = 2),
			  th("Membership", colspan = 2),
			  th("Balance", rowspan = 2)),
		   tr(th("Joined"),
		      th("Cancelled")))
```































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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.
Changes to yat/DESCRIPTION.
1
2
3
4
5
6
7
8
9
10
11
12
Package: yat
Type: Package
Title: Yet Another Way To Create A Summary Table
Version: 0.0.3
Date: 2022-04-27
Authors@R: person(given = "Stephen", family = "Weigand", role = c("aut", "cre"),
                  email = "Weigand.Stephen@mayo.edu")
Maintainer: Stephen Weigand <Weigand.Stephen@mayo.edu>
Description:  Create a table of summary statistics using a formula interface.
  The left hand side of the formula specifies one or more grouping variables
  and the right hand side consists of summary functions (e.g., mean, median, etc.)
  of variables to summarize.



|
|







1
2
3
4
5
6
7
8
9
10
11
12
Package: yat
Type: Package
Title: Yet Another Way To Create A Summary Table
Version: 0.0.4
Date: 2025-07-29
Authors@R: person(given = "Stephen", family = "Weigand", role = c("aut", "cre"),
                  email = "Weigand.Stephen@mayo.edu")
Maintainer: Stephen Weigand <Weigand.Stephen@mayo.edu>
Description:  Create a table of summary statistics using a formula interface.
  The left hand side of the formula specifies one or more grouping variables
  and the right hand side consists of summary functions (e.g., mean, median, etc.)
  of variables to summarize.
Changes to yat/R/yhead.R.
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
##   </tr>
##   <tr>
##     <th>Joined</th>
##     <th>Canceled</th>
##   </tr>


yah(~  (`Study {\b A} (n=%d)`  | ... | ... | ... | ... ) / # '.' means empty, '...' means merge with previous
        ( .   | .  | `Membership dates` | ... | .) /
        ( Name| ID | Joined | Cancelled | Balance))

## We now have a matrix of content with some cell-contents formatting
## but no alignment information. How does this thing turn into to
## table rows for RTF or HTML?

## How do we get `Group 1 (n=?)` without having to specify 'n'?
## Maybe a literal question mark and that will get filled in? Or
## what about a %d using sprintf formatting?



## This header:
##
## | Characteristic | Group 1 | Group 2 | P-value |
##
## Can be generated with any of these:

Characteristic ~ `Group 1` + `Group 2` + `P-value`
~ Characteristic + `Group 1` + `Group 2` + `P-value`
Characteristic ~ (`Group 1` | `Group 2` | `P-value`)
Characteristic ~ `Group 1` | `Group 2` | `P-value`


yah <- function(formula) {
    formula <- check.formula(formula, two.sided = FALSE)
    char <- as.character(formula)
    ## Split on '/' so long as it's not '//' which is how to
    ## escape the slash. So if the header were







|
|
|

















|
|
|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
##   </tr>
##   <tr>
##     <th>Joined</th>
##     <th>Canceled</th>
##   </tr>


## yah(~  (`Study {\b A} (n=%d)`  | ... | ... | ... | ... ) / # '.' means empty, '...' means merge with previous
##         ( .   | .  | `Membership dates` | ... | .) /
##         ( Name| ID | Joined | Cancelled | Balance))

## We now have a matrix of content with some cell-contents formatting
## but no alignment information. How does this thing turn into to
## table rows for RTF or HTML?

## How do we get `Group 1 (n=?)` without having to specify 'n'?
## Maybe a literal question mark and that will get filled in? Or
## what about a %d using sprintf formatting?



## This header:
##
## | Characteristic | Group 1 | Group 2 | P-value |
##
## Can be generated with any of these:

## Characteristic ~ `Group 1` + `Group 2` + `P-value`
## ~ Characteristic + `Group 1` + `Group 2` + `P-value`
## Characteristic ~ (`Group 1` | `Group 2` | `P-value`)
## Characteristic ~ `Group 1` | `Group 2` | `P-value`


yah <- function(formula) {
    formula <- check.formula(formula, two.sided = FALSE)
    char <- as.character(formula)
    ## Split on '/' so long as it's not '//' which is how to
    ## escape the slash. So if the header were
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
    cells <- unlist(cells)
    cells <- sub("^ ?`(.*)` ?", "\\1", cells) # clear back ticks
    cells <- trimws(cells) # clear white space
    matrix(cells, byrow = TRUE, nrow = length(rows))
}


yah(~ (`A (n=5)` | ... | ...)/(D |.| F)/(G | H | I))


yah(~ `A (n=5)` | `B (n=165)`)



## Could be a problem if there is a '/' in a cell
strsplit(as.character(~ `A\\/B` / C / D)[2], "/", fixed = TRUE)

    (Name      | ID | `Membership Dates` | Balance)

header <- list(~ h(`Study 1`, 1, 5), 
               h(Name, 2, 0) ~
                   h(ID, 2, 0) +
                   h(`Membership Dates`, 1, 2) +
                   h(Balance, 2, 0),
               ~ h(Joined) + h(Cancelled))

header <- list(~ `Study 1`:1:5)








|


|




|

|

|
|
|
|
|
|

|

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
    cells <- unlist(cells)
    cells <- sub("^ ?`(.*)` ?", "\\1", cells) # clear back ticks
    cells <- trimws(cells) # clear white space
    matrix(cells, byrow = TRUE, nrow = length(rows))
}


## yah(~ (`A (n=5)` | ... | ...)/(D |.| F)/(G | H | I))


## yah(~ `A (n=5)` | `B (n=165)`)



## Could be a problem if there is a '/' in a cell
## strsplit(as.character(~ `A\\/B` / C / D)[2], "/", fixed = TRUE)

##     (Name      | ID | `Membership Dates` | Balance)

## header <- list(~ h(`Study 1`, 1, 5), 
##                h(Name, 2, 0) ~
##                    h(ID, 2, 0) +
##                    h(`Membership Dates`, 1, 2) +
##                    h(Balance, 2, 0),
##                ~ h(Joined) + h(Cancelled))

## header <- list(~ `Study 1`:1:5)