Re: [Rd] substitute

2021-11-18 Thread Martin Maechler
> Duncan Murdoch > on Mon, 15 Nov 2021 13:06:23 -0500 writes: > I'd recommend responding now with a pointer to that bug > report: whoever at CRAN is dealing with your package > doesn't necessarily know about the bug report. You might > or might not need to make a chan

Re: [Rd] substitute

2021-11-15 Thread Duncan Murdoch
I'd recommend responding now with a pointer to that bug report: whoever at CRAN is dealing with your package doesn't necessarily know about the bug report. You might or might not need to make a change in the end, but if you do, it could be hard to meet the two week deadline. Duncan Murdoch O

Re: [Rd] substitute

2021-11-15 Thread Adrian Dușa
Thank you, I was given a deadline of two weeks to respond, hopefully this will be settled by then. Best wishes, Adrian On Mon, 15 Nov 2021 at 19:28, Duncan Murdoch wrote: > This looks as though it is related to the recent patch in > >https://bugs.r-project.org/show_bug.cgi?id=18232 > > I thi

Re: [Rd] substitute

2021-11-15 Thread Duncan Murdoch
This looks as though it is related to the recent patch in https://bugs.r-project.org/show_bug.cgi?id=18232 I think you should probably wait until that settles down before worrying about it. Duncan Murdoch On 15/11/2021 12:18 p.m., Adrian Dușa wrote: Dear R wizards, I have recently been i

[Rd] substitute

2021-11-15 Thread Adrian Dușa
Dear R wizards, I have recently been informed about some build errors of my package QCA, which I was able to trace down to the base function substitute(), with the following replication example: foo <- function(x) return(substitute(x)) In the stable R version 4.0.5, I get the expected result: >

Re: [Rd] substitute inconsistent output

2020-03-18 Thread Duncan Murdoch
On 18/03/2020 1:36 a.m., Jan Gorecki wrote: Dear R-devel, Is there anything that we can do to make output of those call more consistent? So the first one will return `c(1L, 2L)` rather than `1:2`. Note that it is not related to compact integer sequence introduced by altrep, it is reproducible on

[Rd] substitute inconsistent output

2020-03-17 Thread Jan Gorecki
Dear R-devel, Is there anything that we can do to make output of those call more consistent? So the first one will return `c(1L, 2L)` rather than `1:2`. Note that it is not related to compact integer sequence introduced by altrep, it is reproducible on R 3.1.0 as well. substitute(v+x, list(x=c(1L

Re: [Rd] substitute() on arguments in ellipsis ("dot dot dot")?

2018-08-15 Thread Jim Hester
Assuming you are fine with a pairlist instead of a list avoiding the `as.list()` call for dots2 saves a reasonable amount of time and makes it clearly the fastest. library(rlang) dots1 <- function(...) as.list(substitute(list(...)))[-1L] dots2 <- function(...) as.list(substitute(...())) dots2.5 <

Re: [Rd] substitute() on arguments in ellipsis ("dot dot dot")?

2018-08-15 Thread lmo via R-devel
A potential solution, at least in terms of producing the desired output, is the base R function alist: > alist(1+2, "a", rnorm(3)) [[1]] 1 + 2 [[2]] [1] "a" [[3]] rnorm(3) > str(alist(1+2, "a", rnorm(3))) List of 3  $ : language 1 + 2  $ : chr "a"  $ : language rnorm(3) luke [[altern

Re: [Rd] substitute() on arguments in ellipsis ("dot dot dot")?

2018-08-13 Thread Hadley Wickham
Since you're already using bang-bang ;) library(rlang) dots1 <- function(...) as.list(substitute(list(...)))[-1L] dots2 <- function(...) as.list(substitute(...())) dots3 <- function(...) match.call(expand.dots = FALSE)[["..."]] dots4 <- function(...) exprs(...) bench::mark( dots1(1+2, "a", rno

Re: [Rd] substitute() on arguments in ellipsis ("dot dot dot")?

2018-08-13 Thread Henrik Bengtsson
Thanks all, this was very helpful. Peter's finding - dots2() below - is indeed interesting - I'd be curious to learn what goes on there. The different alternatives perform approximately the same; dots1 <- function(...) as.list(substitute(list(...)))[-1L] dots2 <- function(...) as.list(substitute

Re: [Rd] substitute() on arguments in ellipsis ("dot dot dot")?

2018-08-12 Thread Peter Meilstrup
Interestingly, as.list(substitute(...())) also works. On Sun, Aug 12, 2018 at 1:16 PM, Duncan Murdoch wrote: > On 12/08/2018 4:00 PM, Henrik Bengtsson wrote: >> >> Hi. For any number of *known* arguments, we can do: >> >> one <- function(a) list(a = substitute(a)) >> two <- function(a, b) li

Re: [Rd] substitute() on arguments in ellipsis ("dot dot dot")?

2018-08-12 Thread Jeroen Ooms
On Sun, Aug 12, 2018 at 10:00 PM, Henrik Bengtsson wrote: > Hi. For any number of *known* arguments, we can do: > > one <- function(a) list(a = substitute(a)) > two <- function(a, b) list(a = substitute(a), b = substitute(b)) > > and so on. But how do I achieve the same when I have: > > dots <- fu

Re: [Rd] substitute() on arguments in ellipsis ("dot dot dot")?

2018-08-12 Thread Duncan Murdoch
On 12/08/2018 4:00 PM, Henrik Bengtsson wrote: Hi. For any number of *known* arguments, we can do: one <- function(a) list(a = substitute(a)) two <- function(a, b) list(a = substitute(a), b = substitute(b)) and so on. But how do I achieve the same when I have: dots <- function(...) list(???)

[Rd] substitute() on arguments in ellipsis ("dot dot dot")?

2018-08-12 Thread Henrik Bengtsson
Hi. For any number of *known* arguments, we can do: one <- function(a) list(a = substitute(a)) two <- function(a, b) list(a = substitute(a), b = substitute(b)) and so on. But how do I achieve the same when I have: dots <- function(...) list(???) I want to implement this such that I can do: > e

Re: [Rd] Substitute / delayedAssign (was: Substitute unaware when promise objects are evaluated)

2013-05-17 Thread peter dalgaard
eval(e) (of course remove the print(e) once you're sure that it is doing the right thing) > > Thanks, Robert > > > > -----Original Message- > From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] > Sent: Wednesday, May 15, 2013 6:04 PM > To: McGehee, Robert >

Re: [Rd] Substitute / delayedAssign (was: Substitute unaware when promise objects are evaluated)

2013-05-17 Thread Peter Meilstrup
On Fri, May 17, 2013 at 2:47 AM, Duncan Murdoch wrote: > On 13-05-16 11:17 PM, Peter Meilstrup wrote: > >> On Thu, May 16, 2013 at 6:06 AM, McGehee, Robert < >> Robert.McGehee@geodecapital.**com > >> wrote: >> >> Duncan, Thank you for the clarification on how delayedAssign works. >>> Should >>> R

Re: [Rd] Substitute / delayedAssign (was: Substitute unaware when promise objects are evaluated)

2013-05-17 Thread Duncan Murdoch
On 13-05-16 11:17 PM, Peter Meilstrup wrote: On Thu, May 16, 2013 at 6:06 AM, McGehee, Robert < robert.mcge...@geodecapital.com> wrote: Duncan, Thank you for the clarification on how delayedAssign works. Should R-level interfaces to promise objects ever become available, I expect they would at

Re: [Rd] Substitute / delayedAssign (was: Substitute unaware when promise objects are evaluated)

2013-05-16 Thread Peter Meilstrup
On Thu, May 16, 2013 at 6:06 AM, McGehee, Robert < robert.mcge...@geodecapital.com> wrote: > Duncan, Thank you for the clarification on how delayedAssign works. Should > R-level interfaces to promise objects ever become available, I expect they > would at time come in handy. > > On the subject of

Re: [Rd] Substitute / delayedAssign (was: Substitute unaware when promise objects are evaluated)

2013-05-16 Thread Duncan Murdoch
x)) mydelay(i) Duncan Murdoch Thanks, Robert -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: Wednesday, May 15, 2013 6:04 PM To: McGehee, Robert Cc: R-Devel (r-devel@r-project.org) Subject: Re: [Rd] Substitute unaware when promise objects are evaluat

[Rd] Substitute / delayedAssign (was: Substitute unaware when promise objects are evaluated)

2013-05-16 Thread McGehee, Robert
this R CMD check warning about .Internal, or is there a better way to write this code? Thanks, Robert -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: Wednesday, May 15, 2013 6:04 PM To: McGehee, Robert Cc: R-Devel (r-devel@r-project.org) Subject: Re: [Rd]

Re: [Rd] Substitute unaware when promise objects are evaluated

2013-05-15 Thread Duncan Murdoch
On 13-05-15 11:54 AM, McGehee, Robert wrote: R-devel, I used the 'substitute' function to create labels for objects inside an environment, without actually evaluating the objects, as the objects might be promises. However, I was surprised to see that 'substitute' returns the expression slot of

[Rd] Substitute unaware when promise objects are evaluated

2013-05-15 Thread McGehee, Robert
R-devel, I used the 'substitute' function to create labels for objects inside an environment, without actually evaluating the objects, as the objects might be promises. However, I was surprised to see that 'substitute' returns the expression slot of the original promise even after the promise h

Re: [Rd] Substitute adds id attribute?

2012-03-20 Thread Hadley Wickham
> Well, yes; you can get there more quickly as follows: > >> x <- as.name("foo") >> attr(x,"id") <- 7913 >> x > foo > attr(,"id") > [1] 7913 >> substitute(foo) > foo > attr(,"id") > [1] 7913 > > I.e. if you ever put an attribute on a symbol, it stays there "forever". The > fix is probably to forbi

Re: [Rd] Substitute adds id attribute?

2012-03-20 Thread peter dalgaard
On Mar 20, 2012, at 22:31 , Hadley Wickham wrote: > Hi all, > > I can't figure out how to make this problem easily reproducible, but I > can demonstrate it very simply, so I hoped someone might be able to > suggest a place to start: > >> f <- function(x) substitute(x) >> f(x) > x >> f(mpg) > mp

[Rd] Substitute adds id attribute?

2012-03-20 Thread Hadley Wickham
Hi all, I can't figure out how to make this problem easily reproducible, but I can demonstrate it very simply, so I hoped someone might be able to suggest a place to start: > f <- function(x) substitute(x) > f(x) x > f(mpg) mpg attr(,"id") [1] 11 It works as expected in a clean R session: > f <

[Rd] substitute with plots (PR#10987)

2008-03-18 Thread bob . ohara
Full_Name: Bob O'Hara Version: 2.6.2 OS: Windows Submission from: (NULL) (128.214.72.197) Wishlist: This is a documentation problem/complaint/whinge. The help for substitute() tells us "The typical use of substitute is to create informative labels for data sets and plots." But the example given

Re: [Rd] substitute() bug? (PR#10525)

2007-12-22 Thread Duncan Murdoch
[EMAIL PROTECTED] wrote: > The first four lines of code below work as normal. The fifth thorows > an error: "Error in paste(theta[1], "=", 5) : object "theta" not found" > > > x=rnorm(1000); > bob=density(x); > topp=5; > plot(bob,xlab="", ylab="", > main=substitute(paste(theta[1],"=",topp),lis

[Rd] substitute() bug? (PR#10525)

2007-12-22 Thread rossibarra
The first four lines of code below work as normal. The fifth thorows an error: "Error in paste(theta[1], "=", 5) : object "theta" not found" x=rnorm(1000); bob=density(x); topp=5; plot(bob,xlab="", ylab="", main=substitute(paste(theta[1],"=",topp),list(topp=topp)), type="l"); plot(bob$y~bob$

Re: [Rd] substitute and expression (Peter Dalgaard)

2007-07-19 Thread Peter Dalgaard
John Maindonald wrote: > In this connection, note the following > > > a4 <- 4 > > plotThis <- bquote(alpha==.(a), list(a=a4)) > > do.call(plot, list(1:10, main=do.call(expression, c(plotThis > > do.call(plot, list(1:10, main=do.call(expression, plotThis))) > Error in do.call(expression, plo

Re: [Rd] substitute and expression (Peter Dalgaard)

2007-07-19 Thread John Maindonald
rote: > From: Peter Dalgaard <[EMAIL PROTECTED]> > Date: 18 July 2007 1:39:50 AM > To: Deepayan Sarkar <[EMAIL PROTECTED]> > Cc: R Development Mailing List <[EMAIL PROTECTED]> > Subject: Re: [Rd] substitute and expression > > > Deepayan Sarkar wro

Re: [Rd] substitute and expression

2007-07-17 Thread Peter Dalgaard
Deepayan Sarkar wrote: > On 7/16/07, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > >> Deepayan Sarkar wrote: >> >>> Hi, >>> >>> I'm trying to understand whether the use of substitute() is >>> appropriate/documented for plotmath annotation. The following two >>> calls give the same results: >>

Re: [Rd] substitute and expression

2007-07-16 Thread Deepayan Sarkar
On 7/16/07, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > Deepayan Sarkar wrote: > > Hi, > > > > I'm trying to understand whether the use of substitute() is > > appropriate/documented for plotmath annotation. The following two > > calls give the same results: > > > > > >> plot(1:10, main = expression

Re: [Rd] substitute and expression

2007-07-16 Thread Gabor Grothendieck
On 7/16/07, Deepayan Sarkar <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to understand whether the use of substitute() is > appropriate/documented for plotmath annotation. The following two > calls give the same results: > > > plot(1:10, main = expression(alpha == 1)) > > do.call(plot, list(1:10

Re: [Rd] substitute and expression

2007-07-16 Thread Peter Dalgaard
Deepayan Sarkar wrote: > Hi, > > I'm trying to understand whether the use of substitute() is > appropriate/documented for plotmath annotation. The following two > calls give the same results: > > >> plot(1:10, main = expression(alpha == 1)) >> do.call(plot, list(1:10, main = expression(alpha ==

[Rd] substitute and expression

2007-07-16 Thread Deepayan Sarkar
Hi, I'm trying to understand whether the use of substitute() is appropriate/documented for plotmath annotation. The following two calls give the same results: > plot(1:10, main = expression(alpha == 1)) > do.call(plot, list(1:10, main = expression(alpha == 1))) But not these two: > plot(1:10, m

Re: [Rd] substitute and S4 objects

2007-03-24 Thread John Chambers
First, by "doesn't work" you mean the printed output. The value returned is the same. Second, the problem is not a general one with S4 methods but with primitive functions. To see this, define a real function with a similar method: > setGeneric("foo", function(e1, e2) standardGeneric("foo")

[Rd] substitute and S4 objects

2007-03-24 Thread Franck Arnaud
Hi all, I don't understand why this does not what I expect : ## code start here ## setClass("num",representation(x="numeric")) num<-function(x) new("num",x=x) add<-function(e1,e2) { cat("Computing ",deparse(substitute(e1)),"+",deparse(substitute(e2)),"\n") [EMAIL PROTECTED]@x

Re: [Rd] substitute creates an object whichprints incorrectly (PR#9427)

2007-01-07 Thread Duncan Murdoch
to be to warn people that >> keep.source=TRUE >>>> can be dangerous in this way, both in the help informaton for >>>> options() and for substitute(). >>>> >>>> ? >>>> >>>> Bill Venables. >>>> >>&

Re: [Rd] substitute creates an object whichprints incorrectly (PR#9427)

2007-01-07 Thread Mark.Bravington
ton for > >> options() and for substitute(). > >> > >> ? > >> > >> Bill Venables. > >> > >> -Original Message- > >> From: Peter Dalgaard [mailto:[EMAIL PROTECTED] > >> Sent: Friday, 22 December 2006 9:47 PM > >> To

Re: [Rd] substitute creates an object which prints incorrectly (PR#9427)

2006-12-23 Thread Bill.Venables
[EMAIL PROTECTED] (i.e. I) wrote: > 3. Modify substitute() so that it strips source attributes (or anything > else apparently visible that it will not manipulate) from objects. > Sorry folks, too dangerous. (I concede this appears to be a bit of an > overkill, too.) Peter Dalgaard responded:

Re: [Rd] substitute creates an object which prints incorrectly (PR#9427)

2006-12-23 Thread murdoch
should strip them when code gets modified. Duncan Murdoch > >> Perhaps the compromise has to be to warn people that keep.source=TRUE >> can be dangerous in this way, both in the help informaton for options() >> and for substitute(). >> >> ? >> >> Bi

Re: [Rd] substitute creates an object which prints incorrectly (PR#9427)

2006-12-23 Thread Duncan Murdoch
should strip them when code gets modified. Duncan Murdoch > >> Perhaps the compromise has to be to warn people that keep.source=TRUE >> can be dangerous in this way, both in the help informaton for options() >> and for substitute(). >> >> ? >> >> Bi

Re: [Rd] substitute creates an object which prints incorrectly (PR#9427)

2006-12-23 Thread Peter Dalgaard
be dangerous in this way, both in the help informaton for options() > and for substitute(). > > ? > > Bill Venables. > > -Original Message- > From: Peter Dalgaard [mailto:[EMAIL PROTECTED] > Sent: Friday, 22 December 2006 9:47 PM > To: Venables, Bill (CMIS, Cleve

Re: [Rd] substitute creates an object which prints incorrectly (PR#9427)

2006-12-22 Thread Bill.Venables
Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Friday, 22 December 2006 9:47 PM To: Venables, Bill (CMIS, Cleveland) Cc: r-devel@stat.math.ethz.ch; [EMAIL PROTECTED] Subject: Re: [Rd] substitute creates an object which prints incorrectly (PR#9427) [EMAIL PROTECTED] wrote: > The function &qu

Re: [Rd] substitute creates an object which prints incorrectly (PR#9427)

2006-12-22 Thread Gabor Grothendieck
Try issuing the command: options(keep.source = FALSE) prior to running the code you displayed to force the actual source, rather than the source attribute, to be displayed by print when printing functions. On 12/21/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > The function "substitute" s

Re: [Rd] substitute creates an object which prints incorrectly (PR#9427)

2006-12-22 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote: > The function "substitute" seems to fail to make a genuine > substitution, although the printed verision seems fine. Here is an > example. > > >> m <- substitute(Y <- function(x) FUN(x+1), >> > + list(Y = as.name("y"), FUN = as.name("sin"))) > >> m >> > y

[Rd] substitute creates an object which prints incorrectly (PR#9427)

2006-12-22 Thread Bill . Venables
The function "substitute" seems to fail to make a genuine substitution, although the printed verision seems fine. Here is an example. > m <- substitute(Y <- function(x) FUN(x+1), + list(Y = as.name("y"), FUN = as.name("sin"))) > m y <- function(x) sin(x + 1) > eval(m) > y function(x) FUN(x+1) H

Re: [Rd] substitute(INDICES) in by.data.frame returns invalid multi-line (PR#9109)

2006-07-28 Thread murdoch
On 7/28/2006 7:53 AM, [EMAIL PROTECTED] wrote: > Full_Name: Philip Kensche > Version: 2.3.0 This version is obsolete, but the error does occur in the current R-patched. > OS: Redhat Linux > Submission from: (NULL) (131.174.88.204) > > > Try this: > > -- > x <- data.frame(the.first.column=c("A"

Re: [Rd] substitute(INDICES) in by.data.frame returns invalid multi-line name (PR#9108)

2006-07-28 Thread Duncan Murdoch
On 7/28/2006 7:53 AM, [EMAIL PROTECTED] wrote: > Full_Name: Philip Kensche > Version: 2.3.0 This version is obsolete, but the error does occur in the current R-patched. > OS: Redhat Linux > Submission from: (NULL) (131.174.88.204) > > > Try this: > > -- > x <- data.frame(the.first.column=c("A"

[Rd] substitute(INDICES) in by.data.frame returns invalid multi-line name (PR#9108)

2006-07-28 Thread pkensche
Full_Name: Philip Kensche Version: 2.3.0 OS: Redhat Linux Submission from: (NULL) (131.174.88.204) Try this: -- x <- data.frame(the.first.column=c("A"), the.second.column=c("b"), the.third.column=c("d"), and.many.more.columns=c("e")) by(x, paste(x$the.first.column, x$the.second.column, x$and.ma

Re: [Rd] Substitute() changed since R2.3.0 (2006-02-02 r37243)?

2006-04-03 Thread Duncan Murdoch
On 4/3/2006 8:08 AM, Henrik Bengtsson wrote: > Follow up: I've downloaded todays R v2.3.0 alpha (2006-04-02 r37626) > for Windows and the below bug has been fixed: > >> yaa <- function(...) substitute(list(...)) >> yaa(foo(x,y,...,z)) > list(foo(x, y, ..., z)) > > Thank you (Duncan!?) Yes, I th

Re: [Rd] Substitute() changed since R2.3.0 (2006-02-02 r37243)?

2006-04-03 Thread Henrik Bengtsson
Follow up: I've downloaded todays R v2.3.0 alpha (2006-04-02 r37626) for Windows and the below bug has been fixed: > yaa <- function(...) substitute(list(...)) > yaa(foo(x,y,...,z)) list(foo(x, y, ..., z)) Thank you (Duncan!?) Henrik On 3/29/06, Henrik Bengtsson <[EMAIL PROTECTED]> wrote: > On

Re: [Rd] substitute() bug by you ? [forwarded]

2006-03-29 Thread Duncan Murdoch
e --- > From: Peter Dalgaard <[EMAIL PROTECTED]> > To: "Henrik Bengtsson" <[EMAIL PROTECTED]> > Cc: r-devel@r-project.org > Subject: Re: [Rd] Substitute() changed since R2.3.0 (2006-02-02 r37243)? > Date: 29 Mar 2006 11:58:34 +0200 > > "Henrik

Re: [Rd] Substitute() changed since R2.3.0 (2006-02-02 r37243)?

2006-03-29 Thread Henrik Bengtsson
On 29 Mar 2006 11:58:34 +0200, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > "Henrik Bengtsson" <[EMAIL PROTECTED]> writes: > > > Hi, > > > > I've got the following two versions of R on WinXP: > > > > A) R Version 2.3.0 Under development (unstable) (2006-02-02 r37243) > > B) R Version 2.3.0 Under dev

Re: [Rd] Substitute() changed since R2.3.0 (2006-02-02 r37243)?

2006-03-29 Thread Peter Dalgaard
"Henrik Bengtsson" <[EMAIL PROTECTED]> writes: > Hi, > > I've got the following two versions of R on WinXP: > > A) R Version 2.3.0 Under development (unstable) (2006-02-02 r37243) > B) R Version 2.3.0 Under development (unstable) (2006-03-27 r37579) > > and a the following "test.R" script: > >

[Rd] Substitute() changed since R2.3.0 (2006-02-02 r37243)?

2006-03-29 Thread Henrik Bengtsson
Hi, I've got the following two versions of R on WinXP: A) R Version 2.3.0 Under development (unstable) (2006-02-02 r37243) B) R Version 2.3.0 Under development (unstable) (2006-03-27 r37579) and a the following "test.R" script: foo <- function(path, ...) { print(path) } bar <- function(x, ...)