79802068

Date: 2025-10-27 16:52:10
Score: 0.5
Natty:
Report link

Hi @YabinDa and @cthulkukk, my suggestion, or rather workaround, is to apply regex.

Say you assign your table to object x. Then you can manipulate with regex-functions, such as str_replace_all(), the content of x. Employing your example, my suggestion would be as follows.

 x <- kable(summarize(df.sum, group = "Experiment", test = T, digits = 1, show.NAs = F),
             row.names = F, caption = 'Summary Statistics for Treated and Control Groups',
             booktabs = T) %>% kable_styling(latex_options = c('striped', 'hold_position')) %>%
  footnote(general = 'DM8OZ indicates the daily max 8-hour ozone concentration; 
Daily_PM2.5 is the daily average of PM2.5; Tavg is the daily average temperature; 
Prcp is the daily accumulated precipitation. The last column in the table represents the testing results of null 
hypotheses that the treated and control groups are not statistically different. ',
footnote_as_chunk = T, threeparttable = T, fixed_small_size = T)

y <- str_replace_all(x, fixed("\\textit{Note: } \n\\item"), fixed("\\textit{Note:}"))
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @YabinDa
  • User mentioned (0): @cthulkukk
  • Low reputation (1):
Posted by: R.P.