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

Refs #5751

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