a positive integer, the number of subsets to be selected
return.indices
logical, whether indices (TRUE) or vector
contents (FALSE) are to be returned
setlabels
a character vector of labels for the subsets
edit.setlabels
logical, determines whether a textbox is
provided for editing the label of each subset
subset
logical, character or numeric vector indicating which
elements of vec should be made available for selection. Default is
to make all elements available.
warningText
character, text to use as a warning in situations
where no selection is made into one or more of the specified sets
title
character, title of the Tk dialog window
items.label
character,
a label for the set of items to be selected from
labels.prompt
character, a prompt for textual set label(s)
list.height
maximum number of elements of vec to display
at once
items.scrollbar
logical, whether a scrollbar is to be provided when
vec is longer than list.height
preserve.order
logical: should the order of items in vec
be maintained in all of the returned subsets?
graphics
logical: should a dialog be used, if possible?
listFont
a Tk font specification for the items list and subsets
labelFont
a Tk font specification for the labels entrybox
windowPos
position of the Tk dialog, in pixels from top left of
display
Details
If graphics = TRUE and the tcltk package is operational,
a Tk dialog is used, otherwise a text menu.
If return.indices is used together with subset, the
indices returned relate to vec, not to vec[subset].
Value
EITHER (in the case of a text menu or if the dialog is ended with "OK")
a list, with nsets components. Each component is a
selected sub-vector, or a numeric vector of indices for a
selected sub-vector (if return.indices is TRUE).
The component names are as specified in setlabels, or
as specified interactively.
OR (if the dialog is ended either "Cancel" or the close-window control
button is used)
NULL.
Author(s)
David Firth, with contributions from Heather Turner
Examples
## These examples cannot be run by example() but should be OK when pasted
## into an interactive R session
## Not run:
pickFrom(c("apple", "banana", "plum", "grapefruit"), nsets = 2,
preserve.order = FALSE,
setlabels = c("Fruits I like", "Fruits I tolerate"))
## End(Not run)
## Not run:
## Type selections as e.g. 1:2, 4
pickFrom(c("apple", "banana", "plum", "grapefruit"), nsets = 2,
preserve.order = FALSE,
setlabels = c("Fruits I like", "Fruits I tolerate"),
graphics = FALSE)
## End(Not run)