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
#' Run a package's examples, allowing tolerance for failures | |
#' | |
#' @noRd | |
.RunExamples <- function(man_dir, timeout = 60) { | |
# It appears the result order is not stable; sort to ensure this | |
rd_files <- sort(dir(man_dir, full.names = TRUE, pattern = "\\.[Rr]d$")) | |
if (length(rd_files) == 0L) { | |
cat("No examples to run.\n") | |
return(list()) |
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
# As downloaded 2023-07-06 | |
library(data.table) | |
library(xml2) | |
# NB: a .docx is "just" a .zip directory | |
unzip("mathfwappendixbsbe.docx", exdir=tempdir()) | |
doc_xml = read_xml(file.path(tempdir(), "word", "document.xml")) |
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
| |
<?xml version="1.0" encoding="iso-8859-1"?> | |
<siri:Siri xsi:schemaLocation="http://www.siri.org.uk/siri http://www.kizoom.com/standards/netex/schema/0.99.1/xsd/NeTEx_siri.xsd" | |
xmlns:siri="http://www.siri.org.uk/siri" | |
xmlns="http://www.netex.org.uk/netex" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:gml="http://www.opengis.net/gml" version="1.0"> | |
<siri:ServiceDelivery> | |
<siri:ResponseTimestamp>2023-06-21T23:27:30-07:00</siri:ResponseTimestamp> | |
<DataObjectDelivery> |
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
# SOURCE: retrosheet.org - https://www.retrosheet.org/gamelogs/index.html | |
library(withr) | |
library(data.table) | |
# one file for the full history of each round | |
playoff_logs <- c( | |
wild_card = "https://www.retrosheet.org/gamelogs/glwc.zip", | |
lds = "https://www.retrosheet.org/gamelogs/gldv.zip", | |
lcs = "https://www.retrosheet.org/gamelogs/gllc.zip", | |
world_series = "https://www.retrosheet.org/gamelogs/glws.zip" |
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(withr) | |
library(data.table) | |
r_dir <- "~/github/r-svn" | |
all_commits <- with_dir(r_dir, system('git log --pretty="format:%H %b"', intern=TRUE)) | |
all_commits <- all_commits[nzchar(all_commits)] | |
hashes <- substr(grep("^[0-9a-f]{40} ", all_commits, value=TRUE), 1, 40) | |
trunk_hash <- head(hashes, 1L) | |
# grep("trunk@33000", all_commits, value = TRUE) |
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
#!/usr/local/bin/Rscript | |
library(potools) | |
suppressPackageStartupMessages(library(data.table)) | |
script_wd = setwd("~/github/r-svn") | |
GIT_COMMIT = if (interactive()) readline('git commit: ') else commandArgs(TRUE) | |
setwd('src/library') | |
get_po_messages <- potools:::get_po_messages |
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) | |
# Export the table on page 2 to .csv: | |
# https://docs.google.com/document/d/1XbfOf3CLVb2UFyUZGJoVLkBUDZ6Hs3APCDW8UzuOvZk | |
DT=fread('~/Desktop/r-translations.csv') | |
DT[ , { | |
par(cex = 2) | |
y = `# Messages` | |
xx = barplot(y, names.arg = `R Version`, space=0, col='#2268bc', yaxt='n', main='Translatable messages by R version', las=2L) | |
text(xx[1L], y[1L]/2, srt=90, prettyNum(y[1L], big.mark = ','), col='white') | |
text(xx[.N], y[.N]/2, srt=90, prettyNum(y[.N], big.mark = ','), col='white') |
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
#!/usr/local/bin/Rscript | |
library(data.table) | |
imports_dt <- tools::dependsOnPkgs( | |
"data.table", "Imports", | |
recursive = TRUE, | |
installed = available.packages() | |
) | |
tar_dir <- "/media/michael/69913553-793b-4435-ac82-0e7df8e34b9f/cran-mirror/src/contrib" |
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(sp) | |
library(rgdal) | |
# better to download & read the files programmatically, but something | |
# funky is happening on that route, not bothering to debug too deeply. | |
# for reproducibility: | |
# (1) Click Download at the URL | |
# (2) Unzip the file; it contains two more zip directories, one KML and one SHP | |
# (3) Unzip the .shp zip to ~/Downloads/mrt |
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(sp) | |
library(rgdal) | |
library(rgeos) | |
# Via CA GIS Data site | |
ca = readOGR("~/Downloads/CA_Counties", "CA_Counties_TIGER2016") | |
travel_zone = gBuffer( | |
ca[ca$NAME == "Santa Clara", ], |