Wishlist-for-R
Wishlist-for-R copied to clipboard
Disable View() in non-interactive mode
It seems that View()
should behave differently if invoked in non-interactive mode. It could return NULL
without opening the spreadsheet window. Maybe something like this (exact logic may need to be adapted given that I don't know enough about how/where the environment variable _R_CHECK_SCREEN_DEVICE_
is used):
From 1d656101ae213fc05216230615bb897a633fabab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Michonneau?= <[email protected]>
Date: Tue, 17 Apr 2018 09:35:56 -0400
Subject: [PATCH] disable View in non-interactive mode
---
src/library/utils/R/edit.R | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/library/utils/R/edit.R b/src/library/utils/R/edit.R
index ee562d4ff5..fe3c854507 100644
--- a/src/library/utils/R/edit.R
+++ b/src/library/utils/R/edit.R
@@ -56,6 +56,8 @@ View <- function (x, title)
stop(msg, domain = NA)
else if (identical(check, "warn"))
warning(msg, immediate. = TRUE, noBreaks. = TRUE, domain = NA)
+ else if (!interactive())
+ return(NULL)
## could multi-line deparse with maliciously-designed inputs
if(missing(title)) title <- paste("Data:", deparse(substitute(x))[1])
--
2.17.0