[rkward-cvs] SF.net SVN: rkward:[3821] trunk/rkward/rkward/rbackend/rpackages/rkwarddev

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Fri Sep 23 14:00:04 UTC 2011


Revision: 3821
          http://rkward.svn.sourceforge.net/rkward/?rev=3821&view=rev
Author:   m-eik
Date:     2011-09-23 14:00:03 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
rkwarddev: added rk.XML.formula() and option to provide static logic code

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/NAMESPACE
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/inst/CITATION
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd

Added Paths:
-----------
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.formula.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.formula.Rd

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog	2011-09-23 07:10:10 UTC (rev 3820)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog	2011-09-23 14:00:03 UTC (rev 3821)
@@ -1,5 +1,10 @@
 ChangeLog for package rkwarddev
 
+## 0.01-5 (2011-09-23)
+  - added function rk.XML.formula()
+  - added possibility to add custom XML code to the logic section with rk.XML.plugin()
+    and rk.plugin.skeleton()
+
 ## 0.01-4 (2011-09-22)
   - fixed wrong doc link and one wrong object name in rk.plugin.skeleton()
   - fixed attribute typo in rk.XML.vars()

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION	2011-09-23 07:10:10 UTC (rev 3820)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION	2011-09-23 14:00:03 UTC (rev 3821)
@@ -14,8 +14,8 @@
 URL: http://rkward.sourceforge.net
 Authors at R: c(person(given="Meik", family="Michalke",
     email="meik.michalke at hhu.de", role=c("aut", "cre")))
-Version: 0.01-4
-Date: 2011-09-22
+Version: 0.01-5
+Date: 2011-09-23
 Collate:
     'rk-internal.R'
     'rk.JS.array.R'
@@ -32,6 +32,7 @@
     'rk.XML.cbox.R'
     'rk.XML.col.R'
     'rk.XML.dropdown.R'
+    'rk.XML.formula.R'
     'rk.XML.frame.R'
     'rk.XML.input.R'
     'rk.XML.pluginmap.R'

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/NAMESPACE
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/NAMESPACE	2011-09-23 07:10:10 UTC (rev 3820)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/NAMESPACE	2011-09-23 14:00:03 UTC (rev 3821)
@@ -10,6 +10,7 @@
 export(rk.XML.cbox)
 export(rk.XML.col)
 export(rk.XML.dropdown)
