This is similar to the standard in the as.list method for the environment class. The standard argument is all.names = FALSE . From ?as.list :
all.names - a logical indication whether to copy all values ββor (by default) only those whose names do not start with a period.
You can change the within.data.frame method to the following:
within.data.frame <- function (data, expr, ...) { parent <- parent.frame() e <- evalq(environment(), data, parent) eval(substitute(expr), e)
Then you get the expected behavior:
within(A, new <- .has.a.dot) ## .has.a.dot has.no.dot new ## 1 1 a 1 ## 2 2 b 2 ## 3 3 c 3 ## 4 4 d 4 ## 5 5 e 5 ## 6 6 f 6 ## 7 7 g 7 ## 8 8 h 8 ## 9 9 i 9 ## 10 10 j 10
source share