Steve
Steve

Reputation: 45

Invoking the R help(...) command from a dos terminal

I want to invoke R-help from the dos terminal. My attempts include:

R.exe -e "help(matrix)"

Rscript.exe -e "help(matrix)"

etc.

The results are all the same, explorer opens but does not find the file. The dos terminal shows no error, only:

> help('matrix')
starting httpd help server ... done

However, with Rgui, the help(matrix) commands works fine, which lends me to believe that the httpd help server is failing. Any ideas?

Upvotes: 2

Views: 326

Answers (1)

David Heffernan
David Heffernan

Reputation: 612814

The problem is that the R process that runs the httpd server terminates before it has a chance to serve up the content.

You'd need to find a way to keep the R process alive until it had served what you need, or run the R httpd server in service/daemon mode, if that is in fact possible.

For example, the following will keep the R process alive a little longer so that it can finish handling the http request:

R.exe -e "help(matrix); Sys.sleep(2)"

I can't find an abvious way to get the R httpd server running as a service/daemon, but I'm not really an expert. Perhaps someone else will know how to do it.

Upvotes: 3

Related Questions