warning from install.packages()

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

warning from install.packages()

Ben Bolker

  Just curious: is there a particular reason why install.packages()
gives a warning in normal use when 'lib' is not specified (e.g. argument
'lib' is missing: using '/usr/local/lib/R/site-library' )?  It would
seem to me that this is normal behavior as documented (" If missing,
defaults to the first element of ‘.libPaths()’.")  It's one of the most
common questions I have to answer for students during introductory R
sessions ...

  If there's not, would anyone get annoyed if I submitted a wishlist
item to have it suppressed by default?

   Ben Bolker

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: warning from install.packages()

Jari Oksanen
On 25/05/10 23:25 PM, "Ben Bolker" <[hidden email]> wrote:

>
  Just curious: is there a particular reason why install.packages()
gives a
> warning in normal use when 'lib' is not specified (e.g. argument
'lib' is
> missing: using '/usr/local/lib/R/site-library' )?  It would
seem to me that
> this is normal behavior as documented (" If missing,
defaults to the first
> element of Œ.libPaths()¹.")

Indeed, should this be a message()?

cheers, jaz

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: warning from install.packages()

Ben Bolker

> On 25/05/10 23:25 PM, "Ben Bolker" <bolker <at> ufl.edu> wrote:
>   Just curious: is there a particular reason why install.packages()
> gives a warning in normal use when 'lib' is not specified (e.g. argument
> 'lib' is missing: using '/usr/local/lib/R/site-library' )?  

  Bump.

 
>From install.packages in utils/R/packages2.R:

      if(missing(lib) || is.null(lib)) {
        lib <- .libPaths()[1L]
        if(length(.libPaths()) > 1L)
            warning(gettextf("argument 'lib' is missing: using '%s'", lib),
                    immediate. = TRUE, domain = NA)
    }


  If I were patching this I would simply comment out this whole test
(rather than making a message() à la Jari Oksanen) -- it seems to
make the most sense to execute the documented behavior silently ...

  I will submit this as a wishlist item shortly if no-one complains.

   Ben Bolker

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: warning from install.packages()

Michael Dewey
At 13:40 01/06/2010, Ben Bolker wrote:

> > On 25/05/10 23:25 PM, "Ben Bolker" <bolker <at> ufl.edu> wrote:
> >   Just curious: is there a particular reason why install.packages()
> > gives a warning in normal use when 'lib' is not specified (e.g. argument
> > 'lib' is missing: using '/usr/local/lib/R/site-library' )?

As I see it R is saying 'I am doing what you told
me, but just in case I am checking whether that
was what you really wanted'. Note that you do not
get a warning if there was only one place R could
put it. I would certainly vote for a message if
people are getting unnecessarily alarmed by the warning.


>   Bump.
>
>
> >From install.packages in utils/R/packages2.R:
>
>       if(missing(lib) || is.null(lib)) {
>         lib <- .libPaths()[1L]
>         if(length(.libPaths()) > 1L)
>             warning(gettextf("argument 'lib' is missing: using '%s'", lib),
>                     immediate. = TRUE, domain = NA)
>     }
>
>
>   If I were patching this I would simply comment out this whole test
>(rather than making a message() Ã  la Jari Oksanen) -- it seems to
>make the most sense to execute the documented behavior silently ...
>
>   I will submit this as a wishlist item shortly if no-one complains.
>
>    Ben Bolker

Michael Dewey
http://www.aghmed.fsnet.co.uk

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: warning from install.packages()

Ben Bolker
Michael Dewey wrote:

> At 13:40 01/06/2010, Ben Bolker wrote:
>
>>> On 25/05/10 23:25 PM, "Ben Bolker" <bolker <at> ufl.edu> wrote:
>>>   Just curious: is there a particular reason why install.packages()
>>> gives a warning in normal use when 'lib' is not specified (e.g. argument
>>> 'lib' is missing: using '/usr/local/lib/R/site-library' )?
>
> As I see it R is saying 'I am doing what you told
> me, but just in case I am checking whether that
> was what you really wanted'. Note that you do not
> get a warning if there was only one place R could
> put it. I would certainly vote for a message if
> people are getting unnecessarily alarmed by the warning.
  But this seems so different from R's general philosophy/behavior
(inherited from Unix?) that a function that gets correct input and
executes without error returns silently ...


______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

signature.asc (269 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: warning from install.packages()

Martin Maechler
>>>>> "BB" == Ben Bolker <[hidden email]>
>>>>>     on Wed, 02 Jun 2010 13:45:18 -0400 writes:

    BB> Michael Dewey wrote:
    >> At 13:40 01/06/2010, Ben Bolker wrote:
    >>
    >>>> On 25/05/10 23:25 PM, "Ben Bolker" <bolker <at> ufl.edu> wrote:
    >>>> Just curious: is there a particular reason why install.packages()
    >>>> gives a warning in normal use when 'lib' is not specified (e.g. argument
    >>>> 'lib' is missing: using '/usr/local/lib/R/site-library' )?
    >>
    >> As I see it R is saying 'I am doing what you told
    >> me, but just in case I am checking whether that
    >> was what you really wanted'. Note that you do not
    >> get a warning if there was only one place R could
    >> put it. I would certainly vote for a message if
    >> people are getting unnecessarily alarmed by the warning.

    BB> But this seems so different from R's general philosophy/behavior
    BB> (inherited from Unix?) that a function that gets correct input and
    BB> executes without error returns silently ...

That's correct.
Note however that installing a package is not just a thing
happening in your R session.
It will affect all your future R sessions, and possibly even
other users' who have the same  .libPaths()[1]
{e.g. the group here does share it}.

I'd agree to not put a warning but I'd definitely want a message
aka "note" to the user.
The *wording* of that note should not be alarming at all, I
agree, just a note to the user.

Martin Maechler, ETH Zurich

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: warning from install.packages()

Ben Bolker
Martin Maechler wrote:

>>>>>> "BB" == Ben Bolker <[hidden email]>
>>>>>>     on Wed, 02 Jun 2010 13:45:18 -0400 writes:
>
>     BB> Michael Dewey wrote:
>     >> At 13:40 01/06/2010, Ben Bolker wrote:
>     >>
>     >>>> On 25/05/10 23:25 PM, "Ben Bolker" <bolker <at> ufl.edu> wrote:
>     >>>> Just curious: is there a particular reason why install.packages()
>     >>>> gives a warning in normal use when 'lib' is not specified (e.g. argument
>     >>>> 'lib' is missing: using '/usr/local/lib/R/site-library' )?
>     >>
>     >> As I see it R is saying 'I am doing what you told
>     >> me, but just in case I am checking whether that
>     >> was what you really wanted'. Note that you do not
>     >> get a warning if there was only one place R could
>     >> put it. I would certainly vote for a message if
>     >> people are getting unnecessarily alarmed by the warning.
>
>     BB> But this seems so different from R's general philosophy/behavior
>     BB> (inherited from Unix?) that a function that gets correct input and
>     BB> executes without error returns silently ...
>
> That's correct.
> Note however that installing a package is not just a thing
> happening in your R session.
> It will affect all your future R sessions, and possibly even
> other users' who have the same  .libPaths()[1]
> {e.g. the group here does share it}.
>
> I'd agree to not put a warning but I'd definitely want a message
> aka "note" to the user.
> The *wording* of that note should not be alarming at all, I
> agree, just a note to the user.
>
> Martin Maechler, ETH Zurich
  OK, then, how about this as a minimal change?

===================================================================
--- packages.R (revision 52192)
+++ packages.R (working copy)
@@ -534,8 +534,8 @@

     if(missing(lib) || is.null(lib)) {
         lib <- .libPaths()[1L]
-        warning(gettextf("argument 'lib' is missing: using %s", lib),
-                immediate. = TRUE, domain = NA)
+        message(gettextf("argument 'lib' is missing: using %s", lib),
+                domain = NA)
     }

     paths <- .find.package(pkgs, lib)
Index: packages2.R
===================================================================
--- packages2.R (revision 52192)
+++ packages2.R (working copy)
@@ -193,8 +193,8 @@
     if(missing(lib) || is.null(lib)) {
         lib <- .libPaths()[1L]
         if(length(.libPaths()) > 1L)
-            warning(gettextf("argument 'lib' is missing: using '%s'", lib),
-                    immediate. = TRUE, domain = NA)
+            message(gettextf("argument 'lib' is missing: using '%s'", lib),
+                    domain = NA)
     }

     ## check for writability by user


--
Ben Bolker
Associate professor, Biology Dep't, Univ. of Florida
*** NEW E-MAIL ADDRESSES:
***   [hidden email] , [hidden email]
[hidden email] / people.biology.ufl.edu/bolker
GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc


______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

signature.asc (269 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: warning from install.packages()

Vincent Goulet
Le jeu. 3 juin à 09:27, Ben Bolker a écrit :

> Martin Maechler wrote:
>>>>>>> "BB" == Ben Bolker <[hidden email]>
>>>>>>>    on Wed, 02 Jun 2010 13:45:18 -0400 writes:
>>
>>    BB> Michael Dewey wrote:
>>>> At 13:40 01/06/2010, Ben Bolker wrote:
>>>>
>>>>>> On 25/05/10 23:25 PM, "Ben Bolker" <bolker <at> ufl.edu> wrote:
>>>>>> Just curious: is there a particular reason why install.packages()
>>>>>> gives a warning in normal use when 'lib' is not specified (e.g. argument
>>>>>> 'lib' is missing: using '/usr/local/lib/R/site-library' )?
>>>>
>>>> As I see it R is saying 'I am doing what you told
>>>> me, but just in case I am checking whether that
>>>> was what you really wanted'. Note that you do not
>>>> get a warning if there was only one place R could
>>>> put it. I would certainly vote for a message if
>>>> people are getting unnecessarily alarmed by the warning.
>>
>>    BB> But this seems so different from R's general philosophy/behavior
>>    BB> (inherited from Unix?) that a function that gets correct input and
>>    BB> executes without error returns silently ...
>>
>> That's correct.
>> Note however that installing a package is not just a thing
>> happening in your R session.
>> It will affect all your future R sessions, and possibly even
>> other users' who have the same  .libPaths()[1]
>> {e.g. the group here does share it}.
>>
>> I'd agree to not put a warning but I'd definitely want a message
>> aka "note" to the user.
>> The *wording* of that note should not be alarming at all, I
>> agree, just a note to the user.
>>
>> Martin Maechler, ETH Zurich
>
>  OK, then, how about this as a minimal change?
>
> ===================================================================
> --- packages.R (revision 52192)
> +++ packages.R (working copy)
> @@ -534,8 +534,8 @@
>
>     if(missing(lib) || is.null(lib)) {
>         lib <- .libPaths()[1L]
> -        warning(gettextf("argument 'lib' is missing: using %s", lib),
> -                immediate. = TRUE, domain = NA)
> +        message(gettextf("argument 'lib' is missing: using %s", lib),
> +                domain = NA)
>     }
>
>     paths <- .find.package(pkgs, lib)
> Index: packages2.R
> ===================================================================
> --- packages2.R (revision 52192)
> +++ packages2.R (working copy)
> @@ -193,8 +193,8 @@
>     if(missing(lib) || is.null(lib)) {
>         lib <- .libPaths()[1L]
>         if(length(.libPaths()) > 1L)
> -            warning(gettextf("argument 'lib' is missing: using '%s'", lib),
> -                    immediate. = TRUE, domain = NA)
> +            message(gettextf("argument 'lib' is missing: using '%s'", lib),
> +                    domain = NA)
>     }
>
>     ## check for writability by user

I wholeheartedly support the change discussed here since it is also something that has been worrying my students for some time.

However, I think saying "argument 'lib' not specified: using '%s'" would be even less alarming. "... is missing" sort of implies the user forgot something.

My 0.02 $


Dr. Vincent Goulet
Full Professor
École d'actuariat, Université Laval, Québec
[hidden email]   http://vgoulet.act.ulaval.ca


>
>
> --
> Ben Bolker
> Associate professor, Biology Dep't, Univ. of Florida
> *** NEW E-MAIL ADDRESSES:
> ***   [hidden email] , [hidden email]
> [hidden email] / people.biology.ufl.edu/bolker
> GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc
>
> <signature.asc><ATT00001..txt>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: warning from install.packages()

Martin Maechler
>>>>> "VG" == Vincent Goulet <[hidden email]>
>>>>>     on Thu, 3 Jun 2010 10:24:21 -0400 writes:

    VG> Le jeu. 3 juin à 09:27, Ben Bolker a écrit :
    >> Martin Maechler wrote:
    >>>>>>>> "BB" == Ben Bolker <[hidden email]>
    >>>>>>>> on Wed, 02 Jun 2010 13:45:18 -0400 writes:
    >>>
    BB> Michael Dewey wrote:
    >>>>> At 13:40 01/06/2010, Ben Bolker wrote:
    >>>>>
    >>>>>>> On 25/05/10 23:25 PM, "Ben Bolker" <bolker <at> ufl.edu> wrote:
    >>>>>>> Just curious: is there a particular reason why install.packages()
    >>>>>>> gives a warning in normal use when 'lib' is not specified (e.g. argument
    >>>>>>> 'lib' is missing: using '/usr/local/lib/R/site-library' )?
    >>>>>
    >>>>> As I see it R is saying 'I am doing what you told
    >>>>> me, but just in case I am checking whether that
    >>>>> was what you really wanted'. Note that you do not
    >>>>> get a warning if there was only one place R could
    >>>>> put it. I would certainly vote for a message if
    >>>>> people are getting unnecessarily alarmed by the warning.
    >>>
    BB> But this seems so different from R's general philosophy/behavior
    BB> (inherited from Unix?) that a function that gets correct input and
    BB> executes without error returns silently ...
    >>>
    >>> That's correct.
    >>> Note however that installing a package is not just a thing
    >>> happening in your R session.
    >>> It will affect all your future R sessions, and possibly even
    >>> other users' who have the same  .libPaths()[1]
    >>> {e.g. the group here does share it}.
    >>>
    >>> I'd agree to not put a warning but I'd definitely want a message
    >>> aka "note" to the user.
    >>> The *wording* of that note should not be alarming at all, I
    >>> agree, just a note to the user.
    >>>
    >>> Martin Maechler, ETH Zurich
    >>
    >> OK, then, how about this as a minimal change?
    >>
    >> ===================================================================
    >> --- packages.R (revision 52192)
    >> +++ packages.R (working copy)
    >> @@ -534,8 +534,8 @@
    >>
    >> if(missing(lib) || is.null(lib)) {
    >> lib <- .libPaths()[1L]
    >> -        warning(gettextf("argument 'lib' is missing: using %s", lib),
    >> -                immediate. = TRUE, domain = NA)
    >> +        message(gettextf("argument 'lib' is missing: using %s", lib),
    >> +                domain = NA)
    >> }
    >>
    >> paths <- .find.package(pkgs, lib)
    >> Index: packages2.R
    >> ===================================================================
    >> --- packages2.R (revision 52192)
    >> +++ packages2.R (working copy)
    >> @@ -193,8 +193,8 @@
    >> if(missing(lib) || is.null(lib)) {
    >> lib <- .libPaths()[1L]
    >> if(length(.libPaths()) > 1L)
    >> -            warning(gettextf("argument 'lib' is missing: using '%s'", lib),
    >> -                    immediate. = TRUE, domain = NA)
    >> +            message(gettextf("argument 'lib' is missing: using '%s'", lib),
    >> +                    domain = NA)
    >> }
    >>
    >> ## check for writability by user

    VG> I wholeheartedly support the change discussed here since it is also something that has been worrying my students for some time.

    VG> However, I think saying "argument 'lib' not specified: using '%s'" would be even less alarming. "... is missing" sort of implies the user forgot something.

Yes, thank you Vincent,
I meant some such change when I said

    >>> The *wording* of that note should not be alarming at all, I
    >>> agree, just a note to the user.

I'd even change it further, to something like
 "Installing package into '%s' (as 'lib' is not specified)"

Martin




    VG> Dr. Vincent Goulet
    VG> Full Professor
    VG> École d'actuariat, Université Laval, Québec
    VG> [hidden email]   http://vgoulet.act.ulaval.ca


    >>
    >>
    >> --
    >> Ben Bolker
    >> Associate professor, Biology Dep't, Univ. of Florida
    >> *** NEW E-MAIL ADDRESSES:
    >> ***   [hidden email] , [hidden email]
    >> [hidden email] / people.biology.ufl.edu/bolker
    >> GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc
    >>
    >> <signature.asc><ATT00001..txt>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel