Commit 8dfd6688 authored by Yong Liu's avatar Yong Liu

Refs #5751

parent f90190fd
......@@ -5321,7 +5321,11 @@ compareDataExport <- function(comparedScript, len, ...){
if(!is.null(sdcObject@deletedVars)) {
data <- data[!names(data) %in% sdcObject@deletedVars]
}
curr_data_numeric <- sapply(data, is.numeric)
#curr_data_numeric <- sapply(data, is.numeric)
curr_data_numeric <- c()
for(i in 1:length(names(data))) {
curr_data_numeric = c(curr_data_numeric, try(all(sapply(data[names(data)[i]], function(x) { !is.na(as.numeric(x))})), silent = FALSE))
}
varTab = gtable(data.frame(vars=names(data[curr_data_numeric]), stringsAsFactors=FALSE), multiple=TRUE)
size(varTab) <- c(120,200)
add(tmp, varTab)
......@@ -5334,7 +5338,6 @@ compareDataExport <- function(comparedScript, len, ...){
size(selTab) <- c(120,200)
add(tmp, selTab)
tmp = gframe('<span weight="bold" size="medium">Independent Variable Selection</span>',
container=mainframe,markup=TRUE)
skeyvar <- c(ActiveSdcVarsStr(), ActiveSdcVarsStr("numVars"))
......@@ -5355,8 +5358,8 @@ compareDataExport <- function(comparedScript, len, ...){
addSpring(nm2_windowButtonGroup)
gbutton("Caculate", container=nm2_windowButtonGroup,
handler=function(h,...) {
if( (length(selTab[])<1 | any(is.na(selTab[]))) || (length(selTab1[])<1 | any(is.na(selTab1[])))) {
gmessage("You need to select at least 1 variable!", title="Information", icon="info", parent=lrDialog)
if( (length(selTab[]) != 1 | any(is.na(selTab[]))) || (length(selTab1[])<1 | any(is.na(selTab1[])))) {
gmessage("You need to select one depdendent variable and at least one independent variable!", title="Information", icon="info", parent=lrDialog)
} else {
tryCatch({
form = paste(paste(selTab[], collapse = "+"), "~", paste(selTab1[], collapse = "+"), sep=" ")
......@@ -5367,7 +5370,7 @@ compareDataExport <- function(comparedScript, len, ...){
svalue(outputlabel) <- paste("The goodness of fit ratio is:\norig_R2 : curr_R2 = ", round(orig_R2/curr_R2,2), ":1", sep="")}
,
error=function(e){
svalue(outputlabel) <- paste("error:\n", e, "")
svalue(outputlabel) <- paste("please choose other dependent variables. error:\n", e, "")
})
}
})
......
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