您可以随时调用系统命令,例如使用以下system2
函数:
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"
## ...
Run Code Online (Sandbox Code Playgroud)
确保 R 在系统的搜索路径中。如果没有,请将上面的第一个参数替换system2()
为完整路径,例如C:\Program Files\R\3.1\bin\R.exe
。