This file contains hidden or 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
| #Load the library and make a basic map | |
| library(leaflet) | |
| leaflet() %>% addTiles() | |
| #Show a map with a satellite picture on it | |
| leaflet() %>% | |
| addTiles(urlTemplate="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}") | |
| #Make a demo fake data set |
This file contains hidden or 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
| #devtools::install_github("rstudio/leaflet", ref="feature/color-legend") | |
| library(leaflet) | |
| library(RColorBrewer) | |
| set.seed(100) | |
| pdf <- data.frame(Latitude = runif(100, -90,90), Longitude = runif(100, -180,180)) | |
| #make a property with colors | |
| pdf$Study <- rep(1:10,10) | |
| #need to create a pal using colorbin |
This file contains hidden or 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(nlme) | |
| library(ggplot2) | |
| library(lubridate) | |
| library(dplyr) | |
| #download data from https://www.google.com/trends/explore#q=%22i%20cant%20even%22&cmpt=q&tz=Etc%2FGMT%2B5 | |
| i_cant_even <- read.csv("./i_cant_even.csv", skip=4) | |
| #reformat weeks | |
| i_cant_even$Week <- as.character(i_cant_even$Week) |
This file contains hidden or 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
| make_data <- function(slope =1, int = 1, sd_e = 5, group=1, x=1:20){ | |
| ret <- data.frame(x=x) | |
| ret <- within(ret, { | |
| y <- rnorm(length(x), int + slope*x, sd_e) | |
| group <- group | |
| }) | |
| ret | |
| } |
This file contains hidden or 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
| ############# | |
| #' @title Fisher's C and Distance Correlation | |
| #' | |
| #' @author Jarrett Byrnes | |
| #' | |
| #' @description A simulation to look at | |
| #' how distance based correlation can work with | |
| #' D-sep tests | |
| #' | |
| ############# |
This file contains hidden or 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(dplyr) | |
| library(ggplot2) | |
| library(meowR); data(regions) | |
| library(sp) | |
| kelp <- read.csv("../01_clean_raw_data/temporal_data_REBENT_Brittany_NW_France.csv") | |
| #Create a spatial Points Data Frame |
This file contains hidden or 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(dplyr) | |
| library(tidyr) | |
| library(ggplot2) | |
| library(animation) | |
| #Data from https://crudata.uea.ac.uk/cru/data/temperature/ | |
| #As well as data read in script | |
| source("read_cru_hemi.R") | |
| temp_dat <- read_cru_hemi("./HadCRUT4-gl.dat") | |
| #remove cover |
This file contains hidden or 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
| testFrame <- structure(list(Year = c(1948, 1949, 1950, 1951, 1952), `X_-177_52` = c(18.9220237749285, | |
| 21.8483886536779, 18.620676780609, 27.0751608868709, 32.4921595618974 | |
| ), `X_-172.5_52` = c(31.9994862200926, 38.5639899672935, 31.836112737235, | |
| 42.7914952437946, 53.1652576093285), `X_-168_53` = c(26.226590342774, | |
| 35.5284697356814, 26.2798166889216, 37.5791359982477, 45.5915562248318 | |
| ), `X_-136.5_58` = c(24.7796363128934, 24.5255804518598, 16.5003662047736, | |
| 23.5168277681755, 32.9788961278221), `X_-132_53` = c(19.5107068615539, | |
| 19.6662279616348, 16.0907033411067, 19.1839879174579, 24.0906788816321 | |
| ), `X_-130.5_52` = c(25.4554902780508, 27.105312123341, 25.5231126523454, | |
| 25.9769619101539, 33.7769913419713), `X_-127.5_50` = c(31.9535070030102, |
This file contains hidden or 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
| #Some libraries that will help | |
| library(nlme) | |
| library(dplyr) | |
| library(tidyr) | |
| library(mvtnorm) | |
| ######This controls it all! | |
| n_sims <- 5 | |
| #A function to make a sigma matrix |
This file contains hidden or 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(rethinking) | |
| library(dplyr) | |
| data(WaffleDivorce) | |
| mod <- alist( | |
| #likelihood | |
| div_est ~ dnorm(mu, sigma), | |
| #model |