Re: [R] Subset with missing argument within a function

2016-02-05 Thread William Dunlap via R-help
uot; "b" "e" >>> > > letters[] >>> > [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n&quo

Re: [R] Subset with missing argument within a function

2016-02-04 Thread Stefano de Pretis
quot; "e" >> > > letters[] >> > [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" >

[R] Subset with missing argument within a function

2016-02-04 Thread Stefano de Pretis
Hi all, I'm guessing what's the rationale behind this: > subsettingFun <- function(vec, ix) vec[ix] > subsettingFun(letters, c(1,2,5)) [1] "a" "b" "e" > subsettingFun(letters) [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" [20] "t" "u" "v" "w" "x" "y" "z" If

Re: [R] Subset with missing argument within a function

2016-02-04 Thread PIKAL Petr
the check yourself and not rely on programming language. And BTW I did not know an answer before I inspected docs. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Stefano > de Pretis > Sent: Thursday, February 04, 2016 11:00

Re: [R] Subset with missing argument within a function

2016-02-04 Thread William Dunlap via R-help
" "y" "z" > > > > It is sometimes useful not "expect" the program behavior but "inspect" > why > > it behaves differently. > > > > If you want your function to throw error when some arguments are missing > > you

Re: [R] Subset with missing argument within a function

2016-02-04 Thread Stefano de Pretis
"x" "y" "z" > > It is sometimes useful not "expect" the program behavior but "inspect" why > it behaves differently. > > If you want your function to throw error when some arguments are missing > you need to do the check yourself a