Converting .Rd file to plain text
Asked Answered
O

2

6

I'm trying to convert R documentation files (extension .Rd) into plain text. I am aware that RdUtils contains a tool called Rdconv, but as far as I know it can only be used from the command line. Is there a way to access Rdconv (or a similar conversion tool) from within an R session?

Overwrite answered 27/5, 2014 at 19:39 Comment(1)
Make a call to system?Upend
D
7

Try

tools::Rd2txt("path/to/file.Rd")
Delay answered 27/5, 2014 at 20:0 Comment(1)
See other export options on the ?tools::Rd2txt help pageGesso
C
2

You may always invoke a system command e.g. with the system2 function:

input <- '~/Projekty/stringi/man/stri_length.Rd'
output <- '/tmp/out.txt'
system2('R', paste('CMD Rdconv -t txt', filename, '-o', output))
readLines(output)
## [1] "Count the Number of Characters"
## ...

Make sure that R is in your system's search path. If not, replace the first argument of system2() above with full path, e.g. C:\Program Files\R\3.1\bin\R.exe.

Casimir answered 27/5, 2014 at 19:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.