Skip to content

Instantly share code, notes, and snippets.

Patrick Ball vm-wylbur

Block or report user

Report or block vm-wylbur

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View getpix.py
#!/usr/bin/env python3
# set expandtab ts=4 sw=4 ai fileencoding=utf-8
#
# Author: PB
# Maintainer(s): PB
# License: (c) HRDAG 2019, GPL v2 or newer
#
# -----------------------------------------------------------
# archiver/bin/getpix.py
@vm-wylbur
vm-wylbur / Makefile
Created Jan 1, 2019
create LaTeX from Rmd, using a Makefile, the HRDAG way
View Makefile
#
# Authors: PB
# Maintainers: PB
# Copyright: 2018, HRDAG, GPL v2 or later
# ============================================
R_OPTS=--no-save --no-restore --no-init-file --no-site-file
KNITR="rmarkdown::render('$<', output_format='md_document', output_dir='output/')"
all: output/some-file.tex \
@vm-wylbur
vm-wylbur / thin-space.R
Created Jan 1, 2019
use non-breaking thin space as thousands separator in rmarkdown
View thin-space.R
myNum <- function(n) {
# use in markdown with variable some_number:
# `r myNum(some_number)` and the thousands separator is a
# nonbreaking thin space, which is ISO 30-1
return(prettyNum(n, big.mark='&thinsp;'))
}
@vm-wylbur
vm-wylbur / running_script.R
Created Jan 1, 2019
get name of the running script in R (or RStudio)
View running_script.R
.get_running_name <- function() {
#' returns name of current script
if (interactive()) {
fname <- rstudioapi::getActiveDocumentContext()$path
} else {
# via commandArgs, look for file=
cmdArgs = commandArgs(trailingOnly = FALSE)
needle <- '--file='
fname <- grep(needle, cmdArgs, value=TRUE)
}
You can’t perform that action at this time.