[R] How to start default browser on R

Gavin Simpson gavin.simpson at ucl.ac.uk
Wed Nov 24 17:13:32 CET 2010


On Mon, 2010-11-22 at 23:31 -0800, Stephen Liu wrote:
> Hi David,
> 
> I see.  File: gives the full path to the .html file created/download.  Then the 
> browser will open that file.  Thanks.
> 
> I don't have hwriter package installed.
> 
> A side question, what will be the corresponding command on R for check whether a 
> package already installed?
> 
> similar to;
> On R (Windows)
> Packages - Load package

No, that is a work around that gives the answer you want in a rather
round-about way.

As far as I can see, there isn't one, but it is easy to cook up:

isInstalled <- function(pkg, lib.loc = NULL) {
    stopifnot(is.character(pkg))
    pkgs <- installed.packages(lib.loc = lib.loc)
    pkg %in% pkgs
}

G

> B.R.
> Stephen L
> 
> 
> 
> ----- Original Message ----
> From: David Scott <d.scott at auckland.ac.nz>
> To: Stephen Liu <satimis at yahoo.com>
> Cc: Ista Zahn <izahn at psych.rochester.edu>; "r-help at r-project.org" 
> <r-help at r-project.org>
> Sent: Tue, November 23, 2010 12:00:36 PM
> Subject: Re: [R] How to start default browser on R
> 
>   On 23/11/10 16:59, Stephen Liu wrote:
> > Hi Ista,
> >
> > I see.  Your advice works.  Thanks
> >
> > even without:
> > browser="C:/Program Files/Internet Explorer/iexplore.exe")
> >
> > For non default browser it needs;
> > browser="C:/Program Files/Mozilla Firefoe/firefox.exe"
> >
> >
> > What will be "file:" used for?
> >
> >
> > B.R.
> > Stephen L
> >
> You can use it to open a local file on your machine as well. I use this 
> all the time with hwriter which writes html reports.
> 
> David Scott
> 

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list