If you configure git like this:
git config filter.sqlite3.clean 'sqlite3 %f .dump'
git config filter.sqlite3.smudge 'sqlite3 %f'
echo '*.db filter=sqlite3' >> .git/info/attributes
and you have an sqlite3 database in a *.db
file:
library(tidyverse) | |
library(glue) | |
# i have my reasons, please dont burn my computer | |
setwd("~/git/r-source") | |
extract_isna <- function(.){ | |
cat( "\r", . ) | |
invisible( system(paste0('git checkout -q -f ', .)) ) | |
template <class Fun> | |
class ScopeGuard { | |
Fun f_; | |
bool active_; | |
public: | |
ScopeGuard(Fun f) | |
: f_(std::move(f)) | |
, active_(true) { | |
} | |
~ScopeGuard() { if (active_) f_(); } |
# ==== Creating UTF-8 strings ==== | |
# This is how to create a string with UTF-8 encoding. This should work | |
# regardless of the current locale settings. | |
x <- rawToChar(as.raw(c(0xe5, 0x8d, 0x88))) | |
Encoding(x) <- "UTF-8" | |
x | |
# [1] "午" | |
# Another string, 'Δ★😎' | |
pat <- rawToChar(as.raw(c(0xce, 0x94, 0xe2, 0x98, 0x85, 0xf0, 0x9f, 0x98, 0x8e))) |
If you configure git like this:
git config filter.sqlite3.clean 'sqlite3 %f .dump'
git config filter.sqlite3.smudge 'sqlite3 %f'
echo '*.db filter=sqlite3' >> .git/info/attributes
and you have an sqlite3 database in a *.db
file:
# make certain jsonlite is available | |
if(!require(jsonlite, quietly = TRUE)) { | |
install.packages("jsonlite") | |
library(jsonlite) | |
} | |
# get the path to settings file | |
path <- if (Sys.info()[["sysname"]] == "Windows") { | |
paste0(Sys.getenv('APPDATA'), "\\RStudio\\rstudio-prefs.json") | |
} else { |
These instructions are specifically for OSX and *.nix users who have access to Bash. If you're on Windows...you should probably just use Microsoft Access...
For a more convoluted example of how to use mdbtools to automate the conversion of an Access database, you can see this example I posted with the Florida prisons database (not recommended for Bash novices)
To just get the data as CSV, you can download it from here:
2017-08-03: Since I wrote this in 2014, the universe, specifically Kirill Müller (https://github.com/krlmlr), has provided better solutions to this problem. I now recommend that you use one of these two packages:
I love these packages so much I wrote an ode to here.
I use these packages now instead of what I describe below. I'll leave this gist up for historical interest. 😆
For the development version of R-devel which will become 4.3.0, there is a new warning in R CMD check
that comes up for some packages:
* checking C++ specification ... NOTE
Specified C++11: please drop specification unless essential
$ git branch -r --merged | | |
grep origin | | |
grep -v '>' | | |
grep -v master | | |
xargs -L1 | | |
awk '{split($0,a,"/"); print a[2]}' | | |
xargs git push origin --delete |
(This post was motivated by a talk by @jnolis at CascadiaRConf 2021)
Recent versions of Shiny have an undocumented feature for handling POST requests that are not associated with any specific Shiny session. (Note that this functionality is missing our normal level of polish; it's a fairly low-level hook that I needed to make some things possible, but doesn't make anything easy.)
In a nutshell, it works by replacing your traditional ui
object with a function(req)
, and then marking that function with an attribute indicating that it knows how to handle both GET
and POST
:
library(shiny)