R Programming Language
Source Code Highlighting Project
Ron Fredericks writes: this is my initial R Programming Language plug-in for GeSHi. Not much to it for now. But it does demonstrate the use of R packages, and hot-links on documentation for each language method.
My goal for this project is to improve online collaboration. Sharing code on the Internet is suppose to be easy and informative. Use this package to highlight R programs.
Grab code you want by simply highlighting with your mouse. Note: to grab code without line numbers, just click on the first line of source code you want just to the right of the line numbers and drag from there,otherwise you will end up grabbing the line numbers too. Click on links automatically generated within the source code to help new users learn more quickly.
Sample code
-
# source code reference: http://bayes.math.montana.edu/Rweb/Rweb.general.html
You can click on the highlighted methods, or copy the code above and paste it into a web version of R called RWeb
GeSHi file
Here I present my second draft of the R (with RHIPE) language highlighter file for GeSHi. Sample usage can be found on LectureMaker’s Math TV Internet platform.
Contact me if you would like to help with this project: automatic generation of all R language constructs and packages, and tutorials from my video studio optimized for source code documentation:
Ron Fredericks, software ecosystem innovator
ronf@LectureMaker.com
(408-390-1895
-
< ?php
-
/*************************************************************************************
-
* r.php
-
* ———–
-
* Author: Ron Fredericks (ronf@LectureMaker.com)
-
* Copyright: (c) 2009-11 Ron Fredericks (http://www.LectureMaker.com)
-
* Release Version: 0.0.0.2
-
* Date Started: 2009/03/28
-
* Last Updated 2011/02/14
-
*
-
* R language file for GeSHi.
-
*
-
* CHANGES
-
* ——-
-
* 2009/03/29 (0.0.1)
-
* - First Internal Release
-
* 2011/02/14 (0.0.2)
-
* - Second Internal Release with RHIPE support
-
*
-
*
-
* References
-
* ———-
-
* Another R GeSHi with no meat? http://organicdesign.co.nz/GeSHi/R.php
-
* SourceForge R discussion: http://sourceforge.net/tracker/?func=detail&aid=2276025&group_id=114997&atid=670234
-
*
-
*************************************************************************************
-
*
-
* This file is part of GeSHi.
-
*
-
* GeSHi is free software; you can redistribute it and/or modify
-
* it under the terms of the GNU General Public License as published by
-
* the Free Software Foundation; either version 2 of the License, or
-
* (at your option) any later version.
-
*
-
* GeSHi is distributed in the hope that it will be useful,
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
* GNU General Public License for more details.
-
*
-
* You should have received a copy of the GNU General Public License
-
* along with GeSHi; if not, write to the Free Software
-
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
*
-
************************************************************************************/
-
-
‘LANG_NAME’ => ‘r’,
-
‘CASE_KEYWORDS’ => GESHI_CAPS_NO_CHANGE,
-
‘ESCAPE_CHAR’ => ”,
-
‘global’, ‘otherwise’, ‘persistent’, ‘return’,
-
‘switch’, ‘try’
-
),
-
‘plot’,
-
‘abline’,
-
‘lines’,
-
‘hist’,
-
‘residuals’
-
),
-
‘rnorm’
-
),
-
‘lm’,
-
‘lowess’
-
),
-
‘summary’
-
),
-
‘exp’
-
),
-
‘expression’
-
),
-
‘any’,
-
‘append’,
-
‘c’,
-
‘do.call’,
-
‘function’,
-
‘lapply’,
-
‘length’,
-
‘library’,
-
‘list’,
-
‘load’,
-
‘nrow’,
-
‘paste’,
-
‘seq’,
-
‘strsplit’,
-
‘sum’,
-
‘unlist’
-
),
-
‘seq_along’,
-
),
-
‘if’, ‘else’, ‘for’, ‘while’, ‘repeat’, ‘break’,
-
‘next’
-
),
-
‘as.null’, ‘is.null’, ‘NULL’
-
),
-
‘ceiling’, ‘floor’, ‘trunc’, ’round’, ‘signif’,
-
‘zapsmall’
-
),
-
‘rhcollect’
-
),
-
‘rhex’
-
),
-
‘rhgetkey’
-
),
-
‘rhlapply’
-
),
-
‘rhmr’
-
),
-
‘rhput’
-
)
-
-
),
-
‘…’ , ‘(‘, ‘)’, ‘< -’, ‘~’
-
),
-
GESHI_COMMENTS => true,
-
1 => false,
-
2 => false
-
//3 => false,
-
//4 => false,
-
),
-
1 => ‘color: #0000FF;’, // blue
-
2 => ‘color: #0000FF;’,
-
3 => ‘color: #0000FF;’,
-
4 => ‘color: #0000FF;’,
-
5 => ‘color: #0000FF;’,
-
6 => ‘color: #0000FF;’,
-
7 => ‘color: #0000FF;’,
-
8 => ‘color: #0000FF;’,
-
9 => ‘color: #0000FF;’,
-
‘r_control’ => ‘color: #0000FF;’,
-
‘r_null’ => ‘color: #003300;’, // dark green
-
‘r_round’ => ‘color: #003300;’, // dark green
-
‘rhipe_rhcollect’ => ‘color: #993300;’, // brown
-
‘rhipe_rhgetkey’ => ‘color: #993300;’,
-
‘rhipe_rhex’ => ‘color: #993300;’,
-
‘rhipe_rhlapply’ => ‘color: #993300;’,
-
‘rhipe_rhmr’ => ‘color: #993300;’,
-
‘rhipe_rhput’ => ‘color: #993300;’
-
),
-
1 => ‘color: #228B22;’,
-
),
-
0 => ”
-
),
-
0 => ‘color: #080;’
-
),
-
//0 => ‘color: #A020F0;’
-
),
-
0 => ‘color: #ff0000;’
-
),
-
1 => ”,
-
2 => ”
-
),
-
0 => ‘color: #080;’
-
),
-
0 => ‘color:#A020F0;’
-
),
-
0 => ”
-
)
-
),
-
1 => ‘http://astrostatistics.psu.edu/datasets/R/html/base/html/00Index.html’,
-
2 => ‘http://astrostatistics.psu.edu/su07/R/html/graphics/html/{FNAME}.html’,
-
3 => ‘http://astrostatistics.psu.edu/su07/R/html/stats/html/Normal.html’,
-
4 => ‘http://astrostatistics.psu.edu/su07/R/html/stats/html/{FNAME}.html’,
-
5 => ‘http://astrostatistics.psu.edu/su07/R/html/stats/html/summary.lm.html’,
-
6 => ‘http://astrostatistics.psu.edu/su07/R/html/base/html/Log.html’,
-
7 => ‘http://astrostatistics.psu.edu/datasets/R/html/base/html/eval.html’,
-
8 => ‘http://www.iiap.res.in/astrostat/School07/R/html/base/html/{FNAME}.html’, // base package version 2.5
-
9 => ‘http://www.iiap.res.in/astrostat/School07/R/html/base/html/seq.html’, // base package version 2.5
-
‘r_control’ => ‘http://www.astrostatistics.psu.edu/datasets/R/html/base/html/Control.html’,
-
‘r_null’ => ‘http://www.astrostatistics.psu.edu/datasets/R/html/base/html/NULL.html’,
-
‘r_round’ => ‘http://www.iiap.res.in/astrostat/School07/R/html/base/html/Round.html’,
-
‘rhipe_rhcollect’ => ‘http://www.stat.purdue.edu/~sguha/rhipe/doc/html/mr.html#rhcollect-writing-data-to-hadoop-mapreduce’,
-
‘rhipe_rhex’ => ‘http://www.stat.purdue.edu/~sguha/rhipe/doc/html/functions.html#rhex-submitting-a-mapreduce-r-object-to-hadoop’,
-
‘rhipe_rhgetkey’ => ‘http://www.stat.purdue.edu/~sguha/rhipe/doc/html/functions.html#rhgetkeys-reading-values-from-map-files’,
-
‘rhipe_rhlapply’ => ‘http://www.stat.purdue.edu/~sguha/rhipe/doc/html/rhlapply.html’,
-
‘rhipe_rhmr’ => ‘http://www.stat.purdue.edu/~sguha/rhipe/doc/html/mr.html#rhmr-creating-the-mapreduce-object’,
-
‘rhipe_rhput’ => ‘http://www.stat.purdue.edu/~sguha/rhipe/doc/html/functions.html#rhput-copying-to-the-hdf’
-
),
-
‘OOLANG’ => true,
-
1 => ‘.’,
-
2 => ‘::’
-
),
-
GESHI_SEARCH => "([^\w])’([^\\n\\r']*)’",
-
GESHI_REPLACE => ‘\\2′,
-
GESHI_MODIFIERS => ”,
-
GESHI_BEFORE => "\\1′",
-
GESHI_AFTER => "’"
-
)
-
),
-
‘STRICT_MODE_APPLIES’ => GESHI_NEVER,
-
),
-
)
-
);
-
-
?>
February 13th, 2011 at 12:17 pm
[...] 132 languages plus my own R highlighter. [...]
February 16th, 2011 at 11:58 am
[...] technique. One special feature I add to my R video recordings is the addition of my own R source code highlighting and math symbol publishing plugins for WordPress blogs. The highlighting is unique in that R [...]
April 9th, 2011 at 11:19 pm
XmVCZF I’m not easily impressed. . . but that’s impressing me!
March 1st, 2012 at 1:10 pm
Thanks for another informative site. Where else could I get that kind of information written in such an ideal way? I’ve a project that I am just now working on, and I’ve been on the look out for such information.
June 7th, 2012 at 6:45 am
I am very amazed by the information of this blog and i am glad i had a look over the blog. thank you so much for sharing such great information.