View rstudio-reset.sh
This file contains 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
rm -rf ~/.rstudio | |
rstudio-server kill-all |
View reduce-merge.R
This file contains 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
Reduce(function(x, y) merge(x, y, all=TRUE), list(df1, df2, df3)) | |
# OR # | |
Reduce(function(...) merge(..., all=TRUE), list(df1, df2, df3)) |
View sensitivity-curve.R
This file contains 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
# Create sensitivity curve of coefficient estimates | |
library(tidyverse) | |
library(cowplot) | |
library(fastDummies) | |
# Setup ---- | |
rm(list = ls()) | |
theme_set(theme_cowplot()) | |
set.seed(42) |
View dynamic-var-names-dplyr.R
This file contains 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
multipetal <- function(df, n) { | |
varname <- paste("petal", n , sep=".") | |
mutate(df, !!varname := Petal.Width * n) | |
} |
View points-in-polys.R
This file contains 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
points.shp <- points.shp[apply(sf::st_intersects(points.shp, polys), 1, any),] |
View mult-fxn-mult-col.R
This file contains 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.summary = function(x) list(mean = mean(x), median = median(x)) | |
DT[, as.list(unlist(lapply(.SD, my.summary))), .SDcols = c('a', 'b')] | |
View pad-with-zeroes.R
This file contains 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
x <- c(5, 15, 2015) | |
sprintf(sprintf("%03d", x)) |
View execute-tmux.sh
This file contains 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
## Logging into server | |
ssh <server-address> | |
# Login | |
tmux | |
# CTRL-b d to detach tmux | |
exit | |
## When returning to server | |
tmux attach |
View update-beamer-packages.R
This file contains 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(tinytex) | |
tlmgr_search('/times.sty') # search for times.sty | |
tlmgr_install('psnfss') # install the psnfss package | |
tlmgr_update() # update everything |
View bear_morning.sh
This file contains 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
#!/bin/bash | |
DATE=`date "+%A, %b %d %Y"` | |
YESTERDAY=`date -v-1d "+%A, %b %d %Y"` | |
open "bear://x-callback-url/create?title=$DATE&text=## Beginning of day thoughts | |
## Goals | |
- | |
## End of day thoughts | |
[[$YESTERDAY]]&tags=dailylog" |
NewerOlder