Re: [Rd] library path in Rd link
On Thu, 15 Nov 2007, Adrian Dusa wrote: On Thursday 15 November 2007, Prof Brian Ripley wrote: [...] Using as above: \code{\link{anova}} the html help file directs to file:///home/adi/myRlibrary/stats/html/anova.html I hope it is actually ../../stats/html/anova.html and the browser is interpreting that as a full URL. instead of file:///usr/lib/R/library/stats/html/anova.html But at run time help.start() creates links into a subdirectory of tempdir(). As in help.start() I got it. Perhaps it would be useful to have another startup option, something like: options(htmlLinksResolve=TRUE) that one could use in the .First() function from .Rprofile You could have a function to run there, essentially (from help.start()) .Script(sh, help-links.sh, paste(tempdir(), paste(.libPaths(), collapse = ))) and perhaps (it is a lot slower) utils::make.packages.html() The problem is that even the first can be slow on a network-mounted file system with a lot of packages installed, do we don't want to do it by default. I tried using help.start() in .Rprofile, but it throws a (probably obvious) error: Error: could not find function help.start Duncan has answered that. For my personal purposes, all questions have been answered though. Thank you very much, Adrian -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] library path in Rd link
On Thu, 15 Nov 2007, Prof Brian Ripley wrote: On Thu, 15 Nov 2007, Adrian Dusa wrote: On Thursday 15 November 2007, Prof Brian Ripley wrote: [...] Using as above: \code{\link{anova}} the html help file directs to file:///home/adi/myRlibrary/stats/html/anova.html I hope it is actually ../../stats/html/anova.html and the browser is interpreting that as a full URL. instead of file:///usr/lib/R/library/stats/html/anova.html But at run time help.start() creates links into a subdirectory of tempdir(). As in help.start() I got it. Perhaps it would be useful to have another startup option, something like: options(htmlLinksResolve=TRUE) that one could use in the .First() function from .Rprofile You could have a function to run there, essentially (from help.start()) .Script(sh, help-links.sh, paste(tempdir(), paste(.libPaths(), collapse = ))) and perhaps (it is a lot slower) utils::make.packages.html() It transpires that currently you do need both: although the script is passed the library locations it does not make use of them, leaving the linking to make.packages.html. (That used not to be the case.) The problem is that even the first can be slow on a network-mounted file system with a lot of packages installed, do we don't want to do it by default. So speed is the problem: I am seeing about 4 secs on a system with 1450 packages on the local disc, and 33 secs on a slower system with a network-mounted FS. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] library path in Rd link
I think that's right -- it only works on NTFS systems. This page refers to it as an NTFS symbolic link: http://en.wikipedia.org/wiki/NTFS_symbolic_link On Nov 14, 2007 10:00 PM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 14/11/2007 7:44 PM, Gabor Grothendieck wrote: On Nov 14, 2007 4:36 PM, Duncan Murdoch [EMAIL PROTECTED] wrote: On Unix-alikes, the workaround is to build soft links to all the packages in a standard location; but soft links don't work on Windows (and we don't want to get into the almost-undocumented hard links that exist on some Windows file systems). Symbolic links are available on Windows Vista: Does this work on FAT file systems, e.g. on a USB drive? It used to be that they only worked on NTFS. Duncan Murdoch C:\ mklink /? Creates a symbolic link. MKLINK [[/D] | [/H] | [/J]] Link Target /D Creates a directory symbolic link. Default is a file symbolic link. /H Creates a hard link instead of a symbolic link. /J Creates a Directory Junction. Linkspecifies the new symbolic link name. Target specifies the path (relative or absolute) that the new link refers to. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] library path in Rd link
On Thursday 15 November 2007, Prof Brian Ripley wrote: [...] help.start() I got it. Perhaps it would be useful to have another startup option, something like: options(htmlLinksResolve=TRUE) that one could use in the .First() function from .Rprofile You could have a function to run there, essentially (from help.start()) .Script(sh, help-links.sh, paste(tempdir(), paste(.libPaths(), collapse = ))) and perhaps (it is a lot slower) utils::make.packages.html() It transpires that currently you do need both: although the script is passed the library locations it does not make use of them, leaving the linking to make.packages.html. (That used not to be the case.) The problem is that even the first can be slow on a network-mounted file system with a lot of packages installed, do we don't want to do it by default. So speed is the problem: I am seeing about 4 secs on a system with 1450 packages on the local disc, and 33 secs on a slower system with network-mounted FS. Completely understandable, it's not going to be automatic. Users who don't suffer from these restrictions could manually make use of the script. Thank you very much, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romania Tel./Fax: +40 21 3126618 \ +40 21 3120210 / int.101 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] library path in Rd link
On 11/14/2007 8:49 AM, Adrian Dusa wrote: Dear all, When creating new functions in a package, there is a See also component in the Rd file. Usually one uses \link{otherfun}, if the other function is from the same package, or \link[otherpackage]{otherfun} otherwise. The trouble is that I install new packages not in the default R library folder, but into some other subfolder in my home, so the link searches for otherpackage in my home subfolder. Is there a method to create links to functions from the base package, for example (which is installed by default in the normal library folder)? I believe this is normally automatic in platforms other than Windows. On Windows, the answer is no. The problem is that in most cases R isn't in charge of the help file viewing. There isn't a good way to make a link from an HTML file to a location that isn't known in advance, for example. On Unix-alikes, the workaround is to build soft links to all the packages in a standard location; but soft links don't work on Windows (and we don't want to get into the almost-undocumented hard links that exist on some Windows file systems). Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] library path in Rd link
On Wed, 14 Nov 2007, Adrian Dusa wrote: Dear all, When creating new functions in a package, there is a See also component in the Rd file. Usually one uses \link{otherfun}, if the other function is from the same package, or \link[otherpackage]{otherfun} otherwise. I think you have misread the manual here: There are two other forms of optional argument specified as \link[pkg]{foo} and \link[pkg:bar]{foo} to link to the package pkg, to files foo.html and bar.html respectively. These are rarely needed, perhaps to refer to not-yet-installed packages (but there the HTML help system will resolve the link at run time) or in the normally undesirable event that more than one package offers help on a topic (in which case the present package has precedence so this is only needed to refer to other packages) Note: 'rarely needed'. The trouble is that I install new packages not in the default R library folder, but into some other subfolder in my home, so the link searches for otherpackage in my home subfolder. Is there a method to create links to functions from the base package, for example (which is installed by default in the normal library folder)? What OS is this? (As I recall you used Linux last time you posted.) In any case, on all OSes you will be able to do cross-library links to the base package without having to do anything further (and CRAN packages are full of them). On Unix-alikes the help files are all linked into a single virtual library, and on Windows links to the base package (and a few others) from other libraries are fixed up on installation by link.html.help (see its help). -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] library path in Rd link
On Thu, 15 Nov 2007, Adrian Dusa wrote: Dear Prof. Ripley, On Wednesday 14 November 2007, Prof Brian Ripley wrote: On Wed, 14 Nov 2007, Adrian Dusa wrote: Dear all, When creating new functions in a package, there is a See also component in the Rd file. Usually one uses \link{otherfun}, if the other function is from the same package, or \link[otherpackage]{otherfun} otherwise. I think you have misread the manual here: There are two other forms of optional argument specified as \link[pkg]{foo} and \link[pkg:bar]{foo} to link to the package pkg, to files foo.html and bar.html respectively. These are rarely needed, perhaps to refer to not-yet-installed packages (but there the HTML help system will resolve the link at run time) or in the normally undesirable event that more than one package offers help on a topic (in which case the present package has precedence so this is only needed to refer to other packages) Note: 'rarely needed'. Ah-haa, thanks for the clarification. I could have directly used \code{\link{anova}} to refer to the anova() from package stats which is also installed by default in the same installation folder as the base package. The trouble is that I install new packages not in the default R library folder, but into some other subfolder in my home, so the link searches for otherpackage in my home subfolder. Is there a method to create links to functions from the base package, for example (which is installed by default in the normal library folder)? What OS is this? (As I recall you used Linux last time you posted.) Linux it is, I only thought the question should be platform independent. In any case, on all OSes you will be able to do cross-library links to the base package without having to do anything further (and CRAN packages are full of them). On Unix-alikes the help files are all linked into a single virtual library, and on Windows links to the base package (and a few others) from other libraries are fixed up on installation by link.html.help (see its help). Indeed, link.html.help() resolves all the links under Windows (where I suspected the biggest trouble would be). It is strangely under Linux that I am not able to resolve the links (most surely I do something wrong). Using as above: \code{\link{anova}} the html help file directs to file:///home/adi/myRlibrary/stats/html/anova.html I hope it is actually ../../stats/html/anova.html and the browser is interpreting that as a full URL. instead of file:///usr/lib/R/library/stats/html/anova.html But at run time help.start() creates links into a subdirectory of tempdir(). As in help.start() Making links in per-session dir ... If '/home/ripley/bin/firefox' is already running, it is *not* restarted, and you must switch to its window. Otherwise, be patient ... and without that help(anova, htmlhelp=TRUE) Help for 'anova' is shown in browser /home/ripley/bin/firefox ... Use help(anova, htmlhelp = FALSE) or options(htmlhelp = FALSE) to revert. Warning message: In .show_help_on_topic_as_HTML(file, topic) : Using non-linked HTML file: style sheet and hyperlinks may be incorrect and note the last line. (In case anyone wonders about the browser path: I am running 32-bit Firefox on x86_64 Linux.) -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] library path in Rd link
On 14/11/2007 6:09 PM, Adrian Dusa wrote: On Wednesday 14 November 2007, Duncan Murdoch wrote: On 11/14/2007 8:49 AM, Adrian Dusa wrote: [...] Is there a method to create links to functions from the base package, for example (which is installed by default in the normal library folder)? I believe this is normally automatic in platforms other than Windows. On Windows, the answer is no. This is what I thought, too. But if I link for example to function anova() in pacakge stats, the html link after installing the new package is: file:///home/adi/myRlibrary/stats/html/anova.html where the stats package is by default installed in: /usr/lib/R/library/ (indeed my question was related to Windows too, not only on Linux) The problem is that in most cases R isn't in charge of the help file viewing. There isn't a good way to make a link from an HTML file to a location that isn't known in advance, for example. On Unix-alikes, the workaround is to build soft links to all the packages in a standard location; but soft links don't work on Windows (and we don't want to get into the almost-undocumented hard links that exist on some Windows file systems). I understand, thank you. I learned from Prof. Ripley's answer that Windows has link.html.help() function to resolve the html help files from all installed packages. I didn't know about that; I mainly use the CHMHELP files. They don't support this, being precompiled when the binary package is built. Another reason to switch. The link is probably ../../stats/html/anova.html, and is just being displayed by your browser that way. This is correct: R installs soft links to all packages in one place. The HTML code doesn't get fixed up the way it needs to be on Windows. Are you browsing the files from outside of R? As far as I know (and I rarely use Unix so this may be out of date info) the links are set up in a temporary directoy when you call .libPaths(), and are removed at the end of your session. I don't know if calling library(foo, lib.loc=mine) is enough to link the foo help into the system. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] library path in Rd link
On 14/11/2007 6:44 PM, Adrian Dusa wrote: On Thursday 15 November 2007, Prof Brian Ripley wrote: [...] Using as above: \code{\link{anova}} the html help file directs to file:///home/adi/myRlibrary/stats/html/anova.html I hope it is actually ../../stats/html/anova.html and the browser is interpreting that as a full URL. instead of file:///usr/lib/R/library/stats/html/anova.html But at run time help.start() creates links into a subdirectory of tempdir(). As in help.start() I got it. Perhaps it would be useful to have another startup option, something like: options(htmlLinksResolve=TRUE) that one could use in the .First() function from .Rprofile I tried using help.start() in .Rprofile, but it throws a (probably obvious) error: Error: could not find function help.start That's just because .Rprofile is run before most packages are attached; you should be able to say utils::help.start() to get it to run. For my personal purposes, all questions have been answered though. Thank you very much, Adrian __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] library path in Rd link
On Thursday 15 November 2007, Duncan Murdoch wrote: [...] I understand, thank you. I learned from Prof. Ripley's answer that Windows has link.html.help() function to resolve the html help files from all installed packages. I didn't know about that; I mainly use the CHMHELP files. They don't support this, being precompiled when the binary package is built. Another reason to switch. The link is probably ../../stats/html/anova.html, and is just being displayed by your browser that way. This is correct: R installs soft links to all packages in one place. The HTML code doesn't get fixed up the way it needs to be on Windows. It is true, the link was ../../ (my misunderstanding) Are you browsing the files from outside of R? As far as I know (and I rarely use Unix so this may be out of date info) the links are set up in a temporary directoy when you call .libPaths(), and are removed at the end of your session. I don't know if calling library(foo, lib.loc=mine) is enough to link the foo help into the system. I use: options(htmlhelp=TRUE) options(browser=firefox) I just tried library(myPackage, lib.loc=myRlibrary) but I still get Warning message: In .show_help_on_topic_as_HTML(file, topic) : Using non-linked HTML file: style sheet and hyperlinks may be incorrect so it seems foo help is not linked into the system. But there are (at least on Linux) two more than acceptable solutions: - soft link the folders from /usr/lib/R/library/ to myRlibrary/ (your suggestion, I like it very much and it makes me a happy Linux user) - use help.start() which links all packages help in a tmp directory (Prof.Ripley's solution) Best regards, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romania Tel./Fax: +40 21 3126618 \ +40 21 3120210 / int.101 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] library path in Rd link
On Thursday 15 November 2007, Duncan Murdoch wrote: [...] I tried using help.start() in .Rprofile, but it throws a (probably obvious) error: Error: could not find function help.start That's just because .Rprofile is run before most packages are attached; you should be able to say utils::help.start() to get it to run. Smooth :o) -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romania Tel./Fax: +40 21 3126618 \ +40 21 3120210 / int.101 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] library path in Rd link
On Nov 14, 2007 4:36 PM, Duncan Murdoch [EMAIL PROTECTED] wrote: On Unix-alikes, the workaround is to build soft links to all the packages in a standard location; but soft links don't work on Windows (and we don't want to get into the almost-undocumented hard links that exist on some Windows file systems). Symbolic links are available on Windows Vista: C:\ mklink /? Creates a symbolic link. MKLINK [[/D] | [/H] | [/J]] Link Target /D Creates a directory symbolic link. Default is a file symbolic link. /H Creates a hard link instead of a symbolic link. /J Creates a Directory Junction. Linkspecifies the new symbolic link name. Target specifies the path (relative or absolute) that the new link refers to. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] library path in Rd link
On Thursday 15 November 2007, Prof Brian Ripley wrote: [...] Using as above: \code{\link{anova}} the html help file directs to file:///home/adi/myRlibrary/stats/html/anova.html I hope it is actually ../../stats/html/anova.html and the browser is interpreting that as a full URL. instead of file:///usr/lib/R/library/stats/html/anova.html But at run time help.start() creates links into a subdirectory of tempdir(). As in help.start() I got it. Perhaps it would be useful to have another startup option, something like: options(htmlLinksResolve=TRUE) that one could use in the .First() function from .Rprofile I tried using help.start() in .Rprofile, but it throws a (probably obvious) error: Error: could not find function help.start For my personal purposes, all questions have been answered though. Thank you very much, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romania Tel./Fax: +40 21 3126618 \ +40 21 3120210 / int.101 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel