Technology
Leave a comment

Showing R code in Drupal

I am starting to learn R and plan to document some of the progress here. To do that, I am testing R syntax highlighting using the first example code from the PerformanceAnalytics package.

The syntax highlighting in Drupal 7 can be done with syntaxhighlighter module, which make use of this powerful library by Alex Gorbatchev. R is not part of the officially supported language, but Xie Yihui had developed R Brush which works quite well. (Especially considering he did it in mere minutes)

> data(managers)
> #managers=read.csv("/home/peter/dev/R/managers.csv",row.names=1)

> managers.length = dim(managers)[1]
> colnames(managers)
> manager.col = 1
> peers.cols = c(2,3,4,5,6)
> indexes.cols = c(7,8)
> Rf.col = 10

> charts.PerformanceSummary(managers[,c(manager.col,indexes.cols)])

Leave a Reply

Your email address will not be published. Required fields are marked *