3.12 nestTable

This function combines two columns into a single column with headers from one column and other values from the second columns

Optional Arguments:

  • indent logical indicating if the to_col values should be indented
  • boldheaders logical indicating if the head_col values should be in bold
  • to_bold row indices specifying which rows to bold
  • caption a caption to print above the table.
  • hdr_prefix optional string to prepend to headers
  • hdr_suffix optional string to append to headers
twoIDcolumns <- data.frame(
  Site = rep(c('A','B'),each=5),
  ID = 1:10,
  Height_cm = round(rnorm(10,190,10)),
  Weight_kg = round(rnorm(10,80,3))
)

nestTable(data=twoIDcolumns,
              head_col = 'Site',to_col = 'ID',hdr_prefix='Site ')
ID Height_cm Weight_kg
Site A
1 195 82
2 201 79
3 166 80
4 192 79
5 177 77
Site B
6 197 74
7 189 88
8 196 77
9 190 88
10 194 80