On 04/08/2010 12:44 PM, Michael Lachmann wrote:> I'm trying to get help to print the help pages in html format to the
> terminal. This is in order to be able to see the html help files remotely.
>
> If I do
> printURL = function(file)
{a=readLines(url(file));cat(a,sep="\n")}
> options(browser=printURL)
> options(help_type="html")
>
> then invoking help with
> ?print
>
> gets stuck. I think what happens is that the web server run by R that
allows
> one to read help will not work as long as R is waiting for the function to
> complete. Thus, if I run a second R session, and try to read the help files
> that one session produces from the other, I have no problems.
>
> I also tried
> options(browser="wget -O- ")
>
> But again, while R is waiting for the command to complete, the web server
is
> dead.
>
> Is there a better way to accomplish this?
>
>
What you're doing should work, and it works for me in 2.11.1 in
Windows. Not sure why it doesn't work for you.
A more direct way to get the HTML output for a help file is to use the
internal utilities that R uses. You get the help page using
page <- utils:::.getHelpFile(?print)
(remember to keep that question mark!), and use
tools::Rd2HTML(page)
to turn it into HTML.
Duncan Murdoch