install.packages doesn't produce warnings unless qualified with utils::

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

install.packages doesn't produce warnings unless qualified with utils::

David Hugh-Jones-3
Hi all,

Assuming this is an R core issue:

tryCatch(install.packages("clipr", repos = "bullshit"), warning = function
(w) cat("got a warning"))
Warning in install.packages :
  unable to access index for repository bullshit/src/contrib:
  cannot open URL 'bullshit/src/contrib/PACKAGES'
Warning in install.packages :
  package ‘clipr’ is not available (for R version 3.4.3)
Warning in install.packages :
  unable to access index for repository
bullshit/bin/macosx/el-capitan/contrib/3.4:
  cannot open URL 'bullshit/bin/macosx/el-capitan/contrib/3.4/PACKAGES'

In other words, lots of warnings, but none are caught.

It works if you use the fully qualified version in utils:

tryCatch(utils::install.packages("clipr", repos = "bullshit"), warning =
function (w) cat("got a warning"))
got a warning

Any ideas?
Cheers,
David

        [[alternative HTML version deleted]]

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

Re: install.packages doesn't produce warnings unless qualified with utils::

Joshua Ulrich
On Sat, Mar 3, 2018 at 1:33 PM, David Hugh-Jones
<[hidden email]> wrote:

> Hi all,
>
> Assuming this is an R core issue:
>
> tryCatch(install.packages("clipr", repos = "bullshit"), warning = function
> (w) cat("got a warning"))
> Warning in install.packages :
>   unable to access index for repository bullshit/src/contrib:
>   cannot open URL 'bullshit/src/contrib/PACKAGES'
> Warning in install.packages :
>   package ‘clipr’ is not available (for R version 3.4.3)
> Warning in install.packages :
>   unable to access index for repository
> bullshit/bin/macosx/el-capitan/contrib/3.4:
>   cannot open URL 'bullshit/bin/macosx/el-capitan/contrib/3.4/PACKAGES'
>
> In other words, lots of warnings, but none are caught.
>
Using R-3.4.3 on 64-bit Ubuntu throws and catches the warning.

R> tryCatch(install.packages("clipr", repos="w"), warning=function(w)
cat("got a warning!\n"))
Installing package into '/home/josh/R/library'
(as 'lib' is unspecified)
got a warning!

> It works if you use the fully qualified version in utils:
>
> tryCatch(utils::install.packages("clipr", repos = "bullshit"), warning =
> function (w) cat("got a warning"))
> got a warning
>
My guess is that something (a package, console, etc) is masking
utils::install.packages().

> Any ideas?
> Cheers,
> David
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

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

Re: install.packages doesn't produce warnings unless qualified with utils::

Duncan Murdoch-2
On 03/03/2018 3:00 PM, Joshua Ulrich wrote:

> On Sat, Mar 3, 2018 at 1:33 PM, David Hugh-Jones
> <[hidden email]> wrote:
>> Hi all,
>>
>> Assuming this is an R core issue:
>>
>> tryCatch(install.packages("clipr", repos = "bullshit"), warning = function
>> (w) cat("got a warning"))
>> Warning in install.packages :
>>    unable to access index for repository bullshit/src/contrib:
>>    cannot open URL 'bullshit/src/contrib/PACKAGES'
>> Warning in install.packages :
>>    package ‘clipr’ is not available (for R version 3.4.3)
>> Warning in install.packages :
>>    unable to access index for repository
>> bullshit/bin/macosx/el-capitan/contrib/3.4:
>>    cannot open URL 'bullshit/bin/macosx/el-capitan/contrib/3.4/PACKAGES'
>>
>> In other words, lots of warnings, but none are caught.
>>
> Using R-3.4.3 on 64-bit Ubuntu throws and catches the warning.
>
> R> tryCatch(install.packages("clipr", repos="w"), warning=function(w)
> cat("got a warning!\n"))
> Installing package into '/home/josh/R/library'
> (as 'lib' is unspecified)
> got a warning!
>
>> It works if you use the fully qualified version in utils:
>>
>> tryCatch(utils::install.packages("clipr", repos = "bullshit"), warning =
>> function (w) cat("got a warning"))
>> got a warning
>>
> My guess is that something (a package, console, etc) is masking
> utils::install.packages().

RStudio does that.

Duncan Murdoch

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

Fwd: install.packages doesn't produce warnings unless qualified with utils::

David Hugh-Jones-3
In reply to this post by Joshua Ulrich
On Sat, 3 Mar 2018 at 20:01, Joshua Ulrich <[hidden email]> wrote:

>
> >
> My guess is that something (a package, console, etc) is masking
> utils::install.packages().
>
>
This looks about right. On R in the terminal the warning is thrown. In
Rstudio I have the problem, and:

 > getAnywhere('install.packages')
2 differing objects matching ‘install.packages’ were found
in the following places
  package:utils
  namespace:utils
Use [] to view one of them

And the version in package.utils looks like:

function (...)
.rs.callAs(name, hook, original, ...)

OK, so an RStudio issue. Indeed, this looks like the problem:

https://github.com/rstudio/rstudio/blob/master/src/cpp/r/R/Tools.R

There, callAs is defined as running a function with error handlers which
use `cat` to reprint warnings.

Thanks!
David
--
Sent from Gmail Mobile

        [[alternative HTML version deleted]]

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