Edit Data

Description

A GUI for viewing and editing table formatted data.

Usage

1
2
3
EditData(d, col.names = names(d), row.names = NULL, col.formats = NULL,
         read.only = FALSE, changelog = NULL, win.title = "Data",
         parent = NULL)

Arguments

d

list, matrix, or data.frame; the data used to populate the table.

col.names

character; a vector of column names.

row.names

character; a vector of row names.

col.formats

character; a vector of format conversion specification strings, see sprintf and strftime.

read.only

logical; specifies whether the table is in read only mode.

changelog

data.frame; history of all data table edits (see ‘Value’).

win.title

character; a string to display as the title of the dialog box.

parent

tkwin; the GUI parent window.

Details

Row titles are taken from the row names attribute of d. Pattern searches are performed using grep. Edits are reflected in the changelog.

Value

NULL is returned if no edits were made; otherwise, new values of d and changelog are returned as components in a list. The changelog data frame contains the following variables:

timestamp

POSIXct; identifies when the edit event occurred.

record

character; row name.

variable

character; column name.

old

character; value before editing.

new

character; value after editing.

Note

Requires the Tcl package Tktable.

Author(s)

J.C. Fisher

See Also

BuildHistogram

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
tcltk::tclRequire("Tktable", warn = TRUE)

n <- 1000L
V1 <- sample(c(1:9, NA), n, replace = TRUE)
V2 <- sample(LETTERS, n, replace = TRUE)
V3 <- as.POSIXct(rnorm(n, mean = 0, sd = 1e6), origin = "2010-01-01")
V4 <- sample(V1 * pi, n)
d <- data.frame(V1, V2, V3, V4)
col.names <- c("Integers", "Letters", "DateTime", "Numeric")
col.formats <- c("%d", "%s", "%m/%d/%Y %H:%M", "")
ans <- EditData(d, col.names, col.formats)
str(ans)

rownames(d) <- paste0(sample(LETTERS, n, replace = TRUE), seq_len(n))
EditData(d, read.only = TRUE)

colnames(d) <- NULL
rownames(d) <- NULL
EditData(d, read.only = TRUE)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.