Re: [R] printing html help to the terminal
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 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] printing html help to the terminal
I just tried it under OSX and linux, and both get stuck. Maybe R on windows forks the R help server? But what you suggested works perfectly. Thanks! Do you by chance know if there was something equivalent in R 2.10.x and/or 2.9.x Duncan Murdoch-2 wrote: 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 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://r.789695.n4.nabble.com/printing-html-help-to-the-terminal-tp2313801p2313983.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] printing html help to the terminal
On 04/08/2010 2:40 PM, Michael Lachmann wrote: I just tried it under OSX and linux, and both get stuck. Maybe R on windows forks the R help server? It doesn't fork, but it might run in another thread. But what you suggested works perfectly. Thanks! Do you by chance know if there was something equivalent in R 2.10.x and/or 2.9.x I believe similar code will work in 2.10.x, which was when the new help system was introduced. The .getHelpFile function isn't there, but I believe if you just copy it from 2.11.1 into 2.10.x, it will work. In 2.9.x you actually have copies of the HTML files on disk. You can probably play with unclass(?topic) to construct the path to one. (I'm on a relatively new machine here, with nothing older than 2.10.1 installed.) Duncan Murdoch Duncan Murdoch-2 wrote: 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 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.