How input special characters into kable table column names in R?

Viewed 23

I'm having a hard time figuring out how to add special characters (specifically a superscript and a mu) to my table column names in R using kable. (I am very new to R so apologies if this is a dumb question.) I've cruised through all of the recommended solutions to similar questions but have had no luck with standard superscript options like ^2~ or ^{2} etc. I have had similar issues with mu, as $\mu$ doesn't work, nor does the simpler \mu (which gives an error).

knitr::kable(
  rawCSVsn, "latex", booktabs = T,
  col.names = c('Treatment', 'Substrate', 'Surface Area (cm^2~)', 'Sample Number', 'Site', 'Depth (m)', 'Temperature (ºC)', 'Oxygen ( $\\mu$ mol)','Latitude (deg)', 'Longitude (deg)')
) %>% 
  kable_styling(latex_options = c("solid", "scale_down")) %>%
  save_kable("rawCSVsn.png")
0 Answers
Related