Skip to content

Commit f7be165

Browse files
push isNamespace check into helper
1 parent c43cee8 commit f7be165

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

R/cedta.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ cedta.pkgEvalsUserCode = c("gWidgetsWWW","statET","FastRWeb","slidify","rmarkdow
5252
# in a helper to promote readability
5353
# NB: put the most common and recommended cases first for speed
5454
.cedta_impl_ <- function(ns, n) {
55+
if (!isNamespace(ns)) {
56+
# e.g. DT queries at the prompt (.GlobalEnv) and knitr's eval(,envir=globalenv()) but not DF[...] inside knitr::kable v1.6
57+
return(TRUE)
58+
}
59+
5560
nsname = getNamespaceName(ns)
5661
if (nsname == "data.table") return(TRUE)
5762

@@ -90,10 +95,6 @@ cedta = function(n=2L) {
9095
return(env$.datatable.aware)
9196
}
9297
ns = topenv(env)
93-
if (!isNamespace(ns)) {
94-
# e.g. DT queries at the prompt (.GlobalEnv) and knitr's eval(,envir=globalenv()) but not DF[...] inside knitr::kable v1.6
95-
return(TRUE)
96-
}
9798
ans = .cedta_impl_(ns, n)
9899
if (!ans && getOption("datatable.verbose")) {
99100
# nocov start

0 commit comments

Comments
 (0)