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
snow <- function() { | |
w <- getOption("width") | |
flakes <- c(rep(" ", 10), "*", " ", " ", "*", "❄︎", "❅", "❆") | |
falls <- | |
vapply(1:50, function(x) { | |
paste0(sample(flakes, size = w - 10, replace = TRUE), collapse = "") | |
}, FUN.VALUE = "") | |
panes <- lapply(1:50, function(x) { |
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
#' @return Character vector of postcodes on 2016 basis | |
latlon2poa <- function(lat, lon, shapefile.dir = Sys.getenv("POA_2016_SHAPEFILE_DIR")) { | |
stopifnot(!anyNA(lat), !anyNA(lon), is.numeric(lat), is.numeric(lon), | |
# Basic check for lat=lon mixup | |
max(lat) <= 90) | |
if (!dir.exists(shapefile.dir)) { | |
tempf <- tempfile() | |
dir.create(tempf) | |
exts <- c("dbf", "prj", "shp", "shx", "xml") | |
# Base URL |
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
# Things you might want to change | |
# options(papersize="a4") | |
# options(editor="notepad") | |
# options(pager="internal") | |
# set the default help type | |
# options(help_type="text") | |
options(help_type="html") | |
options(askYesNo = function(msg, default = NA, prompts, ...) { |
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(data.table) | |
library(grattan) | |
library(hutils) | |
library(magrittr) | |
library(ggplot2) | |
RQ("grattanCharts", | |
devtools::install_github("hughparsonage/grattanCharts")) | |
library(grattanCharts) # hughparsonage/grattanCharts |
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
stopifnot(file.exists("12.R"), | |
basename(dirname(normalizePath(dir(pattern = "^12.R$", | |
full.names = TRUE), | |
winslash = "/"))) == "issues") | |
library(data.table) | |
library(magrittr) | |
library(hutils) | |
library(grattan) |
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
# bad_names <- names(checksMini) | |
bad_names <- c("AF", "AFM", "aLFQ", "annovarR", "antaresProcessing", "BatchExperiments", | |
"BatchJobs", "BGData", "biomartr", "brainGraph", "bupaR", "BuyseTest", | |
"Causata", "cdparcoord", "cffdrs", "classifierplots", "clickstream", | |
"corpustools", "corregp", "ctmm", "cvAUC", "dartR", "dat", "dataPreparation", | |
"DCD", "dfmeta", "dgo", "DGVM3D", "Diderot", "difconet", "drgee", | |
"dynamichazard", "easycsv", "eclust", "edgeRun", "EdSurvey", | |
"eeptools", "eiCompare", "EthSEQ", "EurosarcBayes", "EventStudy", | |
"expss", "fdq", "FedData", "Fgmutils", "flippant", "fst", "genBart", | |
"GenomicTools", "GGIR", "ggswissmaps", "greport", "hisse", "Hmisc", |
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
"windows" : { | |
"script_commands": [ | |
"\"C:/R/R-3.4.3/bin/x64/Rscript.exe\" -e \"knitr::knit('$file_name')\"", | |
// "texify --pdf $file_base_name.tex", | |
"pdflatex -interaction=batchmode", | |
"biber $file_base_name", | |
"pdflatex -interaction=batchmode", | |
"pdflatex -interaction=batchmode" | |
] | |
// See README or third-party documentation |
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
stata_summary <- | |
function( | |
x, | |
... | |
) { | |
# summarize | |
mod <- x | |
x <- summary(x) | |
# find outcome variable |
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(rsdmx) | |
library(data.table) | |
library(hutils) | |
library(magrittr) | |
library(ggplot2) | |
library(ggrepel) | |
ISO3166 <- Census2016.spec:::ISO3166 # hughparsonage/Census2016.spec | |
to_name <- function(a3) { | |
ISO3166[["name"]][match(a3, ISO3166[["alpha_3"]])] |
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(data.table) | |
library(magrittr) | |
library(grattan) | |
library(SampleFile1415) | |
library(taxstats) | |
library(hutils) | |
library(scales) | |
tax2014 <- copy(sample_file_1415) %>% apply_super_caps_and_div293() |
NewerOlder