Skip to content

Instantly share code, notes, and snippets.

@brshallo
brshallo / source-rmd-chunks.r
Last active December 7, 2022 13:15
Function for sourcing individual or multiple chunks from an RMD document
library(magrittr)
library(stringr)
library(readr)
library(purrr)
library(glue)
library(knitr)
source_rmd_chunks <- function(file, chunk_labels, skip_plots = TRUE, output_temp = FALSE){
temp <- tempfile(fileext=".R")
@kauffmanes
kauffmanes / install_anaconda.md
Last active April 19, 2024 03:30
Install Anaconda on Windows Subsystem for Linux (WSL)

Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.

This article is also on my blog: https://emilykauffman.com/blog/install-anaconda-on-wsl

Note: $ denotes the start of a command. Don't actually type this.

Steps to Install Anaconda on Windows Ubuntu Terminal

  1. Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
  2. Go to https://repo.continuum.io/archive to find the list of Anaconda releases
  3. Select the release you want. I have a 64-bit computer, so I chose the latest release ending in x86_64.sh. If I had a 32-bit computer, I'd select the x86.sh version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Anaconda3-5.2.0-Li
@viegelinsch
viegelinsch / revealjs_as_submodule.md
Created November 29, 2016 14:43
Using reveal.js as presentation framework for learning resources
@rbanick
rbanick / Using VRT files to successfully convert CSV to points
Created November 2, 2014 11:25
Using VRT files for CSV to Points conversion.
Sometimes, for whatever reason, QGIS hates your CSV of point data and mangles it so it can't be converted to points. Sometimes, it gets worse and command line GDAL also messes things up. In these cases you can fall back on a .vrt
A .vrt is a really simple file that tells GDAL *exactly* where your lat/long columns are and how to render them (e.g. as point geometry). You can also use this for non-point geometry if you want to get fancy and have columns of polygon data (or a non-csv file type that holds them in another fashion).
A .vrt is basically formatted as below:
<OGRVRTDataSource>
<OGRVRTLayer name="[Filename]">
<SrcDataSource>[Filename].csv</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
@rmflight
rmflight / post-commit
Last active March 29, 2024 19:43
useful commit hooks for R package dev
#!/path/2/Rscript
# License: CC0 (just be nice and point others to where you got this)
# Author: Robert M Flight <rflight79@gmail.com>, github.com/rmflight
#
# This is a post-commit hook that after a successful commit subsequently increments the package version in DESCRIPTION
# and commits that. Analogous to the pre-commit at https://gist.github.com/rmflight/8863882, but useful if you only have
# good reasons for not doing it on the pre-commit.
#
# To install it, simply copy this into the ".git/hooks/post-commit" file of your git repo, change /path/2/Rscript, and make
@wch
wch / server.r
Last active September 8, 2023 20:25
Shiny example: dynamic input fields
data_sets <- c("mtcars", "morley", "rock")
shinyServer(function(input, output) {
# Drop-down selection box for which data set
output$choose_dataset <- renderUI({
selectInput("dataset", "Data set", as.list(data_sets))
})
# Check boxes