# NOT RUN {
dfr = data.frame(Subject=c(rep("a", 5), rep("b", 5)),
Trial = c(rep(1:5,2)),
RT = rnorm(10, 500, 40))
dfr$prevRT = lag.fnc(dfr, time="Trial", group="Subject", depvar="RT")
dfr
# }
Run the code above in your browser using DataLab