Skip to content

Commit

Permalink
Merge pull request #95 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
fetching latest copy
  • Loading branch information
maxwellfundi authored Aug 21, 2016
2 parents c147444 + 45c9a16 commit 9d33b4c
Show file tree
Hide file tree
Showing 19 changed files with 520 additions and 150 deletions.
136 changes: 127 additions & 9 deletions instat/dlgDescribeTwoVariable.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

113 changes: 113 additions & 0 deletions instat/dlgDescribeTwoVariable.vb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,120 @@
' along with this program. If not, see <http://www.gnu.org/licenses/>.
Imports instat.Translations
Public Class dlgDescribeTwoVariable
Public bFirstLoad As Boolean = True
Public clsRBaseStatsFunction, clsRMissingFunction, clsRMissingSubFunction As New RFunction
Private Sub dlgDescribeTwoVariable_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If bFirstLoad Then
InitialiseDialog()
SetDefaults()
bFirstLoad = False
Else
ReopenDialog()
End If
autoTranslate(Me)
End Sub

Private Sub cmdstatistics_click(sender As Object, e As EventArgs) Handles cmdStatistics.Click
sdgDescribe.ShowDialog()
End Sub

Public Sub TestOKEnabled()
If Not ucrReceiverFirstVar.IsEmpty() Then
ucrBaseDescribeTwoVar.OKEnabled(True)
Else
ucrBaseDescribeTwoVar.OKEnabled(False)
End If
End Sub

Private Sub ReopenDialog()

End Sub

Private Sub SetDefaults()
chkSaveResult.Checked = False
sdgDescribe.SetUcrBase(ucrBaseDescribeTwoVar)
sdgDescribe.SetDefaults()
ucrSelectorDescribeTwoVar.Reset()
chkSaveResult.Checked = False
chkDisplayResults.Checked = True
StoreResultsParamenter()
OutputOption()
TestOKEnabled()
End Sub

Private Sub InitialiseDialog()
ucrBaseDescribeTwoVar.clsRsyntax.iCallType = 2
ucrReceiverFirstVar.Selector = ucrSelectorDescribeTwoVar
ucrReceiverSecondVar.Selector = ucrSelectorDescribeTwoVar
ucrReceiverFirstVar.SetMeAsReceiver()
ucrReceiverFirstVar.SetIncludedDataTypes({"numeric"})
ucrReceiverSecondVar.SetIncludedDataTypes({"factor"})
'ucrBaseDescribeOneVar.iHelpTopicID =
ucrBaseDescribeTwoVar.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$calculate_summary")
End Sub

Private Sub ucrBaseDescribeOneVar_ClickReset(sender As Object, e As EventArgs) Handles ucrBaseDescribeTwoVar.ClickReset
SetDefaults()
TestOKEnabled()
End Sub

Private Sub OutputOption()
If chkDisplayResults.Checked Then
ucrBaseDescribeTwoVar.clsRsyntax.AddParameter("return_output", "TRUE")
Else
If frmMain.clsInstatOptions.bIncludeRDefaultParameters Then
ucrBaseDescribeTwoVar.clsRsyntax.AddParameter("return_output", "FALSE")
Else
ucrBaseDescribeTwoVar.clsRsyntax.RemoveParameter("return_output")
End If
End If
End Sub

Private Sub ucrSelectorForColumnStatistics_DataFrameChanged() Handles ucrSelectorDescribeTwoVar.DataFrameChanged
ucrBaseDescribeTwoVar.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSelectorDescribeTwoVar.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34))
End Sub

Private Sub ucrReceiverSelectedVariables_SelectionChanged() Handles ucrReceiverFirstVar.SelectionChanged
If Not ucrReceiverFirstVar.IsEmpty Then
ucrBaseDescribeTwoVar.clsRsyntax.AddParameter("columns_to_summarise", ucrReceiverFirstVar.GetVariableNames())
Else
ucrBaseDescribeTwoVar.clsRsyntax.RemoveParameter("columns_to_summarise")
End If
TestOKEnabled()
End Sub

Private Sub chkSaveResult_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveResult.CheckedChanged
StoreResultsParamenter()
OutputOption()
End Sub

Private Sub chkDisplayResults_CheckedChanged(sender As Object, e As EventArgs) Handles chkDisplayResults.CheckedChanged
StoreResultsParamenter()
OutputOption()
End Sub

Private Sub ucrReceiverDescribeOneVar_Load(sender As Object, e As EventArgs) Handles ucrReceiverFirstVar.Load

End Sub

