Last active
June 1, 2018 17:51
-
-
Save hrbrmstr/c07ddf290369d954a54443b6b09faae3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options(viewer = function (url, height = NULL, append=FALSE) { | |
# USE AN ENVIRONMENT SEPARATE FROM GLOBAL BUT ACCESSIBLE | |
# THIS WILL MAINTAIN CURRENT OUTPUT FILE LOCATION | |
# IF append IS TRUE THEN INSERT THE NEW HTML AT THE END OF THE FILE | |
# THERE ARE LOTS OF WAYS TO DO THIS. ONE IS IFRAME-ing EACH AS THEY | |
# ARE APPENDED. ANOTHER IS TO JUST SMUSH THEM ALL TOGETHER | |
# MAKE url THE FILE WE JUST MODIFIED | |
# IF append=FALSE DON'T WORRY ABOUT ANYTHING AND JUST USE url | |
# THE REST OF THE CODE STAYS PRETTY MUCH THE SAME | |
if (!is.character(url) || (length(url) != 1)) | |
stop("url must be a single element character vector.", | |
call. = FALSE) | |
if (identical(height, "maximize")) | |
height <- -1 | |
if (!is.null(height) && (!is.numeric(height) || (length(height) != | |
1))) | |
stop("height must be a single element numeric vector or 'maximize'.", | |
call. = FALSE) | |
invisible(.Call("rs_viewer", url, height)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment