Search code examples
rdatasetroxygenpackage-development

How to put units inside roxygen


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


Solution

  • 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.