DescTools (version 0.99.13)

SelectVarDlg: Select Elements of a Set by Click

Description

SelectVarDlg is a GUI utility, which brings up a dialog and lets the user select elements (either variables of a data.frame or levels of a factor) by point and click in a listbox. The list of selected items is written to the clipboard so that the code can afterwards easily be pasted in the source file.

Usage

SelectVarDlg(x, ...)

## S3 method for class 'default':
SelectVarDlg(x, useIndex = FALSE, ...)

## S3 method for class 'factor':
SelectVarDlg(x, ...)

## S3 method for class 'data.frame':
SelectVarDlg(x, ...)

Arguments

x
the object containing the elements to be selected. x can be a data.frame, a factor or any other vector.
useIndex
defines, if the enquoted names (default) or the index values should be returned.
...
further arguments to be passed to the default function.

Value

  • A comma separated list with the selected values enquoted is returned invisibly as well as written to clipboard for easy inserting the text in an editor afterwards.

Details

When working with big data.frames with many variables it is often tedious to build subsets by typing the columnnames. Here is where the function comes in offering a "point and click" approach for selecting the interesting columns. When x is a data.frame the columnnames are listed, when x is a factor the levels are listed and in all other cases the list is filled wiht the unique elements of x.

See Also

select.list

Examples

Run this code
data(d.pizza)
SelectVarDlg(x = d.pizza, T)
SelectVarDlg(x = d.pizza$driver )

x <- replicate(10, paste( sample(LETTERS, 5, replace = TRUE), collapse="") )
SelectVarDlg(x)

Run the code above in your browser using DataCamp Workspace