Private Sub StoreResultsParamenter()
If chkSaveResult.Checked Then
If frmMain.clsInstatOptions.bIncludeRDefaultParameters Then
ucrBaseDescribeTwoVar.clsRsyntax.AddParameter("store_results", "TRUE")
Else
ucrBaseDescribeTwoVar.clsRsyntax.RemoveParameter("store_results")
End If
Else
ucrBaseDescribeTwoVar.clsRsyntax.AddParameter("store_results", "FALSE")
End If
ucrBaseDescribeTwoVar.clsRsyntax.AddParameter("drop", "TRUE")
End Sub

Private Sub ucrReceiverSecondVar_SelectionChanged() Handles ucrReceiverSecondVar.SelectionChanged
If Not ucrReceiverSecondVar.IsEmpty Then
ucrBaseDescribeTwoVar.clsRsyntax.AddParameter("factors", ucrReceiverSecondVar.GetVariableNames)
Else
ucrBaseDescribeTwoVar.clsRsyntax.RemoveParameter("factors")
End If
End Sub
End Class
37 changes: 1 addition & 36 deletions instat/dlgDescriptiveStatistics.vb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Public Class dlgDescriptiveStatistics

Private Sub SetDefaults()
chkSaveResult.Checked = False
sdgDescribe.SetUcrBase(ucrBaseDescribeOneVar)
sdgDescribe.SetDefaults()
ucrSelectorDescribeOneVar.Reset()
chkSaveResult.Checked = False
Expand All @@ -63,48 +64,13 @@ Public Class dlgDescriptiveStatistics
ucrReceiverDescribeOneVar.SetIncludedDataTypes({"numeric"})
'ucrBaseDescribeOneVar.iHelpTopicID =
ucrBaseDescribeOneVar.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$calculate_summary")
sdgDescribe.chkNTotal.Tag = "summary_count"
sdgDescribe.chkMean.Tag = "summary_mean"
sdgDescribe.chkMinimum.Tag = "summary_min"
sdgDescribe.chkMaximum.Tag = "summary_max"
sdgDescribe.chkMedian.Tag = "summary_median"
sdgDescribe.chkStdDev.Tag = "summary_sd"
sdgDescribe.chkRange.Tag = "summary_range"

End Sub

Private Sub ucrBaseDescribeOneVar_ClickReset(sender As Object, e As EventArgs) Handles ucrBaseDescribeOneVar.ClickReset
SetDefaults()
TestOKEnabled()
End Sub

Public Sub SummariesParameters()
Dim lstCheckboxes As New List(Of CheckBox)
Dim chkSummary As CheckBox
Dim strSummariesParameter As String = ""
Dim i As Integer = 0
If lstCheckboxes.Count = 0 Then
lstCheckboxes.AddRange({sdgDescribe.chkMean, sdgDescribe.chkMinimum, sdgDescribe.chkMaximum, sdgDescribe.chkRange, sdgDescribe.chkStdDev, sdgDescribe.chkNTotal, sdgDescribe.chkMedian})
End If

strSummariesParameter = "c("
For Each chkSummary In lstCheckboxes
If chkSummary.Checked Then
If i > 0 Then
strSummariesParameter = strSummariesParameter & ","
End If
strSummariesParameter = strSummariesParameter & Chr(34) & chkSummary.Tag & Chr(34)
i = i + 1
End If
Next
strSummariesParameter = strSummariesParameter & ")"
If i > 0 Then
ucrBaseDescribeOneVar.clsRsyntax.AddParameter("summaries", strSummariesParameter)
Else
ucrBaseDescribeOneVar.clsRsyntax.RemoveParameter("summaries")
End If
End Sub

Private Sub OutputOption()
If chkDisplayResults.Checked Then
ucrBaseDescribeOneVar.clsRsyntax.AddParameter("return_output", "TRUE")
Expand Down Expand Up @@ -148,7 +114,6 @@ Public Class dlgDescriptiveStatistics
If chkSaveResult.Checked Then
If frmMain.clsInstatOptions.bIncludeRDefaultParameters Then
ucrBaseDescribeOneVar.clsRsyntax.AddParameter("store_results", "TRUE")

Else
ucrBaseDescribeOneVar.clsRsyntax.RemoveParameter("store_results")
End If
Expand Down
6 changes: 5 additions & 1 deletion instat/dlgImportDataset.vb
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,11 @@ Public Class dlgImportDataset
lblCannotImport.Hide()
grdDataPreview.CurrentWorksheet.Reset()
grdDataPreview.Hide()
End If
End If
If grdDataPreview.CurrentWorksheet IsNot Nothing Then
grdDataPreview.CurrentWorksheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False)
grdDataPreview.CurrentWorksheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_Readonly, True)
End If
TestOkEnabled()
End Sub
#End Region
Expand Down
Loading

0 comments on commit 9d33b4c

Please sign in to comment.