Re: [R] Why install.packages(repos = X) does not override the 'repos' R option?

2023-06-19 Thread peter dalgaard
Yes. Specifically, RStudio overrides utils::install.packages() with their own 

> install.packages
function (...) 
.rs.callAs(name, hook, original, ...)


which is paved with good intentions, but does deflect blame towards R Core 
things go wrong.

-pd


> On 15 Jun 2023, at 19:42 , Duncan Murdoch  wrote:
> 
> (Sorry, forgot "Reply all" last time.)
> 
> That's an RStudio bug.  It doesn't happen if you use install.packages()
> from R.
> 
> Duncan Murdoch
> 
> On 14/06/2023 9:22 a.m., Dean Attali wrote:
>> There is a default R option for which repos to install from -
>> `getOption("repos")`.
>> When installing a package using install.packages(), you can provide a
>> `repos` parameter. The default value of that parameter is
>> `getOption("repos")`. I assumed that this parameter would override the R
>> option. In other words, I assumed that if the parameter is provided, then
>> the R option would not even be looked at. But after testing this, it seems
>> this is not the case.
>> For example, running the following two lines in an R session:
>> options(repos=c(CRAN="https://BADNAME.com;))
>> install.packages("vctrs", repos = "https://cloud.R-project.org;)
>> I would have expected the first line to be rendered meaningless, but in
>> fact after running the second line I see errors about the BADNAME
>> repository. This feels like a bug to me, but I'm sure there's a reason
>> behind this. Does anyone know why this is the case?
>>  [[alternative HTML version deleted]]
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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 -- To UNSUBSCRIBE and more, see
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Why install.packages(repos = X) does not override the 'repos' R option?

2023-06-15 Thread Duncan Murdoch

(Sorry, forgot "Reply all" last time.)

That's an RStudio bug.  It doesn't happen if you use install.packages()
from R.

Duncan Murdoch

On 14/06/2023 9:22 a.m., Dean Attali wrote:

There is a default R option for which repos to install from -
`getOption("repos")`.

When installing a package using install.packages(), you can provide a
`repos` parameter. The default value of that parameter is
`getOption("repos")`. I assumed that this parameter would override the R
option. In other words, I assumed that if the parameter is provided, then
the R option would not even be looked at. But after testing this, it seems
this is not the case.

For example, running the following two lines in an R session:

options(repos=c(CRAN="https://BADNAME.com;))
install.packages("vctrs", repos = "https://cloud.R-project.org;)

I would have expected the first line to be rendered meaningless, but in
fact after running the second line I see errors about the BADNAME
repository. This feels like a bug to me, but I'm sure there's a reason
behind this. Does anyone know why this is the case?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 -- To UNSUBSCRIBE and more, see
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] Why install.packages(repos = X) does not override the 'repos' R option?

2023-06-15 Thread Dean Attali
There is a default R option for which repos to install from -
`getOption("repos")`.

When installing a package using install.packages(), you can provide a
`repos` parameter. The default value of that parameter is
`getOption("repos")`. I assumed that this parameter would override the R
option. In other words, I assumed that if the parameter is provided, then
the R option would not even be looked at. But after testing this, it seems
this is not the case.

For example, running the following two lines in an R session:

options(repos=c(CRAN="https://BADNAME.com;))
install.packages("vctrs", repos = "https://cloud.R-project.org;)

I would have expected the first line to be rendered meaningless, but in
fact after running the second line I see errors about the BADNAME
repository. This feels like a bug to me, but I'm sure there's a reason
behind this. Does anyone know why this is the case?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.