Created
June 27, 2022 23:50
-
-
Save MilesMcBain/d2599f31e187ead226aa1b2355efbe15 to your computer and use it in GitHub Desktop.
cloud_view()
This file contains hidden or 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
cloud_view <- function(obj) { | |
withr::with_options( | |
list(viewer = function(url, ...) { | |
get_url_dir <- function(url) gsub("file://|/index.html", "", url) | |
server <- servr::httd( | |
dir = get_url_dir(url), | |
verbose = TRUE, | |
browser = FALSE | |
) | |
.vsc.browser(server$url, ...) | |
}), | |
print(obj) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I assume there was a reason I didn't just set the
viewer
option to this in my remote.Rprofile
, I suspect it's to do with wanting to avoid messing with other things that do work fine, like Shiny apps, but I can't remember.