Learn R Programming

RSurvey (version 0.7-9)

EditFunction: Edit Function

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 ManageVariables.
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

  • Returns a list with two four components: fun, the user defined function (when evaluated, this string must be parseable); class, the object class of the evaluated function; summary, a numeric summary; and sample of the object.

Details

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

See Also

EvalFunction

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