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

2016-06-28 Thread Duncan Murdoch
On 28/06/2016 1:15 PM, Duncan Murdoch wrote: I've now added a simple implementation of hasName to R-devel and R-patched. When I find the time, I'll go through the base packages and change the !is.null(x$name) idiom to hasName. (All but "base", that is: hasName is in utils, and it is better if

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

2016-06-28 Thread Duncan Murdoch
I've now added a simple implementation of hasName to R-devel and R-patched. When I find the time, I'll go through the base packages and change the !is.null(x$name) idiom to hasName. (All but "base", that is: hasName is in utils, and it is better if base remains self-contained.) If any bottl

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

2016-06-28 Thread Duncan Murdoch
s -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com <mailto:murdoch.dun...@gmail.com>] Sent: Monday, June 27, 2016 12:50 PM To: Hadley Wickham mailto:h.wick...@gmail.com>>; Lenth, Russell V mailto:russell-le...@uio

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

2016-06-28 Thread William Dunlap
ailto:murdoch.dun...@gmail.com] >> Sent: Monday, June 27, 2016 12:50 PM >> To: Hadley Wickham ; Lenth, Russell V < >> russell-le...@uiowa.edu> >> Cc: r-package-devel@r-project.org >> Subject: Re: [R-pkg-devel] Absent variables and tibble >> >> On 27/

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

2016-06-28 Thread Duncan Murdoch
ct: Re: [R-pkg-devel] Absent variables and tibble 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

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

2016-06-27 Thread Lenth, Russell V
vel@r-project.org Subject: Re: [R-pkg-devel] Absent variables and tibble 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) > #> [

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 som

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 27,

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

2016-06-27 Thread Duncan Murdoch
On 27/06/2016 10:46 AM, Hadley Wickham wrote: 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 "[[

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 and

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 wrote: > > On M

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 for 'tbl_df' objects - as d

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 - a

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 proble