Re: [R-pkg-devel] Absent variables and tibble

2016-06-27 Thread Lenth, Russell V
Hadley's note on partial matching has me scared the most concerning the as.null() coding. So the need for a hasName() (or whatever) function seems all the more compelling, and that it be in base R. Perhaps it should be generic, with a default method that searches in the names attribute,

Re: [R-pkg-devel] Force namespace prefix for a loaded package function

2016-06-27 Thread Duncan Murdoch
On 27/06/2016 5:46 PM, Tim Keitt wrote: http://www.keittlab.org/ On Mon, Jun 27, 2016 at 10:19 AM, Duncan Murdoch > wrote: On 27/06/2016 11:08 AM, Tim Keitt wrote: http://www.keittlab.org/ On Mon, Jun 27, 2016

Re: [R-pkg-devel] Absent variables and tibble

2016-06-27 Thread Duncan Murdoch
On 27/06/2016 1:09 PM, Hadley Wickham wrote: The other thing you need to be aware of it you're using the other approach is partial matching: df <- data.frame(xyz = 1) is.null(df$x) #> [1] FALSE Duncan - I think that argues for including a has_name() (hasName() ?) function in base R. Is that

Re: [R-pkg-devel] Absent variables and tibble

2016-06-27 Thread Hadley Wickham
The other thing you need to be aware of it you're using the other approach is partial matching: df <- data.frame(xyz = 1) is.null(df$x) #> [1] FALSE Duncan - I think that argues for including a has_name() (hasName() ?) function in base R. Is that something you'd consider? Hadley On Mon, Jun

Re: [R-pkg-devel] Absent variables and tibble

2016-06-27 Thread Thierry Onkelinx
Dear Russell. The assertthat package (by Hadley) provides a has_name() function. > library(assertthat) > x <- data.frame(y = NA) > has_name(x, "y") [1] TRUE > has_name(x, "x") [1] FALSE Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature

Re: [R-pkg-devel] Force namespace prefix for a loaded package function

2016-06-27 Thread Tim Keitt
http://www.keittlab.org/ On Mon, Jun 27, 2016 at 3:22 AM, Joris Meys wrote: > If you want to call a non exported function, you need three colons > > X:::f () > > And frankly, that is a bad idea. > I think you missed the point (and stated the obvious). A well-designed

Re: [R-pkg-devel] Absent variables and tibble

2016-06-27 Thread Lenth, Russell V
Thanks, Hadley. I do understand why you'd want more careful checking. If you're going to provide a variable-existing function, may I suggest a short name like 'has'? I.e., has(x, var) returns TRUE if x has var in it. Thanks Russ > On Jun 27, 2016, at 9:47 AM, Hadley Wickham

Re: [R-pkg-devel] Absent variables and tibble

2016-06-27 Thread Hadley Wickham
On Mon, Jun 27, 2016 at 9:03 AM, Duncan Murdoch wrote: > On 27/06/2016 9:22 AM, Lenth, Russell V wrote: >> >> My package 'lsmeans' is now suddenly broken because of a new provision in >> the 'tibble' package (loaded by 'dplyr' 0.5.0), whereby the "[[" and "$" >> methods

Re: [R-pkg-devel] Absent variables and tibble

2016-06-27 Thread Johannes Ranke
Am Montag, 27. Juni 2016, 10:03:35 schrieb Duncan Murdoch: > On 27/06/2016 9:22 AM, Lenth, Russell V wrote: > > My package 'lsmeans' is now suddenly broken because of a new provision in > > the 'tibble' package (loaded by 'dplyr' 0.5.0), whereby the "[[" and "$" > > methods for 'tbl_df' objects -

Re: [R-pkg-devel] Absent variables and tibble

2016-06-27 Thread Duncan Murdoch
On 27/06/2016 9:22 AM, Lenth, Russell V wrote: My package 'lsmeans' is now suddenly broken because of a new provision in the 'tibble' package (loaded by 'dplyr' 0.5.0), whereby the "[[" and "$" methods for 'tbl_df' objects - as documented - throw an error if a variable is not found. The