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 |
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
#!/usr/bin/env python2 | |
# -*- coding: utf-8 -*- | |
""" | |
This experiment was created using PsychoPy2 Experiment Builder (v1.83.04), February 07, 2017, at 16:33 | |
If you publish work using this script please cite the relevant PsychoPy publications | |
Peirce, JW (2007) PsychoPy - Psychophysics software in Python. Journal of Neuroscience Methods, 162(1-2), 8-13. | |
Peirce, JW (2009) Generating stimuli for neuroscience using PsychoPy. Frontiers in Neuroinformatics, 2:10. doi: 10.3389/neuro.11.010.2008 | |
""" | |
from __future__ import division # so that 1/3=0.333 instead of 1/3=0 |
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
--- | |
title: "Loading and plotting nirs data" | |
author: "Eryk Walczak" | |
date: "18 December 2016" | |
output: | |
html_document: default | |
pdf_document: default | |
--- | |
```{r setup, include=FALSE} |
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
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
# 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
// 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
# 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
# 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") |