March Sheffield R Meetup: Code surgery and social


March 7, 2017

In March we held our first R coding surgery and social, a chance for our members to meet, greet, learn from and collaborate with fellow R users.

In attendance

Tamora, Eoghan, Kassandra, Alison, Mat, Chris, José


Data storage (Alison)


  • Storing data of different lengths.


Spatio-temporal time series (Kassandra)


  • Lots of observations in some areas/directions, few elsewhere.
  • Time series of environmental variables.
  • Relate observed distribution with methane flux.
  • Time series has gaps - how to handle?


  • Can create an even time series - add NAs where observations missing
  • Raster layers as time, environmental variable single point time series
  • List columns again!
  • Loading raster data into R: use raster package, load data and specify projection string (unless data is GEO tiff, in that case it’s in the metadata).

Optimisation (Alison)


  • Profiling and how to make the loop quicker.


  • Apply lineprof/profvis to profile whole sections of program/script. See Hadley’s profiling guide.
  • Might be possible to use closures to precalculate distributions.
  • Use C++ via Rcpp.
  • Use JAGS or stan - parallelisable implementations.

Live demo (Chris)

  • Live code demo of list columns.
  • Use saveRDS(), readRDS() as alternative to store as text.
  • Might be problems with speed - use profiling to compare with text storage.

EEG processing (José)


  • Getting raw data into format required for R package for signal processing.
  • Bad documentation!


  • Use Matlab with manufacturer software?

Data handling (Kassandra)


  • Problem with large data - can she write all objects together?


  • Need to be able to write sequentially - plugin for R to speak to database e.g. RSQLite or use RDS.
  • Sparse matrix?
  • R ArcGIS interface?

Profiling update (Alison)

  • Constant matrix each time - copy on modify?
  • Avoid assignment of matrices within for loop (nested).