I'm working on a custom brush to extend SyntaxHighlighter to support the syntax of R.
The project is on GitHub.
The brush file is SyntaxHighlighter/scripts/shBrushR.js.
Here's an example.
resultframe <- sessionframe <- temp <- bpdata[1,] transform(resultframe, morningbedtime=c(0)) resultframe <- resultframe[0,] for (i in 2:length(bpdata$ID)) { tempnext <- bpdata[i,] if ((abs(difftime(temp$datetime, tempnext$datetime, units="mins")) > 10) || (i == length(bpdata$ID))) { if (i == length(bpdata$ID)) { sessionframe <- merge(sessionframe, tempnext, all=T) sessiondatetime <- strptime(tempnext$datetime, "%Y-%m-%d %H:%M:%S") } else { sessiondatetime <- strptime(temp$datetime, "%Y-%m-%d %H:%M:%S") } sessionmax <- mean(sessionframe$max) sessionmin <- mean(sessionframe$min) sessionbpm <- mean(sessionframe$bpm) if ((morningbegin <= sessiondatetime$hour) && (sessiondatetime$hour < morningend)) { sessionmorningbedtime <- c(0) } else { sessionmorningbedtime <- c(1) } resultframe <- merge(resultframe, data.frame(datetime=sessiondatetime, max=sessionmax, min=sessionmin, bpm=sessionbpm, morningbedtime=sessionmorningbedtime), all=T) sessionframe <- temp <- tempnext } else { sessionframe <- merge(sessionframe, tempnext, all=T) temp <- tempnext } }