R code for analyzing calcium signals