Last data update: 2014.03.03

R: Functions to construct a widget that takes inputs from users
argsWidgetR Documentation

Functions to construct a widget that takes inputs from users

Description

Given a argument list, the functions construct a widget to allow users to entry or select values for arguments defined by the names of the argument list.

Usage

argsWidget(argsList, defaultNames, inst = "")
getPWidget(argsList, PWEnv, inst = "")
formatArg(toFormat)
getSymbol(args)
funcs2Char(args,funcs)
getTrueNullNa(toFormat)

Arguments

argsList

argsList a list of arguments with or without default values. The list can be derived from e.g. formals

PWEnv

PWEnv an R environment used object to store data for the argument list

toFormat

toFormat element to be formated by formatArg

args

args arguments to be formated

funcs

funcs a list containing the arguments that are functions

defaultNames

defaultNames a vector of character strings of length 2 for two default buttons to be rendered. The first one is to end the process and the second to abort the process

inst

inst a character string for a short instuction that will appear on the top of a widget

Details

argsWidget builds a widget with widget elements to allow users to input values for the arguments.

getPWidget instatiates primary widgets that will be used to construct the widget for argements.

formatArg formats the value for a given argument so that the calue can be displayed by a tcltk widget.

getSymbol filters out functions from the argument list.

funcs2Char converts functions to character representations of the functions.

getTrueNullNa converts string "true", "false", "null", and "na" to R primitives for these items.

Value

argsWidget returns a list with user input values for elements of the argument list passed.

getPWidget returns a list of primary widgets.

formatArg returns a list containing the formated values.

getSymbol returns a list containing arguments that are functions.

funcs2Char returns a list containing character representations of functions.

getTrueNullNa returns an R object.

Author(s)

Jianhua Zhang

References

R tcltk

Examples

  if(interactive()){
      argsWidget(list("Entry with default" = "default",
                      "Entry without default" = ""))
  }

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(tkWidgets)
Error in library(tkWidgets) : there is no package called 'tkWidgets'
Execution halted