title: Designing a table in R
body: <p>I would like to design a table in R. Below the format that I aim for. Besides the <a href="https://cran.r-project.org/web/packages/expss/vignettes/tables-with-labels.html" rel="nofollow noreferrer">expss</a> library is there a nicer way to do this?</p>
  <p><a href="https://i.stack.imgur.com/uWmew.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uWmew.png" alt="enter image description here" /></a></p>
  <p>Sample data used to create the table:</p>
  <pre><code> df&lt;-structure(list(X1 = c(NA, NA, NA, &quot;At least 35 hours of paid work&quot;, 
      NA, NA, NA, NA, &quot;More than 35 hours of paid work&quot;, NA, NA, NA, 
      NA, NA, NA, NA), X2 = c(NA, NA, NA, &quot;Most common start time&lt;ff&gt;&quot;, 
      NA, NA, &quot;Most common duration (at most common start time)&quot;, &quot;Mean Duration across the whole period&quot;, 
      &quot;Most common start time&lt;ff&gt;&quot;, &quot;Most common duration (at most common start time)&quot;, 
      &quot;Mean Duration across the whole period&quot;, NA, NA, NA, NA, NA), 
          `Main job` = c(&quot;04:00&quot;, &quot;?&quot;, &quot;07:50&quot;, &quot;07:00&quot;, NA, NA, &quot;120&quot;, 
          &quot;00:43:06&quot;, &quot;07:00&quot;, &quot;180; 360&quot;, &quot;00:52:25&quot;, NA, NA, NA, 
          NA, NA), X4 = c(&quot;08:00&quot;, &quot;?&quot;, &quot;11:50&quot;, &quot;09:00&quot;, NA, NA, &quot;240&quot;, 
          &quot;00:58:42&quot;, &quot;09:00&quot;, &quot;240&quot;, &quot;00:57:04&quot;, NA, NA, NA, NA, NA
          ), X5 = c(&quot;12:00&quot;, &quot;?&quot;, &quot;15:50&quot;, &quot;13:00&quot;, NA, NA, &quot;120&quot;, 
          &quot;00:55:03&quot;, &quot;13:00&quot;, &quot;120&quot;, &quot;01:00:55&quot;, NA, NA, NA, NA, NA
          ), X6 = c(&quot;16:00&quot;, &quot;?&quot;, &quot;19:50&quot;, &quot;16:00&quot;, NA, NA, &quot;60&quot;, &quot;00:46:30&quot;, 
          &quot;16:00&quot;, &quot;120&quot;, &quot;00:36:01&quot;, NA, NA, NA, NA, NA), X7 = c(&quot;20:00&quot;, 
          &quot;?&quot;, &quot;23:50&quot;, &quot;22:00&quot;, NA, NA, &quot;180&quot;, &quot;00:23:30&quot;, &quot;21:00&quot;, 
          &quot;40&quot;, &quot;00:26:36&quot;, NA, NA, NA, NA, NA), X8 = c(&quot;00:00&quot;, &quot;?&quot;, 
          &quot;03:50&quot;, &quot;01:00;01:40; 02:30;02:40;03:00:00&quot;, NA, NA, &quot;180 (at 01:00)&quot;, 
          &quot;00:14:30&quot;, &quot;01:00&quot;, &quot;180; 60&quot;, &quot;00:12:36&quot;, NA, NA, NA, NA, 
          NA), Sleep = c(&quot;04:00&quot;, &quot;?&quot;, &quot;07:50&quot;, &quot;04:00&quot;, NA, NA, &quot;190&quot;, 
          &quot;00:30:05&quot;, &quot;05:10&quot;, &quot;50; 110&quot;, &quot;00:49:01&quot;, NA, NA, NA, NA, 
          NA), X10 = c(&quot;08:00&quot;, &quot;?&quot;, &quot;11:50&quot;, &quot;10:00&quot;, NA, NA, &quot;180&quot;, 
          &quot;00:27:22&quot;, &quot;10:00&quot;, &quot;180; 360&quot;, &quot;00:54:35&quot;, NA, NA, NA, 
          NA, NA), X11 = c(&quot;12:00&quot;, &quot;?&quot;, &quot;15:50&quot;, &quot;14:00&quot;, NA, NA, 
          &quot;120&quot;, &quot;00:22:26&quot;, &quot;15:00&quot;, &quot;120&quot;, &quot;00:17:15&quot;, NA, NA, NA, 
          NA, NA), X12 = c(&quot;16:00&quot;, &quot;?&quot;, &quot;19:50&quot;, &quot;16:00&quot;, NA, NA, 
          &quot;90&quot;, &quot;00:11:52&quot;, &quot;18:00&quot;, &quot;60&quot;, &quot;00:16:22&quot;, NA, NA, NA, 
          NA, NA), X13 = c(&quot;20:00&quot;, &quot;?&quot;, &quot;23:50&quot;, &quot;22:00&quot;, NA, NA, 
          &quot;360&quot;, &quot;00:48:39&quot;, &quot;22:00&quot;, &quot;360&quot;, &quot;00:44:32&quot;, NA, NA, NA, 
          NA, NA), X14 = c(&quot;00:00&quot;, &quot;?&quot;, &quot;03:50&quot;, &quot;01:00&quot;, NA, NA, 
          &quot;180&quot;, &quot;00:19:16&quot;, &quot;01:00&quot;, &quot;180&quot;, &quot;00:19:39&quot;, NA, NA, NA, 
          NA, NA), `TV and DVD` = c(&quot;04:00&quot;, &quot;?&quot;, &quot;07:50&quot;, &quot;07:50&quot;, 
          NA, NA, &quot;30&quot;, &quot;00:06:28&quot;, &quot;06:30&quot;, &quot;30&quot;, &quot;00:06:28&quot;, NA, 
          NA, NA, NA, NA), X16 = c(&quot;08:00&quot;, &quot;?&quot;, &quot;11:50&quot;, &quot;11:00&quot;, 
          NA, NA, &quot;50; 120&quot;, &quot;00:06:44&quot;, &quot;08:20&quot;, &quot;40&quot;, &quot;00:06:44&quot;, 
          NA, NA, NA, NA, NA), X17 = c(&quot;12:00&quot;, &quot;?&quot;, &quot;15:50&quot;, &quot;13:00&quot;, 
          NA, NA, &quot;120&quot;, &quot;00:09:40&quot;, &quot;15:50&quot;, &quot;70;80;90&quot;, &quot;00:09:40&quot;, 
          NA, NA, NA, NA, NA), X18 = c(&quot;16:00&quot;, &quot;?&quot;, &quot;19:50&quot;, &quot;19:00&quot;, 
          NA, NA, &quot;60&quot;, &quot;00:17:41&quot;, &quot;19:00&quot;, &quot;180&quot;, &quot;00:17:41&quot;, NA, 
          NA, NA, NA, NA), X19 = c(&quot;20:00&quot;, &quot;?&quot;, &quot;23:50&quot;, &quot;21:00&quot;, 
          NA, NA, &quot;60&quot;, &quot;00:10:46&quot;, &quot;20:00&quot;, &quot;120&quot;, &quot;00:10:46&quot;, NA, 
          NA, NA, NA, NA), X20 = c(&quot;00:00&quot;, &quot;?&quot;, &quot;03:50&quot;, &quot;00:10&quot;, 
          NA, NA, &quot;50&quot;, &quot;00:05:50&quot;, &quot;00:10&quot;, &quot;50&quot;, &quot;00:05:50&quot;, NA, 
          NA, NA, NA, NA)), class = c(&quot;spec_tbl_df&quot;, &quot;tbl_df&quot;, &quot;tbl&quot;, 
      &quot;data.frame&quot;), row.names = c(NA, -16L), spec = structure(list(
          cols = list(X1 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X2 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), `Main job` = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X4 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X5 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X6 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X7 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X8 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), Sleep = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X10 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X11 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X12 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X13 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X14 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), `TV and DVD` = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X16 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X17 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X18 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X19 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;)), X20 = structure(list(), class = c(&quot;collector_character&quot;, 
          &quot;collector&quot;))), default = structure(list(), class = c(&quot;collector_guess&quot;, 
          &quot;collector&quot;)), skip = 1), class = &quot;col_spec&quot;))
  </code></pre>