Re: [Rd] named arguments discouraged in `[.data.frame` and `[<-.data.frame`

2018-11-29 Thread Henrik Pärn
that `[.data.frame` and >`[<-.data.frame` are _not_ primitive functions, positional matching is done >there as well. Sometimes. At least when 'x' argument is not first, as shown in >Bill's examples. Obviously my "test" was insufficient... > >Cheers, > >Henrik

Re: [Rd] named arguments discouraged in `[.data.frame` and `[<-.data.frame`

2018-11-29 Thread Emil Bode
From: William Dunlap Sent: Wednesday, November 28, 2018 9:10 PM To: Henrik Pärn Cc: r-devel@r-project.org Subject: Re: [Rd] named arguments discouraged in `[.data.frame` and `[<-.data.frame` They can get bitten in the last two lines of this exa

Re: [Rd] named arguments discouraged in `[.data.frame` and `[<-.data.frame`

2018-11-29 Thread Henrik Pärn
there as well. Sometimes. At least when 'x' argument is not first, as shown in Bill's examples. Obviously my "test" was insufficient... Cheers, Henrik From: William Dunlap Sent: Wednesday, November 28, 2018 9:10 PM To: Henrik Pärn Cc: r-devel@r-project.org Subject: Re: [Rd] na

Re: [Rd] named arguments discouraged in `[.data.frame` and `[<-.data.frame`

2018-11-28 Thread William Dunlap via R-devel
They can get bitten in the last two lines of this example, where the 'x' argument is not first: > d <- data.frame(C1=c(r1=11,r2=21,r3=31), C2=c(12,22,32)) > d[1,1:2] C1 C2 r1 11 12 > `[`(d,j=1:2,i=1) C1 C2 r1 11 12 Warning message: In `[.data.frame`(d, j = 1:2, i = 1) : named arguments

Re: [Rd] named arguments discouraged in `[.data.frame` and `[<-.data.frame`

2018-11-28 Thread Michael Lawrence
Whenever they are calling a primitive, because primitives match arguments positionally. Of course, you then you need to introduce the concept of a primitive. You could also make an argument from the code clarity perspective, as typically primitives have simple interfaces and/or are used

[Rd] named arguments discouraged in `[.data.frame` and `[<-.data.frame`

2018-11-28 Thread Henrik Pärn
tl;dr: Why are named arguments discouraged in `[.data.frame`, `[<-.data.frame` and `[[.data.frame`? (because this question is of the kind 'why is R designed like this?', I though R-devel would be more appropriate than R-help) # Background: Now and then students