rk.XML.vars: Create a variable selector for RKWard plugins

View source: R/rk.XML.vars.R

rk.XML.varsR Documentation

Create a variable selector for RKWard plugins

Description

This function will create a <frame> node including a <varselector> and a <varslot> node. It is actually a wrapper for rk.XML.varslot and rk.XML.varselector, since you usually won't define one without the other.

Usage

rk.XML.vars(
  label,
  slot.text,
  required = FALSE,
  multi = FALSE,
  duplicates = 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,
  dep.options = list(),
  id.name = "auto",
  help = NULL,
  component = rk.get.comp()
)

Arguments

label

Character string, a text label for the variable browser.

slot.text

Character string, a text label for the variable selection slot.

required

Logical, whether the selection of variables is mandatory or not.

multi

Logical, whether the varslot holds only one or several objects.

duplicates

Logical, if multi=TRUE defines whether the same entry may be added multiple times. Sets multi=TRUE.

min

If multi=TRUE defines how many objects must be selected.

any

If multi=TRUE defines how many objects must be selected at least if any are selected at all.

max

If multi=TRUE defines how many objects can be selected in total (0 means any number).

dim

The number of dimensions, an object needs to have. If dim=0 any number of dimensions is acceptable.

min.len

The minimum length, an object needs to have.

max.len

The maximum length, an object needs to have. If NULL, defaults to the largest integer number representable on the system.

classes

An optional character vector, defining class names to which the selection must be limited.

types

If you specify one or more variables types here, the varslot will only accept objects of those types. Valid types are "unknown", "numeric", "string", "factor", "invalid". Optional, use with great care, the user should not be prevented from making valid choices, and rkward does not always know the type of a variable!

horiz

Logical. If TRUE, the varslot will be placed next to the selector, if FALSE below it.

add.nodes

A list of objects of class XiMpLe.node to be placed after the varslot.

frame.label

Character string, a text label for the whole frame.

formula.dependent

Character string, if not NULL will cause the addition of a second varslot for the dependent variable(s), using the text of formula.dependent as its label. Also a <formula> node will be added, using both varslots for fixed_factors and dependent respectively.

dep.options

A named list with optional attributes for the dependent varslot, if formula.dependent is not NULL. Valid options are required, multi, min, any, max, dim, min.len, max.len, classes and types. If an options is undefined, it defaults to the same values like the main options of this function.

id.name

Character vector, unique IDs for the frame (first entry), the varselector (second entry) and varslot (third entry). If formula.dependent is not NULL, a fourth and fifth entry is needed as well, for the dependent varslot and the formula node, respectively. If "auto", IDs will be generated automatically from label and slot.text.

help

Character string or list of character values and XiMpLe nodes, will be used as the text value for a setting node in the .rkh file. If set to FALSE, rk.rkh.scan will ignore this node. Also needs component to be set accordingly!

component

Character string, name of the component this node belongs to. Only needed if you want to use the scan features for automatic help file generation; needs help to be set accordingly, too!

Value

An object of class XiMpLe.node.

See Also

rk.XML.varslot, rk.XML.varselector, and the Introduction to Writing Plugins for RKWard

Examples

test.vars <- rk.XML.vars("Select some vars", "Vars go here")
cat(pasteXML(test.vars))

rkward-community/rkwarddev documentation built on May 9, 2022, 3:02 p.m.