Firstly, navigate to your NeSi folder. Then, run the following to load the spatial R
-related software you'll need to use in your NeSi session
module load R-Geo/4.2.1-gimkl-2022a
Open R
:
"dragon_names","dragon_types","dragon_colors","x_1","y_1","x_2","y_2","x_3","y_3","x_4","y_4","x_5","y_5","x_6","y_6","x_7","y_7" | |
"Tairneanach","Morningstartail","Black",-0.0160343095587667,-0.475012970956097,-0.0247717663682427,-0.304502853610342,0.0614933710135008,-0.176835528276684,0.122175367326438,-0.0995065517127183,0.210537935906918,0.155265104264409,0.158427809729873,-0.102608542064535,0.263012352765849,0.035214765915639 | |
"Andarnaurram","Feathertail","Golden",0.19231236270105,-0.149204632011216,0.281983066002848,-0.11516001192224,0.309111682691777,0.0288341594268495,0.385965977458134,0.0862044222680958,0.42238952609094,0.193471469416141,0.426407762703258,0.236976608122578,0.392688796405665,0.293607250488481 | |
"Sgaeyl","Daggertail","Blue",0.251862850077826,0.359554903021405,0.174180621943546,0.252011878084052,0.202186848002473,0.349189177255015,0.221394902138276,0.513197257884685,0.283732765187058,0.690871758640864,0.370439467031693,0.845297890425778,0.440090741497124,0.966165123030898 | |
"Deigh","Daggertail |
#' Function to extract pairwise comparison names | |
#' from the output of predictmeans::predictmeans() | |
#' @source Kathy Ruggiero, k.ruggiero@auckland.ac.nz | |
#' @param pm a predictmeans output object | |
comparison_names <- function(pm){ | |
trtNames <- colnames(pm$`Pairwise LSDs`) | |
# Paste pairs of names with "-" between them to show comparison | |
comparison <- NULL | |
k <- 1 |
x | y | |
---|---|---|
1.83984375 | 4 | |
3.515624999999993 | 4.521739130434781 | |
4.07421875 | 4.521739130434781 | |
5.44921875 | 4.913043478260869 | |
6.007812499999993 | 7.608695652173912 | |
7.08203125 | 7.608695652173912 | |
7.94140625 | 8.478260869565217 | |
8.328125 | 9.043478260869565 | |
10.6484375 | 8.695652173913043 |
## CRAN packages | |
library(Pareto) ## heavy tailed distribution | |
library(ggplot2) ## plotting | |
library(patchwork) | |
## GitHub packages | |
library(ggcats) ## remotes::install_github("R-CoderDotCom/ggcats@main") | |
set.seed(6666) | |
t <- 100; alpha = 20 |
################################################### | |
##** All based on https://github.com/djnavarro **## | |
##*********** No credit is mine ***********######## | |
################################################### | |
## required packages | |
devtools::install_github("djnavarro/turmite59") | |
devtools::install_github("djnavarro/scrawl") | |
devtools::install_github("djnavarro/flametree") | |
################################ |
## library for shapefiles | |
library(sf) | |
library(ggplot2) | |
## data from https://data-niwa.opendata.arcgis.com/datasets/river-lines | |
## read in from GitHub | |
url <- "https://github.com/cmjt/eeda/raw/master/gh-data/rivers_nz.rda?raw=True" | |
repmis::source_data(url) | |
## setting diverging colour palette | |
cols <- c(RColorBrewer::brewer.pal(4, "Dark2"), | |
rep(RColorBrewer::brewer.pal(8, "Dark2"),75,)) |
#' Function to convert latitude and longitude coordinates | |
#' to UTM. Will automatically calculate the UTM zone. | |
#' Only works is UTM zone is unique | |
#' @param latitude vector of latitude coordinates | |
#' @param longitude vector of longitude coordinates | |
library(rgdal) | |
ll.2.utm <- function(latitude,longitude){ | |
## find utm zone | |
zone = (floor((longitude + 180)/6) %% 60) + 1 | |
if(length(table(zone)) > 1){stop("data spans multiple UTM zones")} |
"session" "over" "batting.team" "batswoman" "not.facing" "bowler" "wicket" "contig" | |
"1" 1 21.5 "Australia" "EJ Villani" "NE Bolton" "A Shrubsole" "caught" 21.5 | |
"2" 1 23.5 "Australia" "MM Lanning" "NE Bolton" "A Shrubsole" "caught" 23.5 | |
"3" 1 29.5 "Australia" "NE Bolton" "EA Perry" "A Shrubsole" "bowled" 29.5 | |
"4" 1 33.1 "Australia" "EA Perry" "AJ Blackwell" "A Shrubsole" "caught" 33.1 | |
"5" 1 38.3 "Australia" "AJ Blackwell" "JL Jonassen" "KH Brunt" "lbw" 38.3 | |
"6" 1 59.6 "Australia" "AJ Healy" "JL Jonassen" "LA Marsh" "lbw" 59.6 | |
"7" 1 64.3 "Australia" "SJ Coyte" "JL Jonassen" "KL Cross" "caught" 64.3 | |
"8" 1 71.4 "Australia" "ML Schutt" "JL Jonassen" "LA Marsh" "lbw" 71.4 | |
"9" 1 100.5 "Australia" "JL Jonassen" "KM Beams" "KH Brunt" "lbw" 100.5 |
#' Function to randomly plot a cricket fielding position for a right handed batsman | |
#' and give the "player" 10 seconds to guess before the position is named | |
#' @param times the number of times you want to "play", by default 1 | |
#' @param show.inner logical, do you want the inner field boundaries plotted | |
#' @param show.all logical, if TRUE then all fielding positions will be plotted | |
guess.position <- function(times = 1, show.inner = FALSE, show.all = FALSE){ | |
fielding.positions <- data.frame(x = c(0.55,1.45,1.35,0.7,0.6,0.8,1.2, | |
1.075,0.925,0.925,0.75,0.9,1.1, | |
0.8,0.75,0.7,0.75,0.8,0.85, | |
1.2,1.3,1.2,1.4), |