library(tidyverse)
# load in source_rmd()
devtools::source_gist("https://gist.github.com/noamross/a549ee50e8a4fd68b8b1")
#> Sourcing https://gist.githubusercontent.com/noamross/a549ee50e8a4fd68b8b1/raw/40960d8280438b7e2e8d6502f3c1d4ad348caeb6/source_rmd.R
#> SHA-1 hash of file is 624ae941e51dee522994e014928448170cedf1a3
# Also could have used solution here:
# https://stackoverflow.com/questions/10966109/how-to-source-r-markdown-file-like-sourcemyfile-r
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## setup from https://www.tjmahr.com/morgan-stanley-cursed-covid-plot/ | |
library(tidyverse) | |
theme_set(theme_bw()) | |
library(lme4) | |
library(ggeffects) | |
library(colorspace) | |
library(directlabels) | |
# a helper function to download the data from github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(LaCroixColoR) | |
library(sf) | |
library(fasterize) | |
library(rayshader) | |
library(raster) | |
library(exactextractr) | |
library(rayrender) | |
# load raster into R | |
elevation <- raster("Olympus_Mons_ortho-image.tif") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ajout des informations pour l'animation | |
# --------------------------------------- | |
library(gganimate) | |
library(broom) | |
dc <- bind_rows(dc_jour,dc_insee_jour,deces_ecdc,deces_insee_provisoires) | |
# on démarre du fichier dc utilisé pour le graphique surmortalité |
-
iTerm2
-
Command Line Tools
xcode-select –install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), |
NewerOlder