benjaminrich / table1

79 stars 26 forks source link

How do I remove the N=3 below the “stratification” variable? #83

Closed crazyxiaoj closed 2 years ago

crazyxiaoj commented 2 years ago

Dear developer of table1 package,

If you have time, could you look at this for me? Is there any way to remove the items in the red box?

image

benjaminrich commented 2 years ago

You can do so by using the following render.strat function:

render.strat <- function(label, ...) {
    sprintf("<span class='stratlabel'>%s</span>", label)
}

Here is an example:

library(table1)

set.seed(123)

n <- 12

dat <- data.frame(
    a = rlnorm(n, 1, 1),
    b = rlnorm(n, 1, 1),
    c = rlnorm(n, 1, 1),
    d = rep(LETTERS[1:4], each=3)
)

table1(~ a + b + c | d, data=dat, transpose=T, overall=F,
    render="Mean &pm; SD", render.strat=render.strat)

image

crazyxiaoj commented 2 years ago

It's works! Thank you for your help!