Skip to content

Instantly share code, notes, and snippets.

library(phonTools)
data(sound)
spectrogram(sound)
@erzk
erzk / cp_all.sh
Created April 16, 2018 18:46
copy all mes files
#!/bin/bash
cp **/*MES.csv All
# define a function
replace_nth_ETG4000 <- function(x, mark) {
x <- x %>% group_by(Mark) %>% mutate(Count = row_number()) %>% data.frame()
double_marks <- which(x$Mark == mark & x$Count %% 2 == 0)
x$Mark[double_marks] <- 0
x <- subset(x, select = -Count)
return(x)
}
# remove second occurrence of Mark 2
# remove all but block borders
borders1 <- which(df$Mark == 1)
borders9 <- which(df$Mark == 9)
borders10 <- which(df$Mark == 10)
df[borders1,] <- 0
df[borders9,] <- 0
df[borders10,] <- 0
# block borders
# install fnirsr
devtools::install_github("erzk/fnirsr")
library(dplyr)
library(fnirsr)
# file path
p01_path <- "/media/.../p01_fnirs_data_MES_Probe1.csv" # MES file
# load the header
% Reading vector of stimulus markers and arranging this into the format
% required by Homer2 and storing in the variable "aux"
markertimes = [find(vector_onset>0) find(vector_onset<0)];
markers = vector_onset(markertimes);
unique_markers = unique(markers);
aux = zeros(count, length(unique_markers));
for stimuli=1:length(unique_markers)
if offset == 'y' || offset == 'Y' % Version 3
stim_on_off = find(vector_onset==(unique_markers(stimuli))); % Version 3
stim_markers = stim_on_off(1:2:length(stim_on_off)-1); % Version 3
clear all
clc
%% Version 3 update: channels and wavelengths are re-ordered such that they
% are in the order Homer2 software expects.
% User choice to remove marker at end of stimulus as this is not needed in
% Homer. Thanks to Ian Wiggins for your assistance with Version 3 edits.
% Rebecca S Dewey 29th July 2014
%% Revision update: stimulus markers are now read into the "aux" variable
@erzk
erzk / geofacet_grid_Poland.R
Last active July 21, 2019 09:24
geofacet - siatka z województwami
# geofacet - Polska
# Ludność w miastach w % ogółu ludności (dane roczne)
library(dplyr)
library(geofacet)
library(ggplot2)
library(readxl)
# dane z Banku Danych Lokalnych
# https://bdl.stat.gov.pl/BDL/dane/podgrup/tablica
@erzk
erzk / zooplaR_introduction.R
Created January 7, 2018 01:51
Get UK property data from Zoopla
# install the package
devtools::install_github("erzk/zooplaR")
# load it
library(zooplaR)
# set up the keys
file.edit("~/.Renviron")
zoopla_key <- "YOUR_KEY_GOES_HERE"
zoopla_key <- Sys.getenv("zoopla_key")
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.