+export(rk.XML.formula)
 export(rk.XML.frame)
 export(rk.XML.input)
 export(rk.XML.plugin)

Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.formula.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.formula.R	                        (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.formula.R	2011-09-23 14:00:03 UTC (rev 3821)
@@ -0,0 +1,18 @@
+#' Create XML node "formula" for RKWard plugins
+#'
+#' @param fixed The \code{id} of the varslot holding the selected fixed factors.
+#' @param dependent The \code{id} of the varslot holding the selected dependent variable.
+#' @return An object of class \code{XiMpLe.node}.
+#' @export
+#' @examples
+#' test.formula <- rk.XML.formula(fixed="vrs.one", dependent="vsr.two")
+#' cat(pasteXMLNode(test.formula, shine=1))
+
+rk.XML.formula <- function(fixed, dependent){
+	node <- new("XiMpLe.node",
+			name="formula",
+			attributes=list("fixed_factors"=fixed, dependent=dependent)
+		)
+
+	return(node)
+}

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R	2011-09-23 07:10:10 UTC (rev 3820)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R	2011-09-23 14:00:03 UTC (rev 3821)
@@ -6,9 +6,9 @@
 #' @param wiz.children An optional list with objects of class \code{XiMpLe.node}. Will be included inside the top level node as the wizard code
 #'		(but only if \code{provides} includes \code{"wizard"} as well).
 #' @param help Logical, if \code{TRUE} an include tag for a help file named \emph{"<name>.rkh"} will be added to the header.
-#' @param logic Logical, if \code{TRUE} a logic section will be added to the document.
-#'		This must be edited manually, it is therefore commented out.
-#' @param provides Character vector with at least one entry of \code{"dialog"} or \code{"wizard"}, defining what the document provides.
+#' @param logic Character string, will be pasted as-is inside the \code{<logic>} section (but only if \code{provides} includes \code{"logic"} as well). 
+#' @param provides Character vector with at least one entry of \code{"logic"}, \code{"dialog"} or \code{"wizard"}, defining what the document provides.
+#'		If \code{"logic"} is specified, a logic section will be added to the document. If \code{logic=NULL}, must be edited manually and is therefore commented out.
 #' @param pluginmap Character string, relative path to the pluginmap file, which will then be included in the head of this document.
 #' @return An object of class \code{XiMpLe.doc}.
 #' @export
@@ -27,7 +27,7 @@
 #' test.plugin <- rk.XML.plugin("My test", label="Check this out", children=test.tabbook)
 #' cat(pasteXMLTree(test.plugin, shine=1))
 
-rk.XML.plugin <- function(name, label, children=list(), wiz.children=list(), help=TRUE, logic=TRUE, provides=c("dialog"), pluginmap=NULL){
+rk.XML.plugin <- function(name, label, children=list(), wiz.children=list(), help=TRUE, logic=NULL, provides=c("logic", "dialog"), pluginmap=NULL){
 	name.orig <- name
 	name <- gsub("[[:space:]]*[^[:alnum:]]*", "", name)
 	if(!identical(name.orig, name)){
@@ -53,18 +53,27 @@
 		)
 	} else {}
 
-	if(isTRUE(logic)){
+	if("logic" %in% provides){
+		if(is.null(logic)){
+			lgc.children <- list(
+					new("XiMpLe.node",
+						# add these as comments because they need editing
+						name="!--",
+						value="<convert id=\"!edit!\", mode=\"!edit!\", sources=\"!edit!\", standard=\"!edit!\" />"),
+					new("XiMpLe.node",
+						name="!--",
+						value="<connect client=\"!edit!\", governor=\"!edit!\" />")
+				)
+		} else {
+			lgc.children <- list(
+					new("XiMpLe.node",
+						name="",
+						value=logic)
+				)
+		}
 		all.children[[length(all.children)+1]] <- new("XiMpLe.node",
 			name="logic",
-			children=list(
-				new("XiMpLe.node",
-					# add these as comments because they need editing
-					name="!--",
-					value="<convert id=\"!edit!\", mode=\"!edit!\", sources=\"!edit!\", standard=\"!edit!\" />"),
-				new("XiMpLe.node",
-					name="!--",
-					value="<connect client=\"!edit!\", governor=\"!edit!\" />")
-			)
+			children=lgc.children
 		)
 	} else {}
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R	2011-09-23 07:10:10 UTC (rev 3820)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R	2011-09-23 14:00:03 UTC (rev 3821)
@@ -16,6 +16,7 @@
 #'		Defaults to \code{TRUE}.
 #' @param lazyLoad Logical, whether the package should be prepared for lazy loading or not. Should be left \code{TRUE},
 #'		unless you have very good reasons not to.
+#' @param logic A character string with logic XML code, will be pasted as-is inside the \code{<logic>} section. 
 #' @param JS.prep A character string with JavaScript code to be included in the \code{preprocess()} function. This string will be
 #'		pasted as-is, see \code{\link[rkwarddev:rk.JS.doc]{rk.JS.doc}}.
 #' @param JS.calc A character string with JavaScript code to be included in the \code{calculate()} function. This string will be
@@ -96,7 +97,7 @@
 #' }
 
 rk.plugin.skeleton <- function(name, about, path=tempdir(), dialog=list(), wiz.dialog=list(),
-	dial.require=c(), overwrite=FALSE, wizard=FALSE, tests=TRUE, lazyLoad=TRUE,
+	dial.require=c(), overwrite=FALSE, wizard=FALSE, tests=TRUE, lazyLoad=TRUE, logic=NULL,
 	JS.prep=NULL, JS.calc=NULL, JS.prnt=NULL, create=c("pmap", "xml", "js", "rkh", "desc"), edit=FALSE){
 	# to besure, remove all non-character symbols from name
 	name.orig <- name
@@ -161,15 +162,16 @@
 	## create plugin.xml
 	if("xml" %in% create & isTRUE(checkCreateFiles(plugin.xml))){
 		if(isTRUE(wizard))
-			plugin.provides <- c("dialog","wizard")
+			plugin.provides <- c("logic","dialog","wizard")
 		else {
-			plugin.provides <- "dialog"
+			plugin.provides <- c("logic","dialog")
 		}
 		XML.plugin <- rk.XML.plugin(
 			name=name,
 			label=name.orig,
 			children=dialog,
 			wiz.children=wiz.dialog,
+			logic=logic,
 			provides=plugin.provides,
 			pluginmap=paste("../", name, ".pluginmap", sep=""))
 		cat(pasteXMLTree(XML.plugin, shine=1), file=plugin.xml)

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R	2011-09-23 07:10:10 UTC (rev 3820)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R	2011-09-23 14:00:03 UTC (rev 3821)
@@ -3,8 +3,8 @@
 #' \tabular{ll}{
 #' Package: \tab rkwarddev\cr
 #' Type: \tab Package\cr
-#' Version: \tab 0.01-4\cr
-#' Date: \tab 2011-09-22\cr
+#' Version: \tab 0.01-5\cr
+#' Date: \tab 2011-09-23\cr
 #' Depends: \tab R (>= 2.9.0),XiMpLe,rkward\cr
 #' Enhances: \tab rkward\cr
 #' Encoding: \tab UTF-8\cr

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/inst/CITATION
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/inst/CITATION	2011-09-23 07:10:10 UTC (rev 3820)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/inst/CITATION	2011-09-23 14:00:03 UTC (rev 3821)
@@ -1,14 +1,13 @@
 bibentry("Manual",
 		title="rkwarddev: A collection of tools for RKWard plugin development",
-		author=c(person(given="Meik", family="Michalke", email="meik.michalke at hhu.de",
-			role=c("aut", "cre"))),
+		author="Meik Michalke",
 		year="2011",
-		note="(Version 0.01-4)",
+		note="(Version 0.01-5)",
 		url="http://rkward.sourceforge.net",
 
 		textVersion =
 		paste("Michalke, M. (2011). ",
-				"rkwarddev: A collection of tools for RKWard plugin development (Version 0.01-4). ",
+				"rkwarddev: A collection of tools for RKWard plugin development (Version 0.01-5). ",
 				"Available from http://rkward.sourceforge.net",
 				sep=""),
 

Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.formula.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.formula.Rd	                        (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.formula.Rd	2011-09-23 14:00:03 UTC (rev 3821)
@@ -0,0 +1,24 @@
+\name{rk.XML.formula}
+\alias{rk.XML.formula}
+\title{Create XML node "formula" for RKWard plugins}
+\usage{
+  rk.XML.formula(fixed, dependent)
+}
+\arguments{
+  \item{fixed}{The \code{id} of the varslot holding the
+  selected fixed factors.}
+
+  \item{dependent}{The \code{id} of the varslot holding the
+  selected dependent variable.}
+}
+\value{
+  An object of class \code{XiMpLe.node}.
+}
+\description{
+  Create XML node "formula" for RKWard plugins
+}
+\examples{
+test.formula <- rk.XML.formula(fixed="vrs.one", dependent="vsr.two")
+cat(pasteXMLNode(test.formula, shine=1))
+}
+

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd	2011-09-23 07:10:10 UTC (rev 3820)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd	2011-09-23 14:00:03 UTC (rev 3821)
@@ -3,8 +3,8 @@
 \title{Create XML document for RKWard plugins}
 \usage{
   rk.XML.plugin(name, label, children = list(),
-  wiz.children = list(), help = TRUE, logic = TRUE,
-  provides = c("dialog"), pluginmap = NULL)
+  wiz.children = list(), help = TRUE, logic = NULL,
+  provides = c("logic", "dialog"), pluginmap = NULL)
 }
 \arguments{
   \item{name}{Character string, the name of the plugin.}
@@ -25,13 +25,16 @@
   help file named \emph{"<name>.rkh"} will be added to the
   header.}
 
-  \item{logic}{Logical, if \code{TRUE} a logic section will
-  be added to the document. This must be edited manually,
-  it is therefore commented out.}
+  \item{logic}{Character string, will be pasted as-is
+  inside the \code{<logic>} section (but only if
+  \code{provides} includes \code{"logic"} as well).}
 
   \item{provides}{Character vector with at least one entry
-  of \code{"dialog"} or \code{"wizard"}, defining what the
-  document provides.}
+  of \code{"logic"}, \code{"dialog"} or \code{"wizard"},
+  defining what the document provides. If \code{"logic"} is
+  specified, a logic section will be added to the document.
+  If \code{logic=NULL}, must be edited manually and is
+  therefore commented out.}
 
   \item{pluginmap}{Character string, relative path to the
   pluginmap file, which will then be included in the head

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd	2011-09-23 07:10:10 UTC (rev 3820)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd	2011-09-23 14:00:03 UTC (rev 3821)
@@ -5,9 +5,9 @@
   rk.plugin.skeleton(name, about, path = tempdir(), dialog
   = list(), wiz.dialog = list(), dial.require = c(),
   overwrite = FALSE, wizard = FALSE, tests = TRUE, lazyLoad
-  = TRUE, JS.prep = NULL, JS.calc = NULL, JS.prnt = NULL,
-  create = c("pmap", "xml", "js", "rkh", "desc"), edit =
-  FALSE)
+  = TRUE, logic = NULL, JS.prep = NULL, JS.calc = NULL,
+  JS.prnt = NULL, create = c("pmap", "xml", "js", "rkh",
+  "desc"), edit = FALSE)
 }
 \arguments{
   \item{name}{Character sting, name of the plugin package.}
@@ -46,6 +46,9 @@
   prepared for lazy loading or not. Should be left
   \code{TRUE}, unless you have very good reasons not to.}
 
+  \item{logic}{A character string with logic XML code, will
+  be pasted as-is inside the \code{<logic>} section.}
+
   \item{JS.prep}{A character string with JavaScript code to
   be included in the \code{preprocess()} function. This
   string will be pasted as-is, see

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd	2011-09-23 07:10:10 UTC (rev 3820)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd	2011-09-23 14:00:03 UTC (rev 3821)
@@ -8,8 +8,8 @@
 }
 \details{
   \tabular{ll}{ Package: \tab rkwarddev\cr Type: \tab
-  Package\cr Version: \tab 0.01-4\cr Date: \tab
-  2011-09-22\cr Depends: \tab R (>= 2.9.0),XiMpLe,rkward\cr
+  Package\cr Version: \tab 0.01-5\cr Date: \tab
+  2011-09-23\cr Depends: \tab R (>= 2.9.0),XiMpLe,rkward\cr
   Enhances: \tab rkward\cr Encoding: \tab UTF-8\cr License:
   \tab GPL (>= 3)\cr LazyLoad: \tab yes\cr URL: \tab
   http://rkward.sourceforge.net\cr }

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the rkward-tracker mailing list