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

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Wed Sep 28 11:01:35 UTC 2011


Revision: 3854
          http://rkward.svn.sourceforge.net/rkward/?rev=3854&view=rev
Author:   m-eik
Date:     2011-09-28 11:01:35 +0000 (Wed, 28 Sep 2011)
Log Message:
-----------
rkwarddev: added formula option to rk.XML.vars() and eased "multi" option in rk.XML.varslot()

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varslot.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.vars.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varslot.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog	2011-09-27 20:44:03 UTC (rev 3853)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog	2011-09-28 11:01:35 UTC (rev 3854)
@@ -1,5 +1,9 @@
 ChangeLog for package rkwarddev
 
+## 0.02-1 (2011-09-28)
+  - included formula node into rk.XML.vars() wrapper
+  - rk.XML.varslot() now automatically sets "multi=TRUE" if "min", "max" or "any" are set
+
 ## 0.02-0 (2011-09-27)
   - redesigned options for rk.XML.plugin() and rk.plugin.skeleton() for more consistency.
     unfortunately, this breaks backwards compatibility!

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION	2011-09-27 20:44:03 UTC (rev 3853)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION	2011-09-28 11:01:35 UTC (rev 3854)
@@ -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.02-0
-Date: 2011-09-27
+Version: 0.02-1
+Date: 2011-09-28
 Collate:
     'rk-internal.R'
     'rk.JS.array.R'

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R	2011-09-27 20:44:03 UTC (rev 3853)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R	2011-09-28 11:01:35 UTC (rev 3854)
@@ -29,12 +29,16 @@
 #' @param add.nodes A list of objects of class \code{XiMpLe.node} to be placed after the varslot.
 #' @param frame.label Character string, a text label for the whole frame.
 #' @param formula.dependent Character string, if not \code{NULL} will cause the addition of a second
-#'		varslot for the dependent variable(s), using the text of \code{formula.dependent} as the label. Also
+#'		varslot for the dependent variable(s), using the text of \code{formula.dependent} as its label. Also
 #'		a \code{<formula>} node will be added, using both varslots for \code{fixed_factors} and \code{dependent}
 #'		respectively.
+#' @param dep.options A named list with optional attributes for the \code{dependent} varslot, if \code{formula.dependent}
+#'		is not \code{NULL}. Valid options are \code{required}, \code{multi}, \code{min}, \code{any}, \code{max},
+#'		\code{dim}, \code{min.len}, \code{max.len}, \code{classes} and \code{types}. If an options is undefined, it defaults
+#'		to the same values like the main options of this function.
 #' @param id.name Character vector, unique IDs for the frame (first entry), the varselector (second entry)
-#'		and varslot (third entry). If \code{formula.dependent} is not \code{NULL}, a fourth entry is needed for
-#'		the formula node as well.
+#'		and varslot (third entry). If \code{formula.dependent} is not \code{NULL}, a fourth and fifth entry is needed as well,
+#'		for the dependent varslot and the formula node, respectively.
 #'		If \code{"auto"}, IDs will be generated automatically from \code{label} and \code{slot.text}.
 #' @return An object of class \code{XiMpLe.node}.
 #' @export
@@ -47,7 +51,7 @@
 
 rk.XML.vars <- function(label, slot.text, required=FALSE, multi=FALSE, min=1, any=1, max=0,
 	dim=0, min.len=0, max.len=NULL, classes=NULL, types=NULL, horiz=TRUE, add.nodes=NULL,
-	frame.label=NULL, formula.dependent=NULL, id.name="auto"){
+	frame.label=NULL, formula.dependent=NULL, dep.options=list(), id.name="auto"){
 
 	if(identical(id.name, "auto")){
 		## if this ID generation get's changed, change it in rk.XML.varslot(), too!
@@ -55,12 +59,14 @@
 		var.slot.id <- auto.ids(slot.text, prefix=ID.prefix("varslot", length=4))
 		if(!is.null(formula.dependent)){
 			var.dep.id <- auto.ids(formula.dependent, prefix=ID.prefix("varslot", length=4))
+			frml.id <- auto.ids(formula.dependent, prefix=ID.prefix("formula", length=3))
 		} else {}
 	} else if(!is.null(id.name)){
 		var.sel.attr <- list(id=id.name[[2]])
 		var.slot.id <- id.name[[3]]
 		if(!is.null(formula.dependent)){
 			var.dep.id <- id.name[[4]]
+			frml.id <- id.name[[5]]
 		} else {}
 	} else {}
 
@@ -85,28 +91,30 @@
 		types=types,
 		id.name=var.slot.id)
 
-		if(!is.null(formula.dependent)){
-			# var.dep.id
-			dep.slot <- rk.XML.varslot(
-				label=formula.dependent,
-				source=v.selector,
-				required=required,
-				multi=multi,
-				min=min,
-				any=any,
-				max=max,
-				dim=dim,
-				min.len=min.len,
-				max.len=max.len,
-				classes=classes,
-				types=types,
-				id.name=var.dep.id)
-		} else {
-			dep.slot <- NULL
-		}
+	slot.content <- list(v.slot)
 
+	if(!is.null(formula.dependent)){
+		dep.opt.names <- names(dep.options)
+		dep.slot <- rk.XML.varslot(
+			label=formula.dependent,
+			source=v.selector,
+			required=if ("required" %in% dep.opt.names) {dep.options[["required"]]} else {FALSE},
+			multi=if ("multi" %in% dep.opt.names) {dep.options[["multi"]]} else {FALSE},
+			min=if ("min" %in% dep.opt.names) {dep.options[["min"]]} else {1},
+			any=if ("any" %in% dep.opt.names) {dep.options[["any"]]} else {1},
+			max=if ("max" %in% dep.opt.names) {dep.options[["max"]]} else {0},
+			dim=if ("dim" %in% dep.opt.names) {dep.options[["dim"]]} else {0},
+			min.len=if ("min.len" %in% dep.opt.names) {dep.options[["min.len"]]} else {0},
+			max.len=if ("max.len" %in% dep.opt.names) {dep.options[["max.len"]]} else {NULL},
+			classes=if ("classes" %in% dep.opt.names) {dep.options[["classes"]]} else {NULL},
+			types=if ("types" %in% dep.opt.names) {dep.options[["types"]]} else {NULL},
+			id.name=var.dep.id)
+		slot.content[[length(slot.content) + 1]] <- dep.slot
+		formula.node <- rk.XML.formula(fixed=v.slot, dependent=dep.slot, id.name=frml.id)
+		slot.content[[length(slot.content) + 1]] <- formula.node
+	} else {}
+
 	# do we need to add extra nodes to the varslot?
