I have a dataframe that contains units using the units package. Unfortunately, I really need the units for reporting. I'm assuming that's because the data is in a class units and xtable doesn't know what to do with this.
The following is a MWE: library(xtable) library(units) data <- data.frame(x=c(as_units(12,"ft"))) xtable(data) % latex table generated in R 3.5.1 by xtable 1.8-2 package % Wed Jul 18 17:31:44 2018 \begin{table}[ht] \centering \begin{tabular}{rr} \hline & x \\ \hline 1 & 12.00 \\ \hline \end{tabular} \end{table} What I'm looking for is the line 1 & 12.00 \\ to be 1 & 12.00 $ft$\\ Can someone point me in the correct direction to make this happen? Since units are used extensively in engineering calculations, being able to handle this class would be extremely beneficial to engineers that are using R with knitr to generate engineering documents. Shawn Way ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.