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
{'StringIO': <module 'StringIO' from '/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/StringIO.pyc'>, | |
'UserDict': <module 'UserDict' from '/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.pyc'>, | |
'__builtin__': <module '__builtin__' (built-in)>, | |
'__future__': <module '__future__' from '/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/__future__.pyc'>, | |
'__main__': <module '__main__' (built-in)>, | |
'_abcoll': <module '_abcoll' from '/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_abcoll.pyc'>, | |
'_ast': <module '_ast' (built-in)>, | |
'_codecs': <module '_codecs' (built-in)>, | |
'_collections': <module '_collections' from '/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_collections.so'>, | |
'_ctypes': <module '_ctypes' from '/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ctypes.so'>, |
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
Homebrew build logs for llvm on macOS 10.12.5 | |
Build date: 2017-07-01 09:17:42 |
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
# Place this in a file at '~/.Rprofile' to ensure it's sourced on startup | |
.First <- function() { | |
# RStudio-specific startup | |
if (!is.na(Sys.getenv("RSTUDIO", unset = NA)) && | |
Sys.info()[["sysname"]] == "Windows") | |
{ | |
# work around mis-encoded environment variables | |
USERPROFILE <- Sys.getenv("USERPROFILE") | |
HOME <- file.path(USERPROFILE, "Documents", fsep = "\\") | |
R_USER <- HOME |
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
library(shiny) | |
## Example | |
# shinyServer(function(input, output) { | |
# output$value <- renderPrint({ input$sliderId }) | |
# }) | |
## uiOutput | |
shinyServer(function(input, output) { | |
output$slider <- renderUI({ |
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
setGeneric("plot", function(x, ...) { | |
standardGeneric("plot") | |
}) | |
setMethod("plot", list(x = "ANY"), function(x, ...) { | |
UseMethod("plot") | |
}) |
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
enumerate <- function(X, FUN, ...) { | |
result <- vector("list", length(X)) | |
for (i in seq_along(result)) { | |
tmp <- FUN(X[[i]], i, ...) | |
if (is.null(tmp)) | |
result[i] <- list(NULL) | |
else | |
result[[i]] <- tmp | |
} | |
result |
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
otool <- Sys.which("otool") | |
if (otool == "") { | |
stop("This utility requires 'otool' to run") | |
} | |
allPackages <- list.files(.libPaths(), full.names = TRUE) | |
stdLibsUsed <- lapply(allPackages, function(path) { | |
pkgName <- basename(path) | |
libPath <- file.path(path, "libs", paste0(pkgName, ".so")) | |
if (!file.exists(libPath)) { |
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
if (!require(httr)) { | |
devtools::install_github("httr") | |
library(httr) | |
} | |
get_archived_packages <- function(package, repo, where) { | |
archive <- file.path(repo, "Archive", package) | |
response <- httr::GET(archive) | |
if (response$status_code == "404") | |
stop("Could not access page at '", archive, "'.") |
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
for (package in installed.packages()[, 1]) | |
library(package, character.only = TRUE) | |
ns <- search() | |
output <- vector("list", length(ns)) | |
for (i in seq_along(output)) { | |
namespace <- ns[[i]] | |
env <- as.environment(namespace) | |
objs <- mget( | |
objects(envir = env), |
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
df <- data.frame(x=1) | |
x <- capture.output(.Internal(inspect(df))) | |
names(df) <- "a" | |
y <- capture.output(.Internal(inspect(df))) | |
internal_diff <- function(x, y) { | |
xp <- file.path( tempdir(), "Rdiff1.txt" ) | |
yp <- file.path( tempdir(), "Rdiff2.txt" ) | |
cat(x, file=xp, sep="\n") | |
cat(y, file=yp, sep="\n") |