encoding is UTF-8, needs pdflatex
per mille sign
- plain text: ‰ (doesn't render properly in PDF)
- HTML:
‰(renders properly in PDF) - LaTeX:
$\text{\textperthousand}$(renders properly in PDF)
delta sign
| whichfn <- function(fun){ | |
| require(stringr) | |
| str_match(capture.output(environment(fun)),'namespace:(\\w+)')[,2] | |
| } |
| # To put a particular character _ after the 10th position in a string | |
| gsub('^([a-z]{10})([a-z]+)','\\1_\\2', x) | |
| # or | |
| library(stringr) | |
| str_replace(x, '^([a-z]{10})([a-z]+]','\\1_\\2') |
| data(mtcars) | |
| bl <- mtcars %>% | |
| nest(-cyl) %>% | |
| mutate(mod = map(data, ~lm(mpg~wt, data=.) %>% tidy()) %>% | |
| mutate(mod = map(mod, ~setNames(., paste('mymod', names(.), sep='_')))) %>% | |
| select(-data) %>% | |
| unnest() |
| #!/usr/bin/python | |
| # Filename: sas_export.py | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Tue Jan 06 18:40:09 2015 | |
| @author: David Carlson | |
| modified version for sas7bdat 2.0.1 of Charlie Huang version at: | |
| http://www.sasanalysis.com/2014/08/python-extension-functions-to-translate.html | |
| """ |
| for file in $(find . -name "*.doc") | |
| do | |
| /Applications/LibreOffice.app/Contents/MacOS/soffice --convert-to docx $file | |
| done |
| find . -name "* *" -print0 | sort -rz | \ | |
| while read -d $'\0' f; do mv -v "$f" "$(dirname "$f")/$(basename "${f// /_}")"; done |
| #!/usr/bin/python2 | |
| # Copyright (C) 2016 Sixten Bergman | |
| # License WTFPL | |
| # | |
| # This program is free software. It comes without any warranty, to the extent | |
| # permitted by applicable law. | |
| # You can redistribute it and/or modify it under the terms of the Do What The | |
| # Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See |
| #' Detect peaks in data based on their amplitude and other features | |
| #' | |
| #' Translated from the Python version at https://github.com/demotu/BMC | |
| #' License: MIT | |
| #' Version: 1.0 | |
| #' | |
| #' @param x 1-d array | |
| #' @param mph (NA, number), optional (default = NA). Detect peaks wthat are greater than minimum peak height (if `valley=F`) or peaks that are smaller than maximum peak height (if `valley=T`) | |
| #' @param mpd positive integer, optional (default = 1). Detect peaks that are at least separated by minimum peak distance (in number of data) | |
| #' @param threshold positive number, optional (default = 0). Detect peaks (valleys) that are greater (smaller) than `threshold` in relation to their immediate neighbors |