Skip to content

Instantly share code, notes, and snippets.

View oliviergimenez's full-sized avatar
🏠
Working from home

Olivier Gimenez oliviergimenez

🏠
Working from home
View GitHub Profile
@rxaviers
rxaviers / gist:7360908
Last active July 23, 2024 21:25
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@gavinsimpson
gavinsimpson / Deriv.R
Last active May 25, 2024 08:50
R functions to compute and plot the first derivative of a spline term in a GAM(M) fitted by `gam()` or `gamm()` in package mgcv
################################################
## Functions for derivatives of GAM(M) models ##
################################################
Deriv <- function(mod, n = 200, eps = 1e-7, newdata, term) {
if(inherits(mod, "gamm"))
mod <- mod$gam
m.terms <- attr(terms(mod), "term.labels")
if(missing(newdata)) {
newD <- sapply(model.frame(mod)[, m.terms, drop = FALSE],
function(x) seq(min(x), max(x), length = n))
@Pakillo
Pakillo / Rmarkdown-fontsize.Rmd
Created January 22, 2015 22:32
Changing font sizes of HTML ouput in Rmarkdown
---
title: "Untitled"
author: "Francisco Rodriguez-Sanchez"
date: "Thursday, January 22, 2015"
output: html_document
---
<style type="text/css">
body, td {
@AustinRochford
AustinRochford / capture_recapture.ipynb
Last active December 13, 2020 21:22
Capture-Recapture Models in Python with PyMC3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
library(imager)
library(tidyverse)
URL1<-"1280px-CLaude_Monet_037.jpg"
IMAGE <- imager::load.image(URL1)
df1 <- as.data.frame(IMAGE,wide="c") %>% mutate(rgb.val=rgb(c.1,c.2,c.3))
df1<-df1%>%mutate(xNtile=ntile(x,60),
yNtile=ntile(y,60))%>%
group_by(xNtile,y)%>%
mutate(Xrang=rank(-x),
@statnmap
statnmap / df_to_stack.R
Created October 31, 2019 07:38
Transform multiple layer dataframe raster into stack
library(raster)
# remotes::install_github("statnmap/cartomisc")
library(cartomisc)
library(dplyr)
library(purrr)
# Create original raster
fn <- system.file("external/test.grd", package="raster")
s <- stack(fn, fn)
@gavinsimpson
gavinsimpson / animated-basis-functions.R
Created May 7, 2020 19:18
Animated spline basis functions
## plots and animations of how basis functions are used to make
## splines and how these are fitted to data
library('ggplot2')
library('tibble')
library('tidyr')
library('dplyr')
library('mgcv')
library('mvnfast')
library('purrr')
@d-qn
d-qn / lausanne_OSM_city_map.R
Last active October 15, 2020 16:45
Make a minimal arty city map with R and openstreetmap data
library(tidyverse)
library(sf)
library(osmdata) # to get openstreetmap geo data
# settings
bb <- getbb('Lausanne, Switzerland') # define the bbox, will be used to fetch OSM data within that box
dest_proj <- 2056
# OSM overpass query
q <- opq(bbox = bb)
library(glmmTMB)
library(mgcv)
#########################################################################
## Function to create prediction matrices from mgcv for glmmTMB
## from ?mgcv::smooth2random
########################################################################
s2rPred <- function(sm,re,data) {
## Function to aid prediction from smooths represented as type==2
## random effects. re must be the result of smooth2random(sm,...,type=2).

App Install Plan

Critical