Last active
March 3, 2016 21:41
-
-
Save hafen/6f27fa298dbeda43ca77 to your computer and use it in GitHub Desktop.
addCallback for rmote
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
my_callback <- function(expr, value, ok, visible) { | |
if(inherits(value, "help_files_with_topic")) { | |
message("I'm doing one more thing with this help object...") | |
# do rmote serving stuff... | |
# except the default print method has already been called | |
# which if help_type == "text" will defeat the purpose of rmote | |
# and if help_type == "html" will result in something like | |
# "Error: no display specified" on a headless linux system | |
} else if(inherits(value, "htmlwidget")) { | |
message("I'm doing one more thing with this htmlwidget...") | |
# do rmote serving stuff... | |
# except the default print method has already been called | |
# which on a headless linux system will usually return an error like | |
# "Error: no display specified" | |
} else if(inherits(value, c("trellis", "ggplot2"))) { | |
message("I'm doing one more thing with this lattice/ggplot2 object...") | |
# do rmote serving stuff... | |
# this one works okay although the plot will be printed twice | |
} | |
TRUE | |
} | |
addTaskCallback(my_callback) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment