Skip to content

Instantly share code, notes, and snippets.

@moodymudskipper
Created November 8, 2022 11:40
Show Gist options
  • Save moodymudskipper/419fa172e4c60816c7f3e8bef5f61cfd to your computer and use it in GitHub Desktop.
Save moodymudskipper/419fa172e4c60816c7f3e8bef5f61cfd to your computer and use it in GitHub Desktop.
RStudio options
# after a fresh RStudio start on an empty RProfile, not done with {reprex} so we don't pollute options more
rstudio <- options()
# Thanks @gaborcsardy
callr <- callr::r(function(libs) {
lapply(libs, library, character.only = TRUE)
options()
}, list (libs = sub("^package:", "", grep("^package:", search(), value = TRUE))))
callr_only <- setdiff(names(callr), names(rstudio))
callr_only
#> [1] "callr.rprofile_loaded" "error" "showErrorCalls"
rstudio_only <- setdiff(names(rstudio), names(callr))
#> [1] "askpass" "asksecret" "buildtools.check" "buildtools.with" "connectionObserver"
#> [6] "deparse.max.lines" "download.file.method" "ggvis.renderer" "help_type" "page_viewer"
#> [11] "plumber.docs.callback" "plumber.swagger.url" "profvis.keep_output" "profvis.print" "profvis.prof_extension"
#> [16] "profvis.prof_output" "restart" "reticulate.initialized" "reticulate.repl.busy" "reticulate.repl.hook"
#> [21] "reticulate.repl.initialize" "reticulate.repl.teardown" "rstudio.notebook.executing" "RStudioGD.antialias" "RStudioGD.backend"
#> [26] "shiny.launch.browser" "shinygadgets.showdialog" "terminal.manager" "viewer"
common <- intersect(names(rstudio), names(callr))
diffs <- sapply(common, function(x) if(!identical(rstudio[[x]], callr[[x]], ignore.environment = TRUE)) list(rstudio = rstudio[[x]], callr = callr[[x]]))
diffs <- Filter(Negate(is.null), diffs)
do.call(rbind, diffs) # "?" means it's a function
# rstudio callr
# browser ? "false"
# device "RStudioGD" ?
# echo TRUE FALSE
# HTTPUserAgent "RStudio Desktop (2022.7.2.576); R (4.2.1 aarch64-apple-darwin20 aarch64 darwin20)" "R (4.2.1 aarch64-apple-darwin20 aarch64 darwin20)"
# keep.source TRUE FALSE
# max.print 1000 99999
# menu.graphics FALSE TRUE
# pager ? "/Library/Frameworks/R.framework/Resources/bin/pager"
# pdfviewer "/usr/bin/open" "false"
# width 154 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment