Re: [R] Logical operators and named arguments

2014-08-09 Thread Prof Brian Ripley
On 09/08/2014 01:10, Joshua Wiley wrote: On Sat, Aug 9, 2014 at 9:56 AM, Patrick Burns wrote: On 07/08/2014 07:21, Joshua Wiley wrote: Hi Ryan, It does work, but the *apply family of functions always pass to the first argument, so you can specify e2 = , but not e1 =. For example: sapply

Re: [R] Logical operators and named arguments

2014-08-08 Thread Patrick Burns
On 07/08/2014 07:21, Joshua Wiley wrote: Hi Ryan, It does work, but the *apply family of functions always pass to the first argument, so you can specify e2 = , but not e1 =. For example: sapply(1:3, `>`, e2 = 2) [1] FALSE FALSE TRUE That is not true: gt <- function(x, y) x > y > sapply(

Re: [R] Logical operators and named arguments

2014-08-08 Thread Joshua Wiley
On Sat, Aug 9, 2014 at 9:56 AM, Patrick Burns wrote: > On 07/08/2014 07:21, Joshua Wiley wrote: > >> Hi Ryan, >> >> It does work, but the *apply family of functions always pass to the first >> argument, so you can specify e2 = , but not e1 =. For example: >> >> sapply(1:3, `>`, e2 = 2) >>> >> [

Re: [R] Logical operators and named arguments

2014-08-07 Thread Ryan
Josh, Thank you for your detailed answer. Best, Ryan On 7 Aug 2014, at 16:21, Joshua Wiley wrote: > Hi Ryan, > > It does work, but the *apply family of functions always pass to the first > argument, so you can specify e2 = , but not e1 =. For example: > >> sapply(1:3, `>`, e2 = 2) > [1] FALSE

Re: [R] Logical operators and named arguments

2014-08-06 Thread Joshua Wiley
Hi Ryan, It does work, but the *apply family of functions always pass to the first argument, so you can specify e2 = , but not e1 =. For example: > sapply(1:3, `>`, e2 = 2) [1] FALSE FALSE TRUE >From ?sapply 'lapply' returns a list of the same length as 'X', each element of which is

[R] Logical operators and named arguments

2014-08-06 Thread Ryan
Hi, I'm wondering why calling ">" with named arguments doesn't work as expected: > args(">") function (e1, e2) NULL > sapply(c(1,2,3), `>`, e2=0) [1] TRUE TRUE TRUE > sapply(c(1,2,3), `>`, e1=0) [1] TRUE TRUE TRUE Shouldn't the latter be FALSE? Thanks for any help, Ryan The information in