Random pieces of code
Below I provide pieces of code I have written over the years and shared through GitHub on reproducible science, capture-recapture, occupancy and epidemiological models, spatial stuff, social networks, deep learning, textual analyses, the tidyverse and some random stuff.
This code is provided as is without warranty of any kind. If you find a bug or anything, feel free to get in touch or fill an issue on GitHub.
You may find other pieces of code in papers.
Last update: August 2021.
Reproducible science
-
Introduction to
Git
andGitHub
withRStudio
[ slides] [ material] -
Writing dynamic and reproducible documents with
R Markdown
[ slides] [ material] [ practical] [ interactive dashboard] [ website] -
Manipulate and visualise data in the
tidyverse
[ slides] [ material] [ tips] -
Focus on GIS and spatial data with
sf
package [ slides] [ material]
Capture-recapture
-
Quantifying bias in mortality estimates when ignoring imperfect detection –
R
,Shiny
-
Capture-recapture models as HMMs –
R
,Jags
-
Spatial capture-recapture models for closed and open populations –
R
,Nimble
-
Jolly-Seber capture-recapture models –
R
,Jags
-
Multievent capture-recapture models –
R
,Jags
,Nimble
-
Multievent capture-recapture models with Rcpp –
R
,Rcpp
-
Multievent SIR models and capture-recapture data –
R
,TMB
-
Local minima and multistate capture-recapture models; see also there for mixture of recaptures and recoveries –
R
,Jags
,ADMB
,Stan
,unmarked
-
Animal social networks and capture-recapture data –
R
,Jags
-
Individual fitness in the wild and capture-recapture data –
R
,Jags
,E-SURGE
-
Gompertz capture-recapture model with a Gamma frailty –
R
,Jags
-
Many correlated covariates in capture-recapture models –
R
,RMark
-
Structural equation capture-recapture models –
R
,Jags
-
Abundance estimation using capture-recapture models –
R
,RMark
-
Band-recovery models with time random effects in a frequentist framework –
R
-
Bayesian implementation of capture-recapture models with robust design –
R
,Jags
-
Predator-prey integrated community models –
R
,Jags
Occupancy
-
Dynamic analysis of brown bear habitat use in the Pyrenees –
R
,unmarked
-
HMM formulation of a multispecies dynamic occupancy models –
R
-
Simulation and fit of a 2-species occupancy model à la Rota et al. (2016) here with
unmarked
and there withJags
andNimble
-
Bias in occupancy estimate for a static occupancy model, with an interactive dashboard –
R
andunmarked
Spatial
-
Animated map of wolf presence in France –
R
-
Distribution map from an occupancy model, with Eurasian or Balkan lynx –
R
,unmarked
-
Introduction to GIS and mapping in
R
using thesf
package with slides –R
Epidemiological models and ODEs
-
Explore strategies of social distancing on epidemic w/ SIR model –
R
-
Zombie apocalypse and a Bayesian approach for fitting an epidemiological model to data –
R
,OpenBUGS
Social networks
-
Network analysis of Star Wars The Attack of the Clones –
R
-
Animal social networks from capture-recapture data
-
Analysis of Bottlenose dolphin social network –
R
-
Scientific research is all about networking –
R
Deep learning and species identification
- Piégeage photo et pipeline pour l’identification d’espèces via
deep learning –
Python
,R
Bibliometric and textual analyses
-
Content analysis of French articles in newspapers about wolf –
R
-
Bibliometric and textual analyses of the last decade of research in capture-recapture –
R
-
Quick and dirty analyses of ISEC 2018 tweets –
R
-
Text mining of the ISEC 2020 abstracts –
R
Tidyverse
-
Introduction to the tidyverse –
R
-
Some notes I have taken on David Robinson’s screencasts, with
R
tidyverse tips and tricks –R
-
Analyses of wolf depredation in France –
R
-
Visualizing trends in French deaths –
R
Random stuff
-
Decoding the hidden message in Perseverance parachute with R –
R
-
Visualising the Metropolis algorithm on a simple 1D example –
R
-
Export, clean up and tabulate questions and answers from a Slack work space with several channels into HTML tables –
R
andjson
-
Illustration of the delta-method –
R
-
Creating a hex sticker for the
R2ucare
package –R
-
Simulate data with
Jags
–R
,Jags
-
First steps in Python –
Python
-
Bayesian Multivariate Autoregressive State-Space models - MARSS –
R
,Jags