1
# Stuff yet to be cleaned up
2
# ============================================================================
5
VariableTypeEnum <- c(real = 0, categorical = 1, integer = 2, counter = 3, uniform = 4)
9
# variable name = value, ...
11
# .which = c(variable name = value, ....)
13
setVariableType.ggobi <- function(..., .which, .data = 1, .gobi = getDefaultGGobi())
17
.which = as.integer(unlist(list(...)))
18
names(.which) = names(tmp)
20
mode(.which) = "integer"
23
if(mode(.data) == "numeric" || mode(.data) == "character")
24
.data <- getDatasetReference.ggobi(.data, .gobi)
26
i = match(names(.which), names(.data))
28
stop("variable names ", paste(names(.which)[is.na(i)], collapse = ", "), " not in the specified data set")
31
.GGobiCall("setVariableTypes", as.integer(i-1), .which, .data, .gobi = .gobi)
34
"[[<-.ggobiDataset" <- function(x, i, j, value) {
36
vars <- getVariableIndex.ggobi(j, .data=x)
40
val <- rep(value, length = length(i))
42
setVariableValues.ggobi(val, v, i, .data = x)
51
removeVariable.ggobi <- function(..., .data = 1, .gobi = getDefaultGGobi()) {
52
which <- getVariableIndex.ggobi(..., .gobi=.gobi)
54
.GGobiC("removeVariables", which, .data, .gobi = .gobi)[[1]]
57
getVariable.ggobi <- function(which, .data = 1, .gobi = getDefaultGGobi(), asDataFrame = FALSE) {
58
idx <- getVariableIndex.ggobi(which, .data = .data, .gobi = .gobi)
60
stop(paste("Unmatched variable name", which[is.na(idx)],"in ggobi"))
63
varNames <- getVariableNames.ggobi(.data = .data, .gobi = .gobi)[idx]
65
rowNames <- getRowNames.ggobi(.data = .data, .gobi = .gobi)
67
if(mode(.data) == "numeric")
68
.data <- as.integer(.data - 1)
70
vals <- .GGobiCall("getVariables", as.integer(idx), .data, .gobi=.gobi)
71
names(vals) <- varNames
74
vals <- data.frame(vals, row.names = rowNames, check.names = FALSE)