benjaminrich / table1

78 stars 26 forks source link

table1 align ignored #111

Open FelipeCarrillo opened 11 months ago

FelipeCarrillo commented 11 months ago

I am trying to align a 'table1' to the center but the align = 'center' is being ignored. I changed the output from 'text' to 'latex' or 'markdown' as described on the function but it still doesn't work. Consider the example below from here: https://cran.r-project.org/web/packages/table1/vignettes/table1-examples.html

library(boot) 

melanoma2 <- melanoma

# Factor the basic variables that
# we're interested in
melanoma2$status <- 
  factor(melanoma2$status, 
         levels=c(2,1,3),
         labels=c("Alive", # Reference
                  "Melanoma death", 
                  "Non-melanoma death"))
As a first attempt, we can do the following:

table1(~ factor(sex) + age + factor(ulcer) + thickness | status, output = 'markdown', align = 'center, data=melanoma2)
SmartChen96 commented 8 months ago

Hello Benjaminrich,

I have a similar issue related to formatting alignment. I'm wondering if it's possible to have all descriptive statistics align either left or right, except for the first variable column. When I checked the original R codes, I found that the alignment is set to center, and there doesn't appear to be a parameter to control the alignment.

Thank you for your assistance.