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
## as admin user | |
## | |
sudo adduser rsc-demo # passwd +Ds&.dm/YL!^RX6- | |
sudo useradd rsc-client # passwd: +Ds&.dm/YL!^RX6- | |
sudo usermod -aG rstudio-connect rsc-client | |
sudo usermod -aG rstudio-connect rsc-demo |
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
apt-get install -y unixodbc unixodbc-dev | |
apt-get install -y odbc-postgresql | |
odbcinst -i -s -l -f template/dsn_template_file |
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) | |
user_selected <- reactiveValues(a = 1, b = 1, c = 1) | |
observeEvent(input$slider, { | |
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
### | |
### Scenario Index Table | |
### | |
..AND <- function(..., .env = rlang::caller_env()){ | |
dd <- pryr::dots(...) | |
Reduce("&", lapply(dd, eval, envir = .env)) | |
} | |
..OR <- function(..., .env = rlang::caller_env()){ | |
dd <- pryr::dots(...) |
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
set_sample_view <- function(){ | |
selectText <- rstudioapi::primary_selection(rstudioapi::getSourceEditorContext())$text | |
exprList <- rlang::parse_exprs(selectText) | |
w <- get("(") | |
exprDF <- exprList[[which(sapply(exprList, function(x) is.data.frame(w(eval(x)))))]] | |
invisible(eval(exprDF)) | |
DT <- data.table::as.data.table(w(eval(exprDF))) | |
vdf <- DT[sample(seq_len(.N), size = min(100, .N), replace = FALSE)] | |
return(vdf) | |
} |
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
Sys.setenv("KEYB_DIR_PATH" = paste0(Sys.getenv("HOME"), "/.R/rstudio/keybindings")) | |
wd <- getwd() | |
if(file.exists(paste0(wd, ".Rprofile"))) | |
rpLines <- tryCatch( | |
readLines(paste0(wd, "/.Rprofile")), | |
error = function(c) "## default .Rprofile lines here" | |
) |
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
fname <- tempfile(pattern = "wks_", tmpdir = ".", fileext = ".RData") | |
save.image(file = fname, safe = TRUE) |
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(rstudioapi) | |
# insert text at the start of the document | |
insertText(c(1, 1), "# Hello\n") | |
# insert text at the end of the document | |
insertText(Inf, "# Hello\n") | |
# comment out the first 5 rows | |
pos <- Map(c, 1:5, 1) |
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(rstudioapi) | |
# insert text at the start of the document | |
insertText(c(1, 1), "# Hello\n") | |
# insert text at the end of the document | |
insertText(Inf, "# Hello\n") | |
# comment out the first 5 rows | |
pos <- Map(c, 1:5, 1) |
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(rlang) | |
# Symbolic objects and functions are callable: | |
is_callable(quote(foo)) | |
is_callable(base::identity) | |
# node_poke_car() lets you modify calls without any checking: | |
lang <- quote(foo(10)) | |
node_poke_car(lang, current_env()) |