This has so far worked fine, but I've recently started writing my own package, in which many functions return data.table objects. When I call these functions from a script in my package directory, my custom print.data.table function isn't used, but the original one provided by data.table.
fx <- function() {
as.data.table(mtcars)
}
calling fx from a script file (with ess-eval-line/C-j) doesn't apply my custom print.data.table function (output below).
This is also the output I get when calling it from a script file which is not inside a package directory.
When calling fx() from a script, there are also two chevrons (">") in the terminal output. However, this seems to be at most a side effect, since when I execute a region I get a single chevron for each statement, but still my print.data.table function isn't used:
Turning off ess-r-package-mode doesn't change this, nor does setting ess-r-package-auto-activate or ess-r-package-auto-enable-namespaced-evaluation to nil, and in Rstudio this problem does not occur. I have for now recompiled data.table with my print.data.table function instead of the original function (which isn't a big hassle since there are few data.table updates these days), but it's still a hacky band aid. Any ideas of what's going here or how to fix this?
I'm using a custom function for printing
data.table
objects, which basically prints them with the formatting of tibbles.This has so far worked fine, but I've recently started writing my own package, in which many functions return
data.table
objects. When I call these functions from a script in my package directory, my customprint.data.table
function isn't used, but the original one provided bydata.table
.calling
fx
from a script file (withess-eval-line
/C-j
) doesn't apply my customprint.data.table
function (output below).However, calling it in terminal/R process buffer directly applies my
print.data.table
function correctly:This is also the output I get when calling it from a script file which is not inside a package directory.
When calling
fx()
from a script, there are also two chevrons (">") in the terminal output. However, this seems to be at most a side effect, since when I execute a region I get a single chevron for each statement, but still myprint.data.table
function isn't used:results in
Turning off
ess-r-package-mode
doesn't change this, nor does settingess-r-package-auto-activate
oress-r-package-auto-enable-namespaced-evaluation
to nil, and inRstudio
this problem does not occur. I have for now recompileddata.table
with myprint.data.table
function instead of the original function (which isn't a big hassle since there are fewdata.table
updates these days), but it's still a hacky band aid. Any ideas of what's going here or how to fix this?