Learn R Programming

RSurvey (version 0.7-3)

EditFunction: Function Editor for Table Data

Description

A GUI for defining functions in the Rlanguage.

Usage

EditFunction(cols, index = NULL, fun = NULL, value.length = NULL, 
             value.class = NULL, win.title = "Edit Function", parent = NULL)

Arguments

cols
list; see ManageData.
index
integer; an element index number in cols.
fun
character; existing function, only used if index=NULL.
value.length
integer; the required length for the evaluated function.
value.class
character; the required class for the evaluated function.
win.title
character; a string to display as the title of the dialog box.
parent
tkwin; the GUI parent window.

Value

  • Results in a character string of the user defined function; when evaluated, this string must be parseable.

Details

This GUI is appropriate for defining new variables in a pre-existing data frame or query building.

See Also

EvalFunction, parse

Examples

Run this code
d <- data.frame(cbind(x = 1, y = 1:10))
Data("data.raw", d)
cols <- list()
cols[[1]] <- list(id = "X", index = 1, fun = "\"X\"")
cols[[2]] <- list(id = "Y", index = 2, fun = "\"Y\"")
cols[[3]] <- list(id = "New Variable",
                  fun = "\"X\" + \"Y\"")
EditFunction(cols, index = 3)

Run the code above in your browser using DataLab