Quantcast
Channel: Active questions tagged header - Stack Overflow
Viewing all articles
Browse latest Browse all 649

How to add sectional variable header in gtsummary tbl_summary

$
0
0

I have a current table creating using the following code:

table1 <-   ptbl %>%  dplyr::select( pt_gender.factor, pt_race.factor, pt_ethnicity.factor, education.factor, employed.factor,marital.factor,                 home_smoker.factor,quit_support.factor,past7.factor) %>%  tbl_summary(    label = list(pt_gender.factor ~ "Gender",                 pt_race.factor ~ "Race",                 pt_ethnicity.factor ~ "Ethnicity",                 education.factor ~ "Education",                 employed.factor ~ "Employed",                 marital.factor ~ "Marital Status",                 home_smoker.factor ~ "Live with smoker",                 quit_support.factor ~ "People around are very supportive of quitting smoking",                 past7.factor ~ "In the past 7 days, did you smoke a cigarette (even a puff)?")) 

I am trying to add two sectional titles to my table, one is "Demographics", and the other one is "Smoking Habit".

I want my table like

DemographicsGender....Race...Ethnicity......

Smoking HabitLive with smoker...People around are very supportive of quitting smoking.....enter image description here

Is there a function to do it?


Viewing all articles
Browse latest Browse all 649

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>