Re: [Rd] Parser bug? A comma too much.

2022-09-16 Thread peter dalgaard
As a general matter, empty arguments are allowed and are used meaningfully in 
some contexts, notably A[i,], which is syntactic sugarcoating of "["(A,i,).

I.e., these are different:

> "["(Sigma,2,) # 2nd row
[1] 0.077 0.168
> "["(Sigma,2) # 2nd element
[1] 0.077


It is somewhat rare to have an empty last argument, intermediate ones are more 
common:

> seq(0,1,,5)
[1] 0.00 0.25 0.50 0.75 1.00

-pd


> On 16 Sep 2022, at 16:33 , Rui Barradas  wrote:
> 
> Hello,
> 
> Why doesn't the comma throw an error?
> 
> 
> plot(1:5,)# works, no complaints
> 
> 
> Shouldn't this be considered a bug? I would expect the parser to at least 
> give a warning.
> 
> 
> sessionInfo()
> R version 4.2.1 (2022-06-23 ucrt)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 10 x64 (build 22000)
> 
> Matrix products: default
> 
> locale:
> [1] LC_COLLATE=Portuguese_Portugal.utf8 LC_CTYPE=Portuguese_Portugal.utf8
> [3] LC_MONETARY=Portuguese_Portugal.utf8 LC_NUMERIC=C 
> [5] LC_TIME=Portuguese_Portugal.utf8
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
> 
> loaded via a namespace (and not attached):
> [1] compiler_4.2.1
> 
> 
> Rui Barradas
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
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-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Parser bug? A comma too much.

2022-09-16 Thread Bill Dunlap
> By putting in the comma, unless I am mistaken, you are effectively
> saying the second element is NULL, which is how it's naturally
> defined.

No, in f(x,) the second argument is missing, not NULL.

-Bill

On Fri, Sep 16, 2022 at 7:43 AM Avraham Adler 
wrote:

> That may actually be the case for EVERY default plot, if I understand
> correctly. The default S# plot is defined as
>
> ## Default S3 method:
> plot(x, y = NULL, type = "p",  xlim = NULL, ylim = NULL,
>  log = "", main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
>  ann = par("ann"), axes = TRUE, frame.plot = axes,
>  panel.first = NULL, panel.last = NULL, asp = NA,
>  xgap.axis = NA, ygap.axis = NA,
>  ...)
>
> By putting in the comma, unless I am mistaken, you are effectively
> saying the second element is NULL, which is how it's naturally
> defined.
>
> Thanks,
>
> Avi
>
> On Fri, Sep 16, 2022 at 2:33 PM Rui Barradas  wrote:
> >
> > Hello,
> >
> > Why doesn't the comma throw an error?
> >
> >
> > plot(1:5,)# works, no complaints
> >
> >
> > Shouldn't this be considered a bug? I would expect the parser to at
> > least give a warning.
> >
> >
> > sessionInfo()
> > R version 4.2.1 (2022-06-23 ucrt)
> > Platform: x86_64-w64-mingw32/x64 (64-bit)
> > Running under: Windows 10 x64 (build 22000)
> >
> > Matrix products: default
> >
> > locale:
> > [1] LC_COLLATE=Portuguese_Portugal.utf8
> > LC_CTYPE=Portuguese_Portugal.utf8
> > [3] LC_MONETARY=Portuguese_Portugal.utf8 LC_NUMERIC=C
> >
> > [5] LC_TIME=Portuguese_Portugal.utf8
> >
> > attached base packages:
> > [1] stats graphics  grDevices utils datasets  methods   base
> >
> > loaded via a namespace (and not attached):
> > [1] compiler_4.2.1
> >
> >
> > Rui Barradas
> >
> > __
> > R-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Parser bug? A comma too much.

2022-09-16 Thread Avraham Adler
That may actually be the case for EVERY default plot, if I understand
correctly. The default S# plot is defined as