-	slot.content <- list(v.slot)
 	if(!is.null(add.nodes)){
 		for (this.node in add.nodes) {
 			slot.content[[length(slot.content)+1]] <- this.node

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varslot.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varslot.R	2011-09-27 20:44:03 UTC (rev 3853)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.varslot.R	2011-09-28 11:01:35 UTC (rev 3854)
@@ -6,11 +6,11 @@
 #'		a \code{<varselector>} node).
 #' @param required Logical, whether the selection of variables is mandatory or not.
 #' @param multi Logical, whether the varslot holds only one or several objects.
-#' @param min If \code{multi=TRUE} defines how many objects must be selected.
+#' @param min If \code{multi=TRUE} defines how many objects must be selected. Sets \code{multi=TRUE}.
 #' @param any If \code{multi=TRUE} defines how many objects must be selected at least if any
-#'		are selected at all.
+#'		are selected at all. Sets \code{multi=TRUE}.
 #' @param max If \code{multi=TRUE} defines how many objects can be selected in total
-#'		(0 means any number).
+#'		(0 means any number). Sets \code{multi=TRUE}.
 #' @param dim The number of dimensions, an object needs to have. If \code{dim=0} any number
 #'		of dimensions is acceptable.
 #' @param min.len The minimum length, an object needs to have.
@@ -69,7 +69,9 @@
 	if(isTRUE(required)){
 		var.slot.attr[["required"]] <- "true"
 	} else {}
-	if(isTRUE(multi)){
+
+	# "multi" is mandatory if min, max or any are set
+	if(isTRUE(multi) | min > 1 | any > 1 | max > 0){
 		var.slot.attr[["multi"]] <- "true"
 		if(min > 1){
 			var.slot.attr[["min_vars"]] <- min

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R	2011-09-27 20:44:03 UTC (rev 3853)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R	2011-09-28 11:01:35 UTC (rev 3854)
@@ -3,8 +3,8 @@
 #' \tabular{ll}{
 #' Package: \tab rkwarddev\cr
 #' Type: \tab Package\cr
-#' Version: \tab 0.02-0\cr
-#' Date: \tab 2011-09-27\cr
+#' Version: \tab 0.02-1\cr
+#' Date: \tab 2011-09-28\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-27 20:44:03 UTC (rev 3853)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/inst/CITATION	2011-09-28 11:01:35 UTC (rev 3854)
@@ -2,12 +2,12 @@
 		title="rkwarddev: A collection of tools for RKWard plugin development",
 		author="Meik Michalke",
 		year="2011",
-		note="(Version 0.02-0)",
+		note="(Version 0.02-1)",
 		url="http://rkward.sourceforge.net",
 
 		textVersion =
 		paste("Michalke, M. (2011). ",
-				"rkwarddev: A collection of tools for RKWard plugin development (Version 0.02-0). ",
+				"rkwarddev: A collection of tools for RKWard plugin development (Version 0.02-1). ",
 				"Available from http://rkward.sourceforge.net",
 				sep=""),
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd	2011-09-27 20:44:03 UTC (rev 3853)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd	2011-09-28 11:01:35 UTC (rev 3854)
@@ -6,7 +6,8 @@
   FALSE, min = 1, any = 1, max = 0, dim = 0, min.len = 0,
   max.len = NULL, classes = NULL, types = NULL, horiz =
   TRUE, add.nodes = NULL, frame.label = NULL,
-  formula.dependent = NULL, id.name = "auto")
+  formula.dependent = NULL, dep.options = list(), id.name =
+  "auto")
 }
 \arguments{
   \item{label}{Character string, a text label for the
@@ -63,16 +64,26 @@
   \item{formula.dependent}{Character string, if not
   \code{NULL} will cause the addition of a second varslot
   for the dependent variable(s), using the text of
-  \code{formula.dependent} as the label. Also a
+  \code{formula.dependent} as its label. Also a
   \code{<formula>} node will be added, using both varslots
   for \code{fixed_factors} and \code{dependent}
   respectively.}
 
+  \item{dep.options}{A named list with optional attributes
+  for the \code{dependent} varslot, if
+  \code{formula.dependent} is not \code{NULL}. Valid
+  options are \code{required}, \code{multi}, \code{min},
+  \code{any}, \code{max}, \code{dim}, \code{min.len},
+  \code{max.len}, \code{classes} and \code{types}. If an
+  options is undefined, it defaults to the same values like
+  the main options of this function.}
+
   \item{id.name}{Character vector, unique IDs for the frame
   (first entry), the varselector (second entry) and varslot
   (third entry). If \code{formula.dependent} is not
-  \code{NULL}, a fourth entry is needed for the formula
-  node as well. If \code{"auto"}, IDs will be generated
+  \code{NULL}, a fourth and fifth entry is needed as well,
+  for the dependent varslot and the formula node,
+  respectively. If \code{"auto"}, IDs will be generated
   automatically from \code{label} and \code{slot.text}.}
 }
 \value{

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varslot.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varslot.Rd	2011-09-27 20:44:03 UTC (rev 3853)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.varslot.Rd	2011-09-28 11:01:35 UTC (rev 3854)
@@ -24,13 +24,15 @@
   or several objects.}
 
   \item{min}{If \code{multi=TRUE} defines how many objects
-  must be selected.}
+  must be selected. Sets \code{multi=TRUE}.}
 
   \item{any}{If \code{multi=TRUE} defines how many objects
-  must be selected at least if any are selected at all.}
+  must be selected at least if any are selected at all.
+  Sets \code{multi=TRUE}.}
 
   \item{max}{If \code{multi=TRUE} defines how many objects
-  can be selected in total (0 means any number).}
+  can be selected in total (0 means any number). Sets
+  \code{multi=TRUE}.}
 
   \item{dim}{The number of dimensions, an object needs to
   have. If \code{dim=0} any number of dimensions is

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd	2011-09-27 20:44:03 UTC (rev 3853)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd	2011-09-28 11:01:35 UTC (rev 3854)
@@ -8,8 +8,8 @@
 }
 \details{
   \tabular{ll}{ Package: \tab rkwarddev\cr Type: \tab
-  Package\cr Version: \tab 0.02-0\cr Date: \tab
-  2011-09-27\cr Depends: \tab R (>= 2.9.0),XiMpLe,rkward\cr
+  Package\cr Version: \tab 0.02-1\cr Date: \tab
+  2011-09-28\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