R

A fix for Qualtrics random selection data

Sometimes I get the problems no-one else has a solution for, particular those involving data transformation. Qualtrics (online survey tool) lets you create random selection questions, where you provide a pool of answer options and set Qualtrics to randomly display a specified number of the answer options to the person doing the survey. Which can… Continue reading A fix for Qualtrics random selection data

New Zealand · R

The right map projection

You know how people say it is important to use the right map projection? What they said, illustrated. library(maps) library(mapproj) png(filename=”default.png”, width = 320, height = 320) map(“nz”) dev.off() projec <- “mercator” png(filename=paste(projec ,”png”, sep=”.”), width = 320, height = 320) map(“nz”, proj=projec) dev.off() projec <- “sinusoidal” png(filename=paste(projec ,”png”, sep=”.”), width = 320, height =… Continue reading The right map projection

New Zealand · R

The sun causes earthquakes

I sat down to write a satirical blog post, but the results I got disturbed me. I used the Geonet quake catalogue to download the past 5 years of New Zealand earthquake data from¬†http://info.geonet.org.nz/display/appdata/Earthquake+Catalogue library(dplyr) library(lubridate) library(ggplot2) if(file.exists(“eqnz.csv”)){ eq <- read.csv(“eqnz.csv”, stringsAsFactors=FALSE) } else{ e1 <- read.csv(“http://quakesearch.geonet.org.nz/csv?bbox=163.03711,-49.32512,182.41699,-32.47270&startdate=2015-09-01&enddate=2016-09-01&#8221;, stringsAsFactors=FALSE) e2 <- read.csv(“http://quakesearch.geonet.org.nz/csv?bbox=163.03711,-49.32512,182.41699,-32.47270&startdate=2014-08-01&enddate=2015-09-01&#8221;, stringsAsFactors=FALSE) e3 <- read.csv(“http://quakesearch.geonet.org.nz/csv?bbox=163.03711,-49.32512,182.41699,-32.47270&startdate=2013-09-01&enddate=2014-08-01&#8221;,… Continue reading The sun causes earthquakes

R

Hamlog, Prince of Denmark

I’m running a session on analysing log files next week, and for an example file, I turned the script of Hamlet from project Gutenberg into a log file with a bit of careful adjusting¬†of the file and adding some timestamps. Hamlog imitation log file Text from Project Gutenburg, http://www.gutenberg.org/ebooks/1524 2016-09-05 15:19:14<SHAKESPEARE.>SCENE. Elsinore. ACT I. Scene… Continue reading Hamlog, Prince of Denmark