## Default S3 method:
plot(x, y = NULL, type = "p",  xlim = NULL, ylim = NULL,
 log = "", main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
 ann = par("ann"), axes = TRUE, frame.plot = axes,
 panel.first = NULL, panel.last = NULL, asp = NA,
 xgap.axis = NA, ygap.axis = NA,
 ...)

By putting in the comma, unless I am mistaken, you are effectively
saying the second element is NULL, which is how it's naturally
defined.

Thanks,

Avi

On Fri, Sep 16, 2022 at 2:33 PM Rui Barradas  wrote:
>
> Hello,
>
> Why doesn't the comma throw an error?
>
>
> plot(1:5,)# works, no complaints
>
>
> Shouldn't this be considered a bug? I would expect the parser to at
> least give a warning.
>
>
> sessionInfo()
> R version 4.2.1 (2022-06-23 ucrt)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 10 x64 (build 22000)
>
> Matrix products: default
>
> locale:
> [1] LC_COLLATE=Portuguese_Portugal.utf8
> LC_CTYPE=Portuguese_Portugal.utf8
> [3] LC_MONETARY=Portuguese_Portugal.utf8 LC_NUMERIC=C
>
> [5] LC_TIME=Portuguese_Portugal.utf8
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] compiler_4.2.1
>
>
> Rui Barradas
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Respecting custom repositories files in interactive/batch R sessions

2022-09-16 Thread Kurt Hornik
> Gabriel Becker writes:

Friends,

I always keep forgetting how these things currently/precisely work, but
I guess the principle is that utils:::.onLoad() does

  options(repos = c(CRAN = "@CRAN@"))

unless the repos option was already set (in the user or site profiles).
As the latter are not used when checking, the check code in tools takes
advantage of the repositories file mechanism, see ? setRepositories:

 The default list of known repositories is stored in the file
 ‘R_HOME/etc/repositories’.  That file can be edited for a site, or
 a user can have a personal copy in the file pointed to by the
 environment variable ‘R_REPOSITORIES’, or if this is unset or does
 not exist, in ‘HOME/.R/repositories’, which will take precedence.

which also points to Startup etc).

I guess one could teach utils:::.onLoad() to use the user/site
repositories setting instead of the hard-wired CRAN = @CRAN@?  Afaict,
that would make no difference if the repositories file was not
configured, and provide the configured setting in case repos was not set
in the user/site profile ...

Best
-k


> Hi Dirk,
> So there's a couple of things going on. First off you're correct that that
> works generally. There are a couple of reasons that made it not. The first
> is a bug/design error in Rstudio which is causing the R_PROFILE to not be
> adhered to when you build there. I will be filing a bug regarding that with
> them, as I know that is irrelevant to this list.  There was some indication
> that even raw R CMD check running via an R studio server installation was
> missing the profile, but that ended up being spurious upon deeper testing.

> That said, I do think that there is a case to be made for the ability to
> modify what repositories R knows about at a more fundamental level than
> setting options in a site profile, and that is, ostensibly, what the
> repositories file machinery does. I understand it was intended initially
> and is currently only (?) used for the windows repository gui menu and
> related setRepositories function, but I still think there is some value in
> extending it in the ways I described.

> One major difference is that in this case, even when run with --vanilla,
> administrators would still be in control of which repositories users hit
> (by default only, of course, but there is still value in that).

> Best,
> ~G

> On Thu, Sep 15, 2022 at 11:31 AM Dirk Eddelbuettel  wrote:

>> 
>> I may be missing something here but aren't you overcomplicating things?
>> One
>> can avoid the repetitive dialog by setting   options(repos)   accordingly,
>> and I have long done so.  The Debian (and hence Ubuntu and other
>> derivatives)
>> package does so via the Rprofile.site I ship.  See e.g. here
>> 
>> https://sources.debian.org/src/r-base/4.2.1-2/debian/Rprofile.site/
>> 
>> I have used the same mechanism to point to intra-company repositories,
>> easily
>> a decade or so ago. I had no problems with R CMD check of in-house packages
>> using this.
>> 
>> Dirk
>> 
>> --
>> dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
>> 

>   [[alternative HTML version deleted]]

> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel