Re: [Rd] A trap for young players with the lapply() function.

2017-03-29 Thread Rolf Turner
On 29/03/17 20:32, Enrico Schumann wrote: (inline) On Tue, 28 Mar 2017, Rolf Turner writes: On 28/03/17 04:21, Barry Rowlingson wrote: On Mon, Mar 27, 2017 at 1:17 AM, Rolf Turner wrote: Is there any way to trap/detect the use of an optional argument called "X" and thereby issue a more per

Re: [Rd] A trap for young players with the lapply() function.

2017-03-29 Thread Enrico Schumann
(inline) On Tue, 28 Mar 2017, Rolf Turner writes: > On 28/03/17 04:21, Barry Rowlingson wrote: >> On Mon, Mar 27, 2017 at 1:17 AM, Rolf Turner wrote: >>> >>> Is there any way to trap/detect the use of an optional argument called >>> "X" and thereby issue a more perspicuous error message? >>> >>>

Re: [Rd] A trap for young players with the lapply() function.

2017-03-28 Thread Rolf Turner
On 29/03/17 11:03, William Dunlap wrote: I think that the suggestion I made, in response to a posting by Barry Rowlingson, that the first argument of lapply() be given the name of ".X" rather than just-plain-X, would be (a) effective, and (b) harmless. It would break any call to *apply() that

Re: [Rd] A trap for young players with the lapply() function.

2017-03-28 Thread William Dunlap via R-devel
>I think that the suggestion I made, in response to a posting by Barry >>Rowlingson, that the first argument of lapply() be given the name of ".X" >rather >than just-plain-X, would be (a) effective, and (b) harmless. It would break any call to *apply() that used X= to name the first argument. T

Re: [Rd] A trap for young players with the lapply() function.

2017-03-28 Thread Rolf Turner
On 28/03/17 15:26, Charles C. Berry wrote: On Mon, 27 Mar 2017, Rolf Turner wrote: From time to time I get myself into a state of bewilderment when using apply() by calling it with FUN equal to a function which has an "optional" argument named "X". E.g. xxx <- lapply(y,function(x,X){cos(x

Re: [Rd] A trap for young players with the lapply() function.

2017-03-27 Thread Charles C. Berry
On Mon, 27 Mar 2017, Rolf Turner wrote: From time to time I get myself into a state of bewilderment when using apply() by calling it with FUN equal to a function which has an "optional" argument named "X". E.g. xxx <- lapply(y,function(x,X){cos(x*X)},X=2*pi) which produces the error mes

Re: [Rd] A trap for young players with the lapply() function.

2017-03-27 Thread Rolf Turner
On 28/03/17 04:21, Barry Rowlingson wrote: On Mon, Mar 27, 2017 at 1:17 AM, Rolf Turner wrote: Is there any way to trap/detect the use of an optional argument called "X" and thereby issue a more perspicuous error message? This would be helpful to those users who, like myself, are bears of ver

Re: [Rd] A trap for young players with the lapply() function.

2017-03-27 Thread Barry Rowlingson
On Mon, Mar 27, 2017 at 1:17 AM, Rolf Turner wrote: > > Is there any way to trap/detect the use of an optional argument called > "X" and thereby issue a more perspicuous error message? > > This would be helpful to those users who, like myself, are bears of very > little brain. > > Failing that (it

[Rd] A trap for young players with the lapply() function.

2017-03-26 Thread Rolf Turner
From time to time I get myself into a state of bewilderment when using apply() by calling it with FUN equal to a function which has an "optional" argument named "X". E.g. xxx <- lapply(y,function(x,X){cos(x*X)},X=2*pi) which produces the error message Error in get(as.character(FUN), mo