Skip to content

Instantly share code, notes, and snippets.

Avatar
🌳
Living the Bayesian dream

Francisco Rodriguez-Sanchez Pakillo

🌳
Living the Bayesian dream
View GitHub Profile
@Pakillo
Pakillo / install.R
Last active Jun 7, 2021
BLIZ Summer School - software & R packages to install
View install.R
# Install R latest version: https://cloud.r-project.org/
# Install RStudio latest version: https://www.rstudio.com/products/rstudio/download/#download
# Install R packages below:
install.packages("remotes")
install.packages("workflowr")
remotes::install_github("benmarwick/rrtools")
@Pakillo
Pakillo / tiempo_vs_clima.R
Created Jan 11, 2021
Tiempo vs Clima - Weather vs Climate
View tiempo_vs_clima.R
library(ggplot2)
t <- 1:100 # create time sequence
# warming trend, constant variance
clima <- data.frame(t = t,
temp = rnorm(100, 15 + 0.03*t, sd = 1))
# warming trend + increasing variance
clima <- data.frame(t = t,
@Pakillo
Pakillo / separate_bibliographies.Rmd
Last active Dec 29, 2020
Having separate reference lists in a Rmarkdown document
View separate_bibliographies.Rmd
---
title: "Having separate reference lists in an Rmarkdown document"
author: "F. Rodriguez-Sanchez"
output:
github_document:
pandoc_args: --lua-filter=multiple-bibliographies.lua
bibliography_main: main.bib
bibliography_suppl: suppl.bib
---
@Pakillo
Pakillo / gist:02bc9c52246559d266ff5d5ef6d374b8
Last active Oct 7, 2020
How to hide some slides in Rmarkdown-generated beamer PDF presentation
View gist:02bc9c52246559d266ff5d5ef6d374b8
https://stackoverflow.com/a/58679929
See also
http://latex-beamer-class.10966.n7.nabble.com/Hiding-frames-td907.html
https://tex.stackexchange.com/questions/200151/remove-frame-from-presentation
https://tex.stackexchange.com/questions/200151/remove-frame-from-presentation
@Pakillo
Pakillo / diverge0.R
Created Dec 12, 2019 — forked from johnbaums/diverge0.R
Plot a rasterVis::levelplot with a colour ramp diverging around zero
View diverge0.R
diverge0 <- function(p, ramp) {
# p: a trellis object resulting from rasterVis::levelplot
# ramp: the name of an RColorBrewer palette (as character), a character
# vector of colour names to interpolate, or a colorRampPalette.
require(RColorBrewer)
require(rasterVis)
if(length(ramp)==1 && is.character(ramp) && ramp %in%
row.names(brewer.pal.info)) {
ramp <- suppressWarnings(colorRampPalette(brewer.pal(11, ramp)))
} else if(length(ramp) > 1 && is.character(ramp) && all(ramp %in% colors())) {
View Sentinel2-repaso.R
## Working with Sentinel-2 bands in R
# Crear proyecto de RStudio
## Cargar paquetes necesarios
library(raster)
View Sentinel2-intro.R
## Working with Sentinel-2 bands in R
## Primeros pasos
# - Crear proyecto de RStudio
#
# - Guardar capas (ZIP) en la misma carpeta
@Pakillo
Pakillo / cc_paleotemp.R
Created Sep 3, 2018
Figure of Cenozoic (last 66 million years) and future global temperatures expected with climate change
View cc_paleotemp.R
library(ggplot2)
library(cowplot)
library(latex2exp)
#### PALEOTEMPERATURES ####
## Data from Hansen: http://www.columbia.edu/~jeh1/mailings/2012/20120508_ClimateSensitivity.pdf
## Available here: http://www.columbia.edu/~mhs119/Sensitivity+SL+CO2/Table.txt
@Pakillo
Pakillo / repromap.R
Last active Mar 21, 2018
another reproducible map with Rstats
View repromap.R
library(sf)
library(ggspatial)
library(ggthemes)
coast <- rnaturalearth::ne_coastline(scale = "small", returnclass = "sp")
forests <- st_read("data/forestmap/cfc_gen.shp")
forest.redux <- rmapshaper::ms_simplify(forests)
forest.redux.sp <- as(forest.redux, "Spatial")
@Pakillo
Pakillo / Worldclim_Precipitation_Uncertainty.md
Last active May 16, 2017
Uncertainty in global climate databases: comparing Worldclim with Iberian climate atlas
View Worldclim_Precipitation_Uncertainty.md

Precipitation: Worldclim vs Iberian Climatic Atlas

Francisco Rodriguez-Sanchez 2017-05-16

library(knitr)
opts_chunk$set(cache = TRUE, message = FALSE)
library(raster)