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(dplyr) | |
nz_coastline <- st_read("/lakehouse/default/Files/lds-nz-coastline-mean-high-water-SHP/nz-coastline-mean-high-water.shp") | |
mb2013_akld <- st_read("/lakehouse/default/Files/statsnz-meshblock-2013-SHP-akld/meshblock-2013.shp") | |
# different CRS for the two regions | |
# nz_coastline is NZGD2000 while mb2013_akld is WGS 84 | |
# Let's reconcile both to WGS84 | |
nz_coastline_wgs84 <- st_transform(nz_coastline, st_crs(mb2013_akld)) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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(tidyverse) | |
1:1000 |> | |
as_tibble_col(column_name="some_column") |> | |
select(some_column) |> | |
mutate(some_other_column = map(some_column, function(x){Sys.sleep(1/100);(1/x)}, .progress = list( | |
type = "iterator", | |
format = "Calculating {cli::pb_bar} {cli::pb_percent}", | |
clear = 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
db2se create_srs testdb -srsName NZTM -srsID 2193 -xScale 500 -yScale 500 -xMin 900000 -xMax 1.8014399E13 -yMin 4000000 -yMax 1.8014403E13 -zMin 0 -zMax 9.0071993E15 -mMin 0 -mMax 9.0071993E15 -coordsysName \"NZGD_2000_NEW_ZEALAND_TRANSVERSE_MERCATOR\" -description 'SRS NZTM' |
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
// Assumes you've installed | |
// * the free IBM docker db2 edition | |
// * ibm_db for node: https://github.com/ibmdb/node-ibm_db | |
// Brings back multiple records as well. Found on the net can't remember where - oh, lots of js docs here: https://github.com/ibmdb/node-ibm_db/blob/master/APIDocumentation.md | |
import * as db2 from 'ibm_db'; | |
let cn: string = "DRIVER={DB2};DATABASE=testdb;HOSTNAME=127.0.0.1;UID=db2inst1;PWD=password;PORT=50000;PROTOCOL=TCPIP"; | |
db2.open(cn, function(err: any, conn: any){ | |
if (err) return console.log(err); | |
conn.query('select 1 from sysibm.sysdummy1', function (err: any, data: any) { |
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
remove.packages("rlang") | |
remove.packages("tibble") | |
rlangUrl <- "https://cran.r-project.org/bin/windows/contrib/4.0/rlang_1.0.2.zip" | |
install.packages(rlangUrl, repos=NULL, type="binary") | |
tcltkUrl <- "https://cran.r-project.org/bin/windows/contrib/4.0/tcltk2_1.2-11.zip" | |
install.packages(tcltkUrl, repos=NULL, type="binary") | |
knitrUrl <- "https://cran.r-project.org/bin/windows/contrib/4.0/knitr_1.38.zip" |
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
tcltkUrl <- "https://cran.r-project.org/bin/windows/contrib/4.0/tcltk2_1.2-11.zip" | |
install.packages(tcltkUrl, repos=NULL, type="binary") | |
# tkplotUrl <- "https://cran.r-project.org/bin/windows/contrib/4.0/tcltk2_1.2-11.zip" | |
# install.packages(tkplotUrl, repos=NULL, type="binary") | |
# library(tkplot) | |
knitrUrl <- "https://cran.r-project.org/bin/windows/contrib/4.0/knitr_1.38.zip" | |
install.packages(knitrUrl, repos=NULL, type="binary") |
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
################################################################################## | |
# Import school locations | |
# Import some areas | |
# Join counts | |
# write out | |
library(readxl) | |
library(writexl) | |
library(sf) |
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(tidyverse) | |
library(readr) | |
library(ggmap) | |
library(ggplot2) | |
library(readxl) | |
library(plotly) | |
library(here) | |
library(httr) |
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(readr) | |
library(stringr) | |
library(stringi) | |
em <- read_csv("C:/somewhere/some.csv") | |
em$Time <- paste( | |
paste(str_sub(em$`Date & Time`, 7, 10), str_sub(em$`Date & Time`, 4, 5), str_sub(em$`Date & Time`, 1, 2), sep="/"), | |
str_sub(em$`Date & Time`, -8), sep = " " | |
) |
NewerOlder