TysonStanley / furniture

The furniture R package contains table1 for publication-ready simple and stratified descriptive statistics, tableC for publication-ready correlation matrixes, and other tables #rstats
49 stars 7 forks source link

possible to replicate this in furniture? #18

Closed ericpgreen closed 5 years ago

ericpgreen commented 5 years ago

I'm interested in trying to replicate something like this table.

Specifically:

TysonStanley commented 5 years ago

Yes, definitely.

library(furniture)
nhanes_2010 %>%
  group_by("Overweight" = overweight) %>%        # grouping variable
  table1("Age [Mean (SD)]" = age,                # list of variables with their corresponding labels
         "Health" = gen_health,
         "Sex" = gender,
         "Cancer" = cancer, 
         "Asthma" = asthma,
         test = TRUE,                            # test relationship between grouping variable and each row variable
         output = "latex2",
         type = "condense")                      # put things on same row

will produce that table.

ericpgreen commented 5 years ago

This is so good.

We're getting down to publication level pickiness here, but I'll ask anyway.

  1. Possible to center heading over grouping levels only when adding a total column?

Screenshot 2019-12-04 13 44 25

  1. Possible to go landscape?
TysonStanley commented 5 years ago

Thanks!

Ah man... That's a bug. It should be centered just above the grouping levels, not the total column. Give me a bit to see if I can fix that really quick.

Also, there aren't any built in arguments for landscape but it should work with the LaTeX landscape environment (e.g. using the landscape environment, printing the table and then closing the landscape environment).

TysonStanley commented 5 years ago

Should work now in the latest developmental version of furniture.

Screenshot 2019-12-04 12 28 04