Learn R Programming

RSurvey (version 0.9.3)

EditFunction: GUI: Function Editor

Description

A graphical user interface (GUI) for defining functions in the R language.

Usage

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

Arguments

cols

list. y

index

integer. An element index number in cols.

fun

character. Existing function, only used if index = NULL

value.length

integer. Required length for the evaluated function.

value.class

character. Required class for the evaluated function.

win.title

character. String to display as the title of the dialog box.

parent

tkwin. GUI parent window

Value

Returns an object of class list with the following components:

fun

user defined function (when evaluated, this string must be parseable).

class

object class for the evaluated function.

summary

default summary for the evaluated function.

sample

first non-missing value for the evaluated function.

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
# NOT RUN {
  d <- list(x = 1:10, y = 10:1)
  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)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab