r - Platform-dependent data output -
in order aid myself displaying debugging information, decided create following tiny function dynamically switch between displaying data in rstudio's internal data browser , simple character-based output, depending on capabilities of platform, modules being sourced at:
view <- function (...) { if (.platform$gui == "rstudio") view(...) else print(...) }
this function located, along other utility functions, in module <proj_home>/utils/debug.r
. modules need these functions, include via source("../utils/debug.r")
.
running project's code on amazon ec2 instance's linux console fine. however, running on same virtual machine via rstudio server results in following error message:
error: evaluation nested deeply: infinite recursion / options(expressions=)? error during wrapup: evaluation nested deeply: infinite recursion / options(expressions=)?
it seems me r gets confused view()
function needs called. initially, assumed rstudio overloads utils::view()
, tried call explicitly, failed. thought rstudio somehow defines view()
implementation in global environment, needs called view()
without package/library reference. however, see, doesn't work either. potential reason of error might overestimated "smartness" of r in terms of use of ...
arguments.
so, wrong , how fix it?
rstudio hooks view
function. 1 approach might see if has overridden view function utils, , call override if exists. this?
view <- if (identical(utils::view, view)) print else view
Comments
Post a Comment