In my .Rprofile, I have the following two lines defined in my .First
makeActiveBinding(".refresh", function() { system("R"); q("no") }, .GlobalEnv)
makeActiveBinding('.rm', function() {rm(list=ls(envir = .GlobalEnv),envir=.GlobalEnv); gc()}, .GlobalEnv)
They are usually harmless unless I accidentally type them! The first makes a function .refreshthat will stop and restart the R session. The second empties the global environment. However, when using a function tables()from data.tablethese two functions are performed, which is not entirely desirable.
At the moment, I removed them from .Firstmine, but I'm curious if there is a way to avoid this. Offensive lines in a function tables():
tt = objects(envir = env, all.names = TRUE)
ss = which(as.logical(sapply(tt, function(x) is.data.table(get(x,
envir = env)))))
source
share