# R Commander Menu Definitions

#remove  continuousMenu  "" "" "" "" ""

#   type    menu/item   operation/parent    label                   command/menu        activation    install?
    menu    mpaMenu     topMenu             ""                      ""                  ""            ""
    item    topMenu     cascade             "MPA Statistics"               mpaMenu             ""            ""
    # item    mpaMenu     command             "Hello world"           helloWorld          ""            ""
    #item    mpaMenu     command             "Hello somebody..."     helloWorldDialog    ""            ""


#-----------------------------                                                                      
# Additional models menu commands
    item    modelsMenu      command         "Factor change coefficients (MPA Statistics)"      factorChange     "glmP() || sclmP()"     ""                                                                                                   
                                       

#-----------------------------                                                                      
# Import/Export submenu  
	menu    impMenu      mpaMenu        ""                                              ""                          ""          ""
	item    mpaMenu      cascade         "Import/Export data"                            impMenu                  ""          ""
    item    impMenu      command         "New data set..."                               newDataSet                  ""          "!MacOSXP()"
    item    impMenu      command         "Load data set..."                              loadDataSet                 ""      ""
	item    impMenu      command         "from text file, clipboard, or URL..."          readDataSet                 ""          ""
    item    impMenu      command         "from SPSS data set..."                         importSPSS                  ""          "packageAvailable('foreign')"
    item    impMenu      command         "from SAS xport file..."                        importSAS                   ""           "packageAvailable('foreign')"
    item    impMenu      command         "from Minitab data set..."                      importMinitab               ""          "packageAvailable('foreign')"
    item    impMenu      command         "from STATA data set..."                        importSTATA                 ""          "packageAvailable('foreign')"
    item    impMenu      command         "from Excel, Access or dBase data set..."       importRODBCtable            ""          "WindowsP() && packageAvailable('RODBC') && (.Platform$r_arch == 'i386')"
    item    impMenu      command         "from Excel file..."                            importExcel                 ""      "packageAvailable('XLConnect') && (!WindowsP() | (.Platform$r_arch != 'i386'))"									   
	item    impMenu      command         "Export active data set..."                     exportDataSet               "activeDataSetP()"          ""
	item    impMenu      command         "Save active data set..."                       saveDataSet                 "activeDataSetP()"          ""
	
#-----------------------------                                                                      
# Edit submenu  
    menu    variableMenu   mpaMenu        ""                                              ""                          ""          ""
	item    mpaMenu        cascade         "Edit data"           variableMenu               ""          ""
    item    variableMenu   command         "Recode variables..."                           RecodeDialog                "activeDataSetP()" "packageAvailable('car')"
    item    variableMenu   command         "Compute new variable..."                       Compute                     "activeDataSetP()"          ""
    item    variableMenu   command         "Standardize variables..."                      standardize                 "numericP()"                ""
    item    variableMenu   command         "Convert numeric variables to factors..."       numericToFactor             "numericP()"                ""
    item    variableMenu   command         "Bin numeric variable..."                       binVariable                 "numericP()"                ""
    item    variableMenu   command         "Reorder factor levels..."                      reorderFactor               "factorsP()"                ""
    item    variableMenu   command         "Define contrasts for a factor..."              setContrasts                "factorsP()"                ""
    item    variableMenu   command         "Rename variables..."                           renameVariables             "activeDataSetP()"          ""
    item    variableMenu   command         "Delete variables from data set ..."            deleteVariable              "activeDataSetP()"          ""

#-----------------------------                                                                      
# Descriptive statistics submenu                                                                    
                                                                                                    
    menu    descStats   mpaMenu             ""                      ""                  ""            ""
    item    mpaMenu     cascade           "Descriptive statistics"  descStats           ""            ""
    item    descStats   command             "Summarize data set"      summarizeDataframe          "activeDataSetP()"    ""
    item    descStats   command             "View data set structure"      checkStructure          "activeDataSetP()"    ""
    item    descStats   command         "Numerical summaries..."      numericalSummaries      "numericP()"       "packageAvailable('abind')" 
    item    descStats   command         "Frequency distributions..."      frequencyDistribution      "factorsP()"    ""    
    # item    descStats   command             "Interval..."           helloWorld          "numericP()"    ""
    # item    descStats   command             "Ordinal..."            helloWorld          "activeDataSetP()"    ""
    # item    descStats   command             "Categorical..."        helloWorld          "factorsP()"    ""
    # item    descStats   command             "Binary..."             helloWorld          "activeDataSetP()"    ""
                                                                                                    

#-----------------------------                                                                      
# Distribution Diagnostics submenu
   menu    distdiag    mpaMenu             ""                          ""                 ""            ""
   item    mpaMenu     cascade             "Distribution Diagnostics"  distdiag           ""            ""
   item    distdiag    command             "Two-group t-test Variance Test... (binary ind. var.)"        distdiagnostics    "numericP()"    ""
   item    distdiag    command             "Two-group t-test Normality Test... (binary ind. var.)"        distnormal    "numericP()"    ""

                                                                                                  
#-----------------------------                                                                      
# Confidence intervals submenu                                                                      
                                                                                                    
    menu    confInts    mpaMenu             ""                      ""                  ""            ""
    item    mpaMenu     cascade             "Confidence intervals"  confInts            ""            ""
    item    confInts    command             "Interval data (t-test)..." confintContinuous2  "numericP()"   ""
    item    confInts    command             "Binary data (proportion test)..."   confintBinomial2  "twoLevelFactorsP()"    "" 
    # item    confInts    command             "Interval..."           confintContinuous   "numericP()"            ""
    # item    confInts    command             "Binary..."             confintBinomial     "numericP() || factorsP()"    ""
    # item    confInts    command             "Poisson..."            confintPoisson      "numericP()"            ""


#---------------------------
# Single sample statistics 

    menu    singleSample    mpaMenu             ""                      ""                  ""            ""
    item    mpaMenu         cascade             "Single-sample statistics"  singleSample            ""            ""
    item    singleSample    command             "Single-sample t-test... (interval)"     singleSampleTTest2  "numericP()"   ""
    item    singleSample    command             "Single-sample proportion test... (binary)"   singleProportionTest2  "twoLevelFactorsP()"    ""


#---------------------------
# Paired value testing 

    menu    pairedValues    mpaMenu             ""                      ""                  ""            ""
    item    mpaMenu         cascade             "Paired value testing"  pairedValues            ""            ""
    item    pairedValues    command             "Paired t-test... (interval vars)"     pairedTTest2  "numericP(2)"   ""
    item    pairedValues    command             "Wilcoxon signed rank test... (ordinal vars)"   pairedWilcoxonTest2  "numericP(2)"    ""
                                                                                                    
                                                                                                    
#-----------------------------                                                                      
# Bivariate analysis submenu                                                                        
                                                                                                    
    menu    bivAnal     mpaMenu             ""                      ""                  ""            ""
    item    mpaMenu     cascade             "Bivariate analysis"    bivAnal             ""            ""
    # item    bivAnal     command             "Interval dependent variable"          intBivAnal          "numericP(2)"            ""
    # item    bivAnal     command             "Ordinal dependent variable"          helloWorld          "numericP(2)"            ""

    #--------------------------------
    # Interval bivariate subsubmenu
    menu    intBivAnal  bivAnal             ""                      ""                  ""            ""
    item    bivAnal     cascade             "Interval dependent variable"              intBivAnal      ""            ""
    item    intBivAnal  command             "Linear regression... (interval/ordinal ind. var.)"    linearModel2     "numericP(2)"   ""
    item    intBivAnal  command             "One-way ANOVA... (categorical ind. var.)"    oneWayAnova2     "numericP() && factorsP()" "packageAvailable('multcomp') && packageAvailable('abind')"
    item    intBivAnal  command             "Two-group t-test... (binary ind. var.)"    independentSamplesTTest2     "numericP() && twoLevelFactorsP()"   ""
    
    #--------------------------------
    # Ordinal bivariate subsubmenu
    menu    ordBivAnal  bivAnal             ""                      ""                  ""            ""
    item    bivAnal     cascade             "Ordinal dependent variable"              ordBivAnal      ""            ""
    item    ordBivAnal  command             "Ordinal logistic regression... (interval/ordinal ind. var.)"    ordinalRegressionModelOrdinal2     "factorsP()" "packageAvailable('ordinal')"
    item    ordBivAnal  command             "Kruskal Wallis test... (categorical ind. var.)"    KruskalWallisTest2     "numericP() && factorsP()" ""
    item    ordBivAnal  command             "Wilcoxon-Mann-Whitney test... (binary ind. var.)"    twoSampleWilcoxonTest2     "numericP() && twoLevelFactorsP()"   ""
    
    #--------------------------------
    # Categorical bivariate subsubmenu
    menu    catBivAnal  bivAnal             ""                      ""                  ""            ""
    item    bivAnal     cascade             "Categorical dependent variable"              catBivAnal      ""            ""
#    item    catBivAnal  command             "Multinomial logistic regression... (interval/ordinal ind. var.)"    multinomialLogitModel     "factorsP()" "packageAvailable('nnet')"
    item    catBivAnal  command             "Chi-square test... (categorical/binary ind. var.)"    twoWayTable2     "factorsP(2)" "packageAvailable('abind')"
    
    #--------------------------------
    # Binary bivariate subsubmenu
    menu    binBivAnal  bivAnal             ""                      ""                  ""            ""
    item    bivAnal     cascade             "Binary dependent variable"              binBivAnal      ""            ""
    item    binBivAnal  command             "Simple logistic regression... (interval/ordinal ind. var.)"    generalizedLinearModel2      "activeDataSetP()"          ""
    item    binBivAnal  command             "Chi-square test... (categorical ind. var.)"    twoWayTable2     "factorsP(2)" "packageAvailable('abind')"
    item    binBivAnal  command             "Proportion test... (binary ind. var.)"    twoSampleProportionsTest2     "twoLevelFactorsP(2)" "packageAvailable('abind')"
                                                                                                    
#-----------------------------                                                                      
# Multivariate analysis submenu                                                                     
                                                                                                    
    menu    multAnal    mpaMenu             ""                      ""                  ""            ""
    item    mpaMenu     cascade             "Multivariate analysis"       multAnal            ""            ""
    item    multAnal    command             "Linear regression... (interval dep. var.)"  linearModel2     "numericP(2)"   ""
    item    multAnal    command             "Ordinal logistic regression... (ordinal dep. var.)"  ordinalRegressionModelOrdinal2     "factorsP()" "packageAvailable('ordinal')"
#    item    multAnal    command             "Multinomial logistic regression... (categorical dep. var.)"  multinomialLogitModel     "factorsP()" "packageAvailable('nnet')"
    item    multAnal    command             "Logistic regression... (binary dep. var.)"  generalizedLinearModel2      "activeDataSetP()"          ""
                                                                                                    
                                                                                                    
#-----------------------------                                                                      
# Diagnostics submenu
# TODO: Finish these someday
                                                                                                    
    # menu    diagMenu    mpaMenu             ""                      ""                  ""            ""
    # item    mpaMenu     cascade             "Diagnostics"           diagMenu            ""            ""
    # item    diagMenu    command             "Box plots..."          boxPlot             "numericP()"            ""
    # item    diagMenu    command             "Normality tests..."    helloWorld          ""            ""
    # item    diagMenu    command             "SD test..."            helloWorld          ""            ""
