Skip to content
Prev 57663 / 63421 Next

Puzzled about a new method for "[".

On 4/11/19 10:31 AM, Duncan Murdoch wrote:

            
OK.  As I understand what you're saying, the reason there isn't a
"no visible binding" problem in [.data.frame is that "cols" *is* defined
in the body of the function.  Whereas, in my method, "cols" does not get
defined anywhere in the function, and thus triggers the warning.

I guess that a workaround would be to do a dummy assignment, like unto
cols <- 42 at the start of the code for my method.

(a) Are there perils involved with this strategy?

(b) Is there anything wrong with my current strategy of replacing

    drop = if (missing(i)) TRUE else length(cols) == 1)

by

    drop = if (missing(i)) TRUE else length(j) == 1)

???

As I said, this *seems* to work OK, by I cannot work through what the 
implications might be.

Can anyone reassure me?

cheers,

Rolf