diff --git a/instat/My Project/Application.Designer.vb b/instat/My Project/Application.Designer.vb index ab139877f6a..10b732a311d 100644 --- a/instat/My Project/Application.Designer.vb +++ b/instat/My Project/Application.Designer.vb @@ -32,7 +32,7 @@ Namespace My _ Protected Overrides Sub OnCreateMainForm() - Me.MainForm = Global.instat.dlgOneSample + Me.MainForm = Global.instat.frmMain End Sub End Class End Namespace diff --git a/instat/My Project/Application.myapp b/instat/My Project/Application.myapp index 96021630bf2..739ea6fe438 100644 --- a/instat/My Project/Application.myapp +++ b/instat/My Project/Application.myapp @@ -1,7 +1,7 @@  true - dlgOneSample + frmMain false 0 true diff --git a/instat/dlgFreqTables.Designer.vb b/instat/dlgFreqTables.Designer.vb new file mode 100644 index 00000000000..4be934ee23b --- /dev/null +++ b/instat/dlgFreqTables.Designer.vb @@ -0,0 +1,207 @@ + _ +Partial Class dlgFreqTables + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.lblFactors = New System.Windows.Forms.Label() + Me.grpDisplay = New System.Windows.Forms.GroupBox() + Me.chkWeights = New System.Windows.Forms.CheckBox() + Me.cboWeights = New System.Windows.Forms.ComboBox() + Me.grpDisplayMargins = New System.Windows.Forms.GroupBox() + Me.rdoCounts = New System.Windows.Forms.RadioButton() + Me.rdoPercentOverallTotal = New System.Windows.Forms.RadioButton() + Me.rdoPercentFactor = New System.Windows.Forms.RadioButton() + Me.lblSelectedVariables = New System.Windows.Forms.Label() + Me.cboPercentFactor = New System.Windows.Forms.ComboBox() + Me.ucrReceiverMultiple = New instat.ucrReceiverMultiple() + Me.ucrAddRemove = New instat.ucrSelectorAddRemove() + Me.ucrBase = New instat.ucrButtons() + Me.grpDisplay.SuspendLayout() + Me.SuspendLayout() + ' + 'lblFactors + ' + Me.lblFactors.AutoSize = True + Me.lblFactors.Location = New System.Drawing.Point(21, 14) + Me.lblFactors.Name = "lblFactors" + Me.lblFactors.Size = New System.Drawing.Size(42, 13) + Me.lblFactors.TabIndex = 2 + Me.lblFactors.Tag = "Factors" + Me.lblFactors.Text = "Factors" + ' + 'grpDisplay + ' + Me.grpDisplay.Controls.Add(Me.cboPercentFactor) + Me.grpDisplay.Controls.Add(Me.rdoPercentFactor) + Me.grpDisplay.Controls.Add(Me.rdoPercentOverallTotal) + Me.grpDisplay.Controls.Add(Me.rdoCounts) + Me.grpDisplay.Location = New System.Drawing.Point(12, 163) + Me.grpDisplay.Name = "grpDisplay" + Me.grpDisplay.Size = New System.Drawing.Size(226, 117) + Me.grpDisplay.TabIndex = 4 + Me.grpDisplay.TabStop = False + Me.grpDisplay.Tag = "Display" + Me.grpDisplay.Text = "Display" + ' + 'chkWeights + ' + Me.chkWeights.AutoSize = True + Me.chkWeights.Location = New System.Drawing.Point(305, 47) + Me.chkWeights.Name = "chkWeights" + Me.chkWeights.Size = New System.Drawing.Size(65, 17) + Me.chkWeights.TabIndex = 5 + Me.chkWeights.Tag = "Weights" + Me.chkWeights.Text = "Weights" + Me.chkWeights.UseVisualStyleBackColor = True + ' + 'cboWeights + ' + Me.cboWeights.FormattingEnabled = True + Me.cboWeights.Location = New System.Drawing.Point(384, 45) + Me.cboWeights.Name = "cboWeights" + Me.cboWeights.Size = New System.Drawing.Size(83, 21) + Me.cboWeights.TabIndex = 6 + ' + 'grpDisplayMargins + ' + Me.grpDisplayMargins.Location = New System.Drawing.Point(244, 163) + Me.grpDisplayMargins.Name = "grpDisplayMargins" + Me.grpDisplayMargins.Size = New System.Drawing.Size(200, 117) + Me.grpDisplayMargins.TabIndex = 7 + Me.grpDisplayMargins.TabStop = False + Me.grpDisplayMargins.Tag = "Display_Margins" + Me.grpDisplayMargins.Text = "Display Margins" + ' + 'rdoCounts + ' + Me.rdoCounts.AutoSize = True + Me.rdoCounts.Location = New System.Drawing.Point(12, 33) + Me.rdoCounts.Name = "rdoCounts" + Me.rdoCounts.Size = New System.Drawing.Size(58, 17) + Me.rdoCounts.TabIndex = 0 + Me.rdoCounts.TabStop = True + Me.rdoCounts.Tag = "Counts" + Me.rdoCounts.Text = "Counts" + Me.rdoCounts.UseVisualStyleBackColor = True + ' + 'rdoPercentOverallTotal + ' + Me.rdoPercentOverallTotal.AutoSize = True + Me.rdoPercentOverallTotal.Location = New System.Drawing.Point(12, 67) + Me.rdoPercentOverallTotal.Name = "rdoPercentOverallTotal" + Me.rdoPercentOverallTotal.Size = New System.Drawing.Size(154, 17) + Me.rdoPercentOverallTotal.TabIndex = 1 + Me.rdoPercentOverallTotal.TabStop = True + Me.rdoPercentOverallTotal.Text = "Percentages of overall total" + Me.rdoPercentOverallTotal.UseVisualStyleBackColor = True + ' + 'rdoPercentFactor + ' + Me.rdoPercentFactor.AutoSize = True + Me.rdoPercentFactor.Location = New System.Drawing.Point(12, 99) + Me.rdoPercentFactor.Name = "rdoPercentFactor" + Me.rdoPercentFactor.Size = New System.Drawing.Size(122, 17) + Me.rdoPercentFactor.TabIndex = 2 + Me.rdoPercentFactor.TabStop = True + Me.rdoPercentFactor.Tag = "Percentage_of_Factor" + Me.rdoPercentFactor.Text = "Percentage of factor" + Me.rdoPercentFactor.UseVisualStyleBackColor = True + ' + 'lblSelectedVariables + ' + Me.lblSelectedVariables.AutoSize = True + Me.lblSelectedVariables.Location = New System.Drawing.Point(191, 30) + Me.lblSelectedVariables.Name = "lblSelectedVariables" + Me.lblSelectedVariables.Size = New System.Drawing.Size(95, 13) + Me.lblSelectedVariables.TabIndex = 8 + Me.lblSelectedVariables.Tag = "Selected_Variable" + Me.lblSelectedVariables.Text = "Selected Variables" + ' + 'cboPercentFactor + ' + Me.cboPercentFactor.FormattingEnabled = True + Me.cboPercentFactor.Location = New System.Drawing.Point(140, 95) + Me.cboPercentFactor.Name = "cboPercentFactor" + Me.cboPercentFactor.Size = New System.Drawing.Size(80, 21) + Me.cboPercentFactor.TabIndex = 3 + ' + 'ucrReceiverMultiple + ' + Me.ucrReceiverMultiple.Location = New System.Drawing.Point(191, 47) + Me.ucrReceiverMultiple.Name = "ucrReceiverMultiple" + Me.ucrReceiverMultiple.Size = New System.Drawing.Size(91, 101) + Me.ucrReceiverMultiple.TabIndex = 3 + ' + 'ucrAddRemove + ' + Me.ucrAddRemove.Location = New System.Drawing.Point(12, 30) + Me.ucrAddRemove.Name = "ucrAddRemove" + Me.ucrAddRemove.Size = New System.Drawing.Size(182, 118) + Me.ucrAddRemove.TabIndex = 1 + ' + 'ucrBase + ' + Me.ucrBase.Location = New System.Drawing.Point(34, 298) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(410, 32) + Me.ucrBase.TabIndex = 0 + ' + 'dlgFreqTables + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(479, 342) + Me.Controls.Add(Me.lblSelectedVariables) + Me.Controls.Add(Me.grpDisplayMargins) + Me.Controls.Add(Me.cboWeights) + Me.Controls.Add(Me.chkWeights) + Me.Controls.Add(Me.grpDisplay) + Me.Controls.Add(Me.ucrReceiverMultiple) + Me.Controls.Add(Me.lblFactors) + Me.Controls.Add(Me.ucrAddRemove) + Me.Controls.Add(Me.ucrBase) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Name = "dlgFreqTables" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Tag = "Frequency_table" + Me.Text = "Frequency Tables" + Me.grpDisplay.ResumeLayout(False) + Me.grpDisplay.PerformLayout() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents ucrBase As ucrButtons + Friend WithEvents ucrAddRemove As ucrSelectorAddRemove + Friend WithEvents lblFactors As Label + Friend WithEvents ucrReceiverMultiple As ucrReceiverMultiple + Friend WithEvents grpDisplay As GroupBox + Friend WithEvents rdoPercentFactor As RadioButton + Friend WithEvents rdoPercentOverallTotal As RadioButton + Friend WithEvents rdoCounts As RadioButton + Friend WithEvents chkWeights As CheckBox + Friend WithEvents cboWeights As ComboBox + Friend WithEvents grpDisplayMargins As GroupBox + Friend WithEvents lblSelectedVariables As Label + Friend WithEvents cboPercentFactor As ComboBox +End Class diff --git a/instat/dlgFreqTables.fr-FR.resx b/instat/dlgFreqTables.fr-FR.resx new file mode 100644 index 00000000000..a3df4f013d3 --- /dev/null +++ b/instat/dlgFreqTables.fr-FR.resx @@ -0,0 +1,15 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/instat/dlgFreqTables.resx b/instat/dlgFreqTables.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/dlgFreqTables.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/instat/dlgFreqTables.sw-KE.resx b/instat/dlgFreqTables.sw-KE.resx new file mode 100644 index 00000000000..a3df4f013d3 --- /dev/null +++ b/instat/dlgFreqTables.sw-KE.resx @@ -0,0 +1,15 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/instat/dlgFreqTables.vb b/instat/dlgFreqTables.vb new file mode 100644 index 00000000000..afa598eefdb --- /dev/null +++ b/instat/dlgFreqTables.vb @@ -0,0 +1,48 @@ +' Instat-R +' Copyright (C) 2015 +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License k +' along with this program. If not, see . +Imports instat.Translations + +Public Class dlgFreqTables + Private Sub dlgFreqTables_Load(sender As Object, e As EventArgs) Handles MyBase.Load + cboWeights.Visible = False + cboPercentFactor.Visible = False + ucrBase.clsRsyntax.SetFunction("frequency") + ucrBase.clsRsyntax.iCallType = 2 + autoTranslate(Me) + ucrReceiverMultiple.Selector = ucrAddRemove + ucrReceiverMultiple.SetMeAsReceiver() + End Sub + + Private Sub chkWeights_CheckedChanged(sender As Object, e As EventArgs) Handles chkWeights.CheckedChanged + If chkWeights.Checked = True Then + cboWeights.Visible = True + Else + cboWeights.Visible = False + End If + End Sub + + Private Sub rdoPercentFactor_CheckedChanged(sender As Object, e As EventArgs) Handles rdoPercentFactor.CheckedChanged + If rdoPercentFactor.Checked = True Then + cboPercentFactor.Visible = True + Else + cboPercentFactor.Visible = False + End If + End Sub + + Private Sub ucrReceiverMultiple_Leave(sender As Object, e As EventArgs) Handles ucrReceiverMultiple.LeftList + ucrBase.clsRsyntax.AddParameter("x", "data$" & ucrReceiverMultiple.lstSelectedVariables.SelectedItem & "") + End Sub +End Class \ No newline at end of file diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index 56fc63c1eb5..afbb3761d5b 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -50,6 +50,7 @@ Partial Class frmMain Me.CorrelationToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.LogLinearModelsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.SimpleModelsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.OneSampleToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.NonParametricToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.OneAndTwoSamplesToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.mnuStatsNonParametricOneWayAnova = New System.Windows.Forms.ToolStripMenuItem() @@ -303,7 +304,6 @@ Partial Class frmMain Me.SeasonalSummaryToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.SeasonalSummaryRainToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.WaterBalanceToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem() - Me.OneSampleToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.stsStrip.SuspendLayout() Me.Tool_strip.SuspendLayout() Me.mnuBar.SuspendLayout() @@ -473,6 +473,12 @@ Partial Class frmMain Me.SimpleModelsToolStripMenuItem.Tag = "Simple_Models" Me.SimpleModelsToolStripMenuItem.Text = "Simple Models" ' + 'OneSampleToolStripMenuItem + ' + Me.OneSampleToolStripMenuItem.Name = "OneSampleToolStripMenuItem" + Me.OneSampleToolStripMenuItem.Size = New System.Drawing.Size(216, 22) + Me.OneSampleToolStripMenuItem.Text = "One Sample..." + ' 'NonParametricToolStripMenuItem ' Me.NonParametricToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OneAndTwoSamplesToolStripMenuItem, Me.mnuStatsNonParametricOneWayAnova, Me.mnuStatsNonParametricTwoWayAnova}) @@ -2221,12 +2227,6 @@ Partial Class frmMain Me.WaterBalanceToolStripMenuItem1.Size = New System.Drawing.Size(200, 22) Me.WaterBalanceToolStripMenuItem1.Text = "Water Balance" ' - 'OneSampleToolStripMenuItem - ' - Me.OneSampleToolStripMenuItem.Name = "OneSampleToolStripMenuItem" - Me.OneSampleToolStripMenuItem.Size = New System.Drawing.Size(216, 22) - Me.OneSampleToolStripMenuItem.Text = "One Sample..." - ' 'frmMain ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/instat/frmMain.vb b/instat/frmMain.vb index ca569572682..bbd3948e6f5 100644 --- a/instat/frmMain.vb +++ b/instat/frmMain.vb @@ -422,4 +422,8 @@ Public Class frmMain Private Sub OneSampleToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OneSampleToolStripMenuItem.Click dlgOneSample.ShowDialog() End Sub + + Private Sub FrequencyToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FrequencyToolStripMenuItem.Click + dlgFreqTables.ShowDialog() + End Sub End Class \ No newline at end of file diff --git a/instat/rLink.vb b/instat/rLink.vb index 1b006e61a50..e16b3427ce2 100644 --- a/instat/rLink.vb +++ b/instat/rLink.vb @@ -45,7 +45,35 @@ Public Class RInterface End Sub Public Sub LoadData() - 'Preparing the cleaning process + Dim dlgOpen As New OpenFileDialog + Dim strExtension As String + Dim dfDataset As DataFrame + Dim strHolder As String + + 'For importing files into the instat' + 'start the open file dialog + dlgOpen.Filter = "Comma Separated (*.csv)|*.csv|Excel 2-5/95/97 (*.xls)|*.xls|All Files (*.*)|*.*" + dlgOpen.Title = "Import" + If dlgOpen.ShowDialog() = DialogResult.OK Then + 'checks if the file name is not blank' + If dlgOpen.FileName <> "" Then + strExtension = Path.GetExtension(dlgOpen.FileName) + strHolder = Replace(dlgOpen.FileName, "\", "/") + Select Case strExtension + Case ".csv" + dfDataset = clsEngine.Evaluate("data<-as.data.frame(read.table('" & strHolder & "', header = T, sep = ','))").AsDataFrame + Case ".xlsx" 'TODO use odbc link + dfDataset = clsEngine.Evaluate("require(xlsx);data<-as.data.frame(read.xlsx('" & strHolder & "', sheetName=1))").AsDataFrame + Case ".xls" 'TODO use odbc link + dfDataset = clsEngine.Evaluate("require(readxl);data<-as.data.frame(read_excel('" & strHolder & "', sheet=1))").AsDataFrame + End Select + txtOutput.Text = txtOutput.Text & "Loaded > " & strHolder & vbCrLf + Else + MsgBox("Must have a file name!", vbInformation, "Message from Instat") + End If + Else + MsgBox("No File was selected!", vbInformation, "Message From Instat") + End If End Sub Public Sub RunScript(strScript As String, Optional bReturnOutput As Integer = 0)