How do I convert Rd files to pdf for a package that I am creating in R?

前端 未结 4 597
悲&欢浪女
悲&欢浪女 2020-12-25 08:29

I am writing a package in R and I would appreciate some example bash code to process the Rd files to latex and then to pdf.

It is in the directory ~/mypkg/dev/. I h

4条回答
  •  既然无缘
    2020-12-25 09:13

    I have created a basic bash function, so I can just run rdoc from my command line. It generates the Rd files, creates the pdf, and opens it. I only use it for testing, not for creating the final documentation. You can add it by adding the following function to your .bashrc (or whichever you use) file

    rdoc() {
      echo -e "devtools::document()" | R --no-save
      rm /tmp/rdoc.pdf
      R CMD Rd2pdf -o /tmp/rdoc.pdf man/*.Rd
      open /tmp/rdoc.pdf
    }
    

提交回复
热议问题