Commit 597a4c6c authored by Yong Liu's avatar Yong Liu

refs #6179

parent e5e22791
......@@ -416,7 +416,7 @@ sdcGUI <- function() {
if(existd("rb")){
rb <- getd("rb")
ind <- 1
svalue(rb[[ind]]) <- "Factor"
svalue(rb[[ind]]) <- "Categorical"
gr1_window <- getd("gr1_window")
gmessage("Variable cannot be changed to numeric!", title="Information", icon="info", parent=gr1_window)
ret <- FALSE
......@@ -1550,11 +1550,11 @@ sdcGUI <- function() {
rb <- getd("rb")
for(k in seq_along(keyname)){
if(is.factor(ActiveSdcObject()@manipKeyVars[,k])){
svalue(rb[[k]]) <- "Factor"
svalue(rb[[k]]) <- "Categorical"
showLevels(keyname[k])
}else{
hideLevels(keyname[k])
svalue(rb[[k]]) <- "Numeric"
svalue(rb[[k]]) <- "Continuous"
}
}
......@@ -1563,7 +1563,7 @@ sdcGUI <- function() {
keyname <- ActiveSdcVarsStr()
}
gr1_window = gwindow("Choose parameters for globalRecode", width=800, parent=window)
gr1_window = gwindow("globalRecode", width=800, parent=window)
gr1_main <- gframe("", container=gr1_window, horizontal=FALSE, expand=TRUE)
nb <- gnotebook(container=gr1_main, closebuttons=FALSE, expand=TRUE)
......@@ -1581,12 +1581,12 @@ sdcGUI <- function() {
svalue(nb) <- 1
tmp1 <- gframe(text='<span weight="bold" size="medium">Type:</span>',
horizonal=TRUE,container=lefttmp,markup=TRUE)
rb[[i]] <- gradio(c("Numeric","Factor"), container=tmp1)
rb[[i]] <- gradio(c("Continuous","Categorical"), container=tmp1)
rbfun[[i]] <- eval(parse(text=paste("
function(h,...) {
index <- ",i,"
name <- \"",keyname[i],"\"
if(svalue(h$obj)==\"Factor\"){
if(svalue(h$obj)==\"Categorical\"){
enabled(recButton2[[index]]) <- FALSE
varToFactor_tmp(name)
showLevels(name)
......@@ -1614,7 +1614,7 @@ sdcGUI <- function() {
tmp2 <- gframe("", container=tmp, horizontal=FALSE, expand=TRUE)
#####Recode to Factor
tmpRecFac <- gframe('<span weight="bold" size="medium">Recode to factor</span>',
tmpRecFac <- gframe('<span weight="bold" size="medium">Recode to categories</span>',
container=tmp2, horizontal=FALSE,markup=TRUE)
recFactorFun[[i]] <- eval(parse(text=paste(
"function(...){
......@@ -1681,13 +1681,13 @@ sdcGUI <- function() {
#var <- ActiveDataSet()[,name]
rb <- getd("rb")
blockHandler(rb[[index]])
svalue(rb[[index]]) <- "Factor"
svalue(rb[[index]]) <- "Categorical"
unblockHandler(rb[[index]])
updateSummary(name)
showLevels(name)
}
}',sep="")))
recButton2[[i]] <- gbutton("Recode to factor", container=tmpRecFac, handler=recFactorFun[[i]])
recButton2[[i]] <- gbutton("Recode to categories", container=tmpRecFac, handler=recFactorFun[[i]])
lab <- "BREAKS: Example input: 1,3,5,9 splits var in 3 groups"
lab <- paste(lab, "\n(1,3],(3,5] and (5,9]. If you just supply")
lab <- paste(lab, "\n1 number, like 3, the var will be split in")
......@@ -1706,7 +1706,7 @@ sdcGUI <- function() {
gseparator(container=tmp)
##Group/Rename Factor
tmpGroupFac <- gframe('<span weight="bold" size="medium">Group a factor</span>',
tmpGroupFac <- gframe('<span weight="bold" size="medium">Group categories</span>',
container=tmp2, horizontal=FALSE,markup=TRUE, expand=TRUE)
tmpGroupFac2 = gframe("Levels", container=tmpGroupFac, expand=TRUE)
facTab[[i]] <- gtable(data.frame(levels=character(0), stringsAsFactors=FALSE),
......@@ -1741,9 +1741,9 @@ sdcGUI <- function() {
##Main
if(is.factor(xtmp[,keyname[i]])){
svalue(rb[[i]]) <- "Factor"
svalue(rb[[i]]) <- "Categorical"
}else{
svalue(rb[[i]]) <- "Numeric"
svalue(rb[[i]]) <- "Continuous"
}
}
#Save Input-Fields to the env
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment