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(maptools) | |
# read the shapefile data | |
shpfile1 <- "POL_adm1.shp" # 2 - voivodeship-level | |
sh1 <- readShapePoly(shpfile1) | |
shpfile2 <- "POL_adm2.shp" # 2 - powiat-level | |
sh2 <- readShapePoly(shpfile2) | |
# create the overlapping plots |
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
# shapefile overlapping Google Maps | |
library(ggplot2) | |
library(ggmap) | |
library(rgdal) | |
# geographical centre of Poland | |
poland <- get_googlemap(c(lon=19.27, lat=52.03), | |
zoom = 6, | |
maptype = "satellite") |
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
# interactive leaflet plot | |
library(leaflet) | |
leaflet() %>% | |
addTiles() %>% | |
addPolygons(data = sh2, | |
weight = 2) %>% | |
addPolygons(data = sh1, | |
color = "red", | |
weight = 1) |
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
// based on calculation from Tableau's website | |
REGEXP_EXTRACT([Postcode], "([A-Z][A-Z]?)") |
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
# load this package to use HTTP verbs | |
library(httr) | |
postcode_lookup <- function(postcode) { | |
r <- GET(paste0("https://api.postcodes.io/postcodes/", postcode)) | |
warn_for_status(r) | |
content(r) | |
} | |
# returns a list |
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(rvest) | |
# URL: http://www.rohcollections.org.uk/SearchResults.aspx?searchtype=performance&page=0&genre=Opera | |
performances <- c() | |
for (i in 0:233){ | |
site_perf <- paste0("http://www.rohcollections.org.uk/SearchResults.aspx?searchtype=performance&page=", | |
i, | |
"&genre=Opera") | |
print(site_perf) # optional print to see the progress |
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
# install the package if not available with: | |
# install.packages("R.matlab") | |
library(R.matlab) | |
# load the nirs file | |
data <- readMat("Simple_Probe.nirs") | |
# get the available names | |
names(data) |
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
dygraph(gbppln_xts, | |
main="British Pound (GBP) to Polish Zloty (PLN) 1996-2015", | |
ylab="GBP/PLN") %>% | |
dyRangeSelector(height = 50) %>% | |
dyEvent(date = "2004-05-01", "Poland joining the EU", labelLoc = "bottom") %>% | |
dyEvent(date = "2008-09-15", "Bankruptcy of Lehman Brothers", labelLoc = "top") |
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
import serial | |
port = serial.Serial('COM1', 9600, timeout=0) | |
port.write('A \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
devtools::install_github("erzk/fnirsr") | |
library(dygraphs) | |
library(fnirsr) | |
file_path <- system.file("extdata", "Hitachi_ETG4000_24Ch_Total.csv", package = "fnirsr") | |
ETG_header <- load_ETG4000_header(file_path) | |
rawData <- load_ETG4000_data(file_path, ETG_header) | |
# prepare the events |