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(ggplot2) | |
# coords for vertices of polygons that make the zones | |
polydata <- rbind( | |
data.frame(x = c(0, 0.01, 0.99, 1), | |
y = c(0, 0.25, 0.25, 0), | |
group = "zone 1", | |
fill = "grey80", xc = .5, yc = 0.125), | |
data.frame(x = c(0, 0.025, 0.495, 0.495), | |
y = c(-0.01, -0.25, -0.25, -0.01), |
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("googlesheets") | |
suppressPackageStartupMessages(library("dplyr")) | |
third_party_gap <- "https://docs.google.com/spreadsheets/d/1xbMp7UZ7Nusjb2u1b1RihZrNzPMINZ8BHy9x2urGTzo/edit#gid=0" %>% | |
gs_url() | |
wp <- | |
third_party_gap %>% | |
gs_read(ws = "Writing progress") |
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
# related to my question here: https://github.com/tidyverse/googledrive/issues/218 | |
# How to get access to specific revisions of a google drive document? Yes, we can do that. | |
# How to get the username for each revision, and the size of the document at each revision (bytes or words, assuming we are specifically talking about docs and not sheets or other types of files) Yes, we can do that. | |
# Goal is to measure the contributions of each author to a collaboratively-authored google doc with as little work as possible | |
# How to get access to specific revisions of a google drive document? | |
# Getting the revisions for a Google Doc |
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
# to make traces... | |
# Import an EPS file in Inkscape | |
# Trace over it to show half of vessel profile, from top of rim to centre of base, about 20-30 segements | |
# detelete EPS from from Inkscape | |
# export PNG of trace from Inkscape | |
library(magick) | |
lf <- list.files("../traces", full.names = TRUE) |
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
# read in the images... | |
library(magick) | |
img_paths <- list.files("../outline_P/", full.names = TRUE ) | |
n <- 100 # just get a sample | |
imgs <- image_read(img_paths[1:n]) | |
# reduce size | |
imgs_cropped <- image_crop(imgs, "100x100") |
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
# Change point analysis | |
library(tidyverse) | |
# get the data of population per state and fatalities per state | |
source(here::here("/Analysis/Tables/permillcalculation.R")) | |
# compute fatalities per 1000 peple per year per state, using | |
# the custom function in permillcalculation.R | |
ratio_data <- permillcalc() |
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
# data.frame to be filled | |
wf_df <- data.frame() | |
# effective population sizes | |
sizes <- c(5, 10, 100, 500) | |
# starting allele frequencies | |
starting_p <- c(.01, .1, .5, .8) | |
# number of generations |
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(sf) | |
library(tidyverse) | |
# read in the shapefile first, that gives us the CRS for the analysis | |
polygons <- st_read("polygons.shp") | |
# read in the points | |
points <- read_csv('points.csv') |
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
require(maps) | |
require(sp) | |
require(maptools) | |
require(tmap) | |
require(cartogram) | |
# get a SpatialPolygonsDataFrame of US states | |
usa <- map("state", fill = TRUE) | |
IDs <- sapply(strsplit(usa$names, ":"), function(x) x[1]) | |
usa <- map2SpatialPolygons(usa, IDs=IDs, proj4string=CRS("+proj=longlat +datum=WGS84")) |
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
# read in data | |
soil_colour <- | |
readxl::read_excel("KWL_chronology.xlsx", | |
sheet = "soil_color") | |
layer_depths <- | |
readxl::read_excel("KWL_chronology.xlsx", | |
sheet = "depth") # some of the Pit IDs don't match the Pit IDs in the soil_colour sheet... | |
library(tidyverse) |