Skip to content

Instantly share code, notes, and snippets.

View ateucher's full-sized avatar

Andy Teucher ateucher

View GitHub Profile
@wch
wch / info.md
Last active March 30, 2023 20:29
How to deal with R-devel C++17 warning

How to deal with the SystemRequirements: C++11 NOTE when running R CMD check

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
library(duckdb)
library(DBI)
library(glue)
library(dplyr)
conn <- DBI::dbConnect(duckdb(), ":memory:",
config=list("memory_limit"="12GB",
"temp_directory" = "/tmp"))
DBI::dbExecute(conn, "INSTALL 'httpfs';")
DBI::dbExecute(conn, "LOAD 'httpfs';")
#### ---------------------------------------------
## Edit via: RStudio > Tools > Edit Code Snippets
# Released under a MIT license
snippet fragment
[${1:text}]{.${2:type}}
snippet aside
[${1:text}]{.aside}
@strengejacke
strengejacke / .lintr
Last active May 24, 2024 05:24
VS Code setup for R
// save to windows-user directory
linters: with_defaults(object_name_linter = NULL,
object_length_linter(50),
commented_code_linter = NULL,
object_usage_linter = NULL,
line_length_linter(120),
cyclocomp_linter = cyclocomp_linter(50))
@ateucher
ateucher / install-saga-mac
Last active November 1, 2019 05:37
Install SAGA GIS on a Mac (2019-10-30)
# If you haven't installed homebrew, see some instructions here:
# https://github.com/bcgov/envreportutils/wiki/Macbook-Pro-Setup-for-Data-Science-at-EnvReportBC#homebrew
# These have not been tested on macOS Catalina, but the Mojave instructions _should_ work.
# If you run into issues, this looks like it might be helpful:
# https://medium.com/faun/macos-catalina-xcode-homebrew-gems-developer-headaches-cf7b1edf10b7
# The osgeo homebrew tap is in a bit of a mess, so `brew install saga-gis` doesn't work (as of 2019-10-30).
# This is because SAGA dependencies have been updated, but they haven't updated the brew formula for SAGA itself.
# Same goes for QGIS; and now that there is a fully self-contained signed installer, I recommend that over heomebrew for QGIS
# (https://qgis.org/en/site/forusers/download.html)
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history

Intro

Each project / task / app / script that you work on may have its own dependency requirements. Ideally you don't want to have to "polute" your core python install with a bunch of dep

@Ryo-N7
Ryo-N7 / laliga_goal_contribution_matrix.r
Last active May 30, 2019 10:45
Goal contribution matrix for La Liga (2018-2019 Season)
## pkgs
pacman::p_load(tidyverse, polite, scales, ggimage, ggforce,
rvest, glue, extrafont, ggrepel, magick)
loadfonts()
## add_logo function from Thomas Mock
add_logo <- function(plot_path, logo_path, logo_position, logo_scale = 10){
# Requires magick R Package https://github.com/ropensci/magick
library(rgdal)
#> Loading required package: sp
#> rgdal: version: 1.4-3, (SVN revision 828)
#>  Geospatial Data Abstraction Library extensions to R successfully loaded
#>  Loaded GDAL runtime: GDAL 2.1.3, released 2017/20/01
#>  Path to GDAL shared files: /Users/ateucher/Rlibrary/rgdal/gdal
#>  GDAL binary built with GEOS: FALSE 
#>  Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
#>  Path to PROJ.4 shared files: /Users/ateucher/Rlibrary/rgdal/proj
@ateucher
ateucher / bc_wms_tiles.R
Last active March 28, 2019 22:45
BC WMSTiles
library(bcmaps)
library(leaflet)
library(sf)
st_transform(bc_bound(), 4326) %>%
leaflet() %>%
#add basemap
#addpolygons and make it show in three different layers, by risk level
addPolygons() %>%
addProviderTiles(providers$CartoDB.DarkMatter,