Skip to content

Instantly share code, notes, and snippets.

View obrl-soil's full-sized avatar

obrl_soil obrl-soil

View GitHub Profile
@mbacou
mbacou / snippets.R
Last active March 20, 2022 23:46
Working with attributes inside SpatialPolygonsDataFrame objects
## Example procedure for working with data (attributes) inside SpatialPolygonsDataFrame objects
# Load my favorite libraries for that sort of work
library(data.table)
library(rgdal)
# Load 2 shapefiles that, say, we want to merge.
# Note that you can read pretty much any spatial format using readOGR().
tza.l2 <- readOGR("./analysis/TZA-AC-07/maps", "tza-ac-07_L2")
tza.l1 <- readOGR("./analysis/TZA-AC-07/maps", "tza-ac-07_L1")
@jgilfillan
jgilfillan / install ROracle on Windows.md
Last active December 21, 2021 17:35
Instructions on how to install ROracle for R on Windows.
@aagarw30
aagarw30 / server.r
Last active December 7, 2020 02:51
R Shiny : Styling the download button - Change the back-ground color, font, font color and style of download button
library(shiny)
shinyServer(function(input, output) {
})
@sdtaylor
sdtaylor / install_old_packages.R
Last active April 24, 2017 22:29
Install all the packages that were in the prior version of R
prior_version = 3.3
library_path = .libPaths()[1]
library_path = substr(library_path, 1, nchar(library_path)-3)
old_library_path=paste0(library_path, prior_version)
old_packages = list.files(old_library_path)
install.packages(old_packages)
@darribas
darribas / Dockerfile
Last active March 6, 2023 15:49
H3 + PySAL
FROM darribas/gds:3.0
USER root
RUN apt-get install --yes cmake
RUN pip install h3
ADD ./h3_pysal.ipynb
# Save your R package list:
packages <- levels(as.data.frame(installed.packages()[,1])[,1])
write.csv(packages, "requirements.txt", row.names = FALSE, quote = FALSE)
# Load your R package list:
backup <- levels(read.csv("requirements.txt")[,1])
# Install your package list on a new machine:
install.packages(backup)
@mdsumner
mdsumner / moving-to-actions.md
Last active August 12, 2022 17:19
Moving to Github Actions with R and usethis

A tired old R package repo

NOTE: *below I originally advocated deleting .travis.yml, appveyor.yml, codecov.yml and related ignore items, I don't think you should be so hasty - leave them for a while maybe. *

Here is tabularaster, an R package on CRAN that uses Appveyor, Travis, Codecov, and manual pkgdown builds.

Here is the state of the repo at 2020-04-13: https://github.com/hypertidy/tabularaster/tree/c0207410a01c169790646b92b84e2071fea3bf60

See the current master branch for the new Actions state.

@dmenne
dmenne / bookdowncrossreference.Rmd
Last active February 14, 2023 20:16
Markdown to HTML: Cross-references and captions for tables and figure
---
title: "Markdown to HTML: Cross-references and captions for tables and figure"
output:
bookdown::html_document2
---
Update December 2022: `gt` and `rtables` (partially) have cross-references.
And there is [`quarto`](https://quarto.org/docs/authoring/cross-references.html), not treated here, which has a much more elegant referencing syntax.
@jscarto
jscarto / Blue Fluorite Palette
Last active September 24, 2020 06:03
Perceptually linear color palette based on a blue fluorite crystal (https://twitter.com/GeologyTime/status/1308406136283049984)
blue_fluorite = ['#291b32', '#2a1b34', '#2b1b34', '#2d1c36', '#2f1c38', '#301c39', '#301d3a', '#321d3b', '#331d3d', '#351d3f', '#351e40', '#371e41', '#381e43', '#3a1e45', '#3b1f45', '#3c1f46', '#3e1f48', '#3f1f4a', '#401f4c', '#42204d', '#43204e', '#44204f', '#462051', '#472052', '#482054', '#4a2056', '#4a2157', '#4c2158', '#4e215a', '#4f215b', '#50215d', '#52215e', '#532160', '#552162', '#552263', '#562264', '#582265', '#592267', '#5b2268', '#5c226b', '#5e226c', '#5f226e', '#60226f', '#622271', '#632272', '#642274', '#662276', '#672277', '#692278', '#6a227a', '#6c227b', '#6e227d', '#6e237e', '#6f247f', '#702480', '#712581', '#722681', '#732683', '#742783', '#752884', '#762985', '#772987', '#792a87', '#792b88', '#7a2c89', '#7b2c8a', '#7c2d8a', '#7d2d8c', '#7e2e8d', '#7f2f8d', '#80308e', '#813190', '#823191', '#833292', '#843292', '#863393', '#863494', '#873595', '#893596', '#8a3697', '#8b3798', '#8b3899', '#8c389a', '#8e399b', '#8e3a9c', '#8f3b9c', '#8f3d9d', '#8f3e9e', '#903f9e', '#90419e', '#90439f', '#9044