How to put units inside roxygen

75 Views Asked by At

I am docummenting a dataset using roxygen2 (for my package development). I am trying to put cube meter (m^2) as a unit for one of my variable but it remains the same (m^2) when I am trying to see the documentation ?data. How can I generate units inside roxygen2?

Thank you

1

There are 1 best solutions below

1
Col Bates - collynomial On BEST ANSWER

You should use this line:

\ifelse{html}{\out{m<sup>2</sup>}}{\eqn{m^2}}   

You need to keep in mind that Roxygen is used to produce by HTML and PDF versions of your documentation. The first statement in the ifelse will be for the HTML, the second will be for PDF.