[Sciviews-commits] r151 - in komodo/SciViews-K/templates: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 10 10:16:15 CEST 2009


Author: phgrosjean
Date: 2009-07-10 10:16:15 +0200 (Fri, 10 Jul 2009)
New Revision: 151

Added:
   komodo/SciViews-K/templates/R/
   komodo/SciViews-K/templates/R/R S3 object.R
   komodo/SciViews-K/templates/R/R.R
Log:
New R template files

Added: komodo/SciViews-K/templates/R/R S3 object.R
===================================================================
--- komodo/SciViews-K/templates/R/R S3 object.R	                        (rev 0)
+++ komodo/SciViews-K/templates/R/R S3 object.R	2009-07-10 08:16:15 UTC (rev 151)
@@ -0,0 +1,48 @@
+# S3 object: [[%ask1:Class]]
+# Author:    [[%ask:Author]]
+
+# Creator of the S3 object (usually, a function with the same name)
+"[[%ask1]]" <- # S3 class
+function() {
+	# Code to create the object here...
+	obj <- "[[%ask1]] object"
+	class(obj) <- [[%ask1]]
+	return(obj)
+}
+
+# Usual methods
+"print.[[%ask1]]" <- # S3 method: print
+function (x, ...) {
+	# Code to print the object here...
+	cat ("[[%ask1]] object printed\n")
+	return(invisible(x))
+}
+
+"summary.[[%ask1]]" <- # S3 method: summary
+function (object, ...)
+	structure(object, class = c("summary.[[%ask1]]", class(object)))
+
+"print.summary.[[%ask1]]" <- # S3 method: print.(summary)
+function (x, ...) {
+	# Code to print the summary of the object here...
+	cat ("[[%ask1]] object summarized\n")
+	return(invisible(x))
+}
+
+"plot.[[%ask1]]" <- # S3 method: plot
+function (x, ...) {
+	# Code to plot the object here...
+	cat ("[[%ask1]] object plotted\n")
+	invisible()
+}
+
+# Define a new generic...
+"[[%ask2:NewMethod]]" <- # S3 generic
+function (x, ...)
+	NextMethod("[[%ask2]]")
+
+# ... and use it
+"[[%ask2]].[[%ask1]]" <- # S3 method: [[%ask2]]
+function (x, ...) {
+	# Code here...
+}
\ No newline at end of file

Added: komodo/SciViews-K/templates/R/R.R
===================================================================



More information about the Sciviews-commits mailing list