From d302966d9c3c60fa757eb684f2d7cc38faf637d0 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:01:46 +0100 Subject: [PATCH 01/88] Fixes issue where the Levels/Labels dialog does not label the last level well --- instat/ucrFactor.vb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/instat/ucrFactor.vb b/instat/ucrFactor.vb index 5c82f57a346..d727b17e2eb 100644 --- a/instat/ucrFactor.vb +++ b/instat/ucrFactor.vb @@ -936,4 +936,25 @@ Public Class ucrFactor lblSelected.Visible = iSelectCol > 0 SetToggleButtonSettings() End Sub + + Private Sub _grdSheet_CellEditTextChanging(sender As Object, e As CellEditTextChangingEventArgs) Handles _grdSheet.CellEditTextChanging + Dim bValid As Boolean = True + 'do levels entry validation + If _grdSheet.ColumnHeaders(e.Cell.Column).Text = DefaultColumnNames.Level Then + If Not IsNumeric(e.Text) Then + MsgBox("Levels must be numeric values", MsgBoxStyle.Information, "Invalid Value") + bValid = False + ElseIf e.Text.Contains(".") Then + MsgBox("Levels must not be decimal", MsgBoxStyle.Information, "Invalid Value") + + bValid = False + End If + End If + If bValid Then + _grdSheet(e.Cell.Row, e.Cell.Column) = e.Text + 'this will raise ControlContentsChanged event + 'and also update parameter and R code with the values + OnControlValueChanged() + End If + End Sub End Class \ No newline at end of file From ec561ac5b4b6e8ba56ba36a534fcac004c5008d5 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Wed, 21 Feb 2024 13:18:06 +0100 Subject: [PATCH 02/88] Added binwidth controls to the main dialogue --- instat/dlgHistogram.designer.vb | 74 +++++++++++++++++++++++---------- instat/dlgHistogram.vb | 25 ++++++++++- 2 files changed, 75 insertions(+), 24 deletions(-) diff --git a/instat/dlgHistogram.designer.vb b/instat/dlgHistogram.designer.vb index 46b7178c5f8..54c1ade4367 100644 --- a/instat/dlgHistogram.designer.vb +++ b/instat/dlgHistogram.designer.vb @@ -51,6 +51,10 @@ Partial Class dlgHistogram Me.toolStripMenuItemDensityOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemDensityRidgesOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemFrequencyPolygonOptions = New System.Windows.Forms.ToolStripMenuItem() + Me.lblReorder = New System.Windows.Forms.Label() + Me.ucrNudBinwidth = New instat.ucrNud() + Me.ucrChkBinWidth = New instat.ucrCheck() + Me.ucrInputAddReorder = New instat.ucrInputComboBox() Me.cmdOptions = New instat.ucrSplitButton() Me.ucrChkDisplayAsDotPlot = New instat.ucrCheck() Me.ucrChkRidges = New instat.ucrCheck() @@ -62,8 +66,6 @@ Partial Class dlgHistogram Me.ucrHistogramSelector = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() Me.ucrPnlOptions = New instat.UcrPanel() - Me.lblReorder = New System.Windows.Forms.Label() - Me.ucrInputAddReorder = New instat.ucrInputComboBox() Me.contextMenuStripOptions.SuspendLayout() Me.SuspendLayout() ' @@ -179,6 +181,49 @@ Partial Class dlgHistogram Me.toolStripMenuItemFrequencyPolygonOptions.Size = New System.Drawing.Size(221, 22) Me.toolStripMenuItemFrequencyPolygonOptions.Text = "Frequency Polygon Options" ' + 'lblReorder + ' + Me.lblReorder.AutoSize = True + Me.lblReorder.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblReorder.Location = New System.Drawing.Point(286, 298) + Me.lblReorder.Name = "lblReorder" + Me.lblReorder.Size = New System.Drawing.Size(48, 13) + Me.lblReorder.TabIndex = 38 + Me.lblReorder.Text = "Reorder:" + ' + 'ucrNudBinwidth + ' + Me.ucrNudBinwidth.AutoSize = True + Me.ucrNudBinwidth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudBinwidth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudBinwidth.Location = New System.Drawing.Point(100, 287) + Me.ucrNudBinwidth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudBinwidth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudBinwidth.Name = "ucrNudBinwidth" + Me.ucrNudBinwidth.Size = New System.Drawing.Size(50, 20) + Me.ucrNudBinwidth.TabIndex = 41 + Me.ucrNudBinwidth.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrChkBinWidth + ' + Me.ucrChkBinWidth.AutoSize = True + Me.ucrChkBinWidth.Checked = False + Me.ucrChkBinWidth.Location = New System.Drawing.Point(10, 285) + Me.ucrChkBinWidth.Name = "ucrChkBinWidth" + Me.ucrChkBinWidth.Size = New System.Drawing.Size(153, 23) + Me.ucrChkBinWidth.TabIndex = 40 + ' + 'ucrInputAddReorder + ' + Me.ucrInputAddReorder.AddQuotesIfUnrecognised = True + Me.ucrInputAddReorder.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputAddReorder.GetSetSelectedIndex = -1 + Me.ucrInputAddReorder.IsReadOnly = False + Me.ucrInputAddReorder.Location = New System.Drawing.Point(287, 314) + Me.ucrInputAddReorder.Name = "ucrInputAddReorder" + Me.ucrInputAddReorder.Size = New System.Drawing.Size(120, 21) + Me.ucrInputAddReorder.TabIndex = 39 + ' 'cmdOptions ' Me.cmdOptions.AutoSize = True @@ -300,33 +345,14 @@ Partial Class dlgHistogram Me.ucrPnlOptions.Size = New System.Drawing.Size(433, 30) Me.ucrPnlOptions.TabIndex = 0 ' - 'lblReorder - ' - Me.lblReorder.AutoSize = True - Me.lblReorder.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblReorder.Location = New System.Drawing.Point(286, 298) - Me.lblReorder.Name = "lblReorder" - Me.lblReorder.Size = New System.Drawing.Size(48, 13) - Me.lblReorder.TabIndex = 38 - Me.lblReorder.Text = "Reorder:" - ' - 'ucrInputAddReorder - ' - Me.ucrInputAddReorder.AddQuotesIfUnrecognised = True - Me.ucrInputAddReorder.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputAddReorder.GetSetSelectedIndex = -1 - Me.ucrInputAddReorder.IsReadOnly = False - Me.ucrInputAddReorder.Location = New System.Drawing.Point(287, 314) - Me.ucrInputAddReorder.Name = "ucrInputAddReorder" - Me.ucrInputAddReorder.Size = New System.Drawing.Size(120, 21) - Me.ucrInputAddReorder.TabIndex = 39 - ' 'dlgHistogram ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(448, 422) + Me.Controls.Add(Me.ucrNudBinwidth) + Me.Controls.Add(Me.ucrChkBinWidth) Me.Controls.Add(Me.lblReorder) Me.Controls.Add(Me.ucrInputAddReorder) Me.Controls.Add(Me.cmdOptions) @@ -382,4 +408,6 @@ Partial Class dlgHistogram Friend WithEvents toolStripMenuItemDotOptions As ToolStripMenuItem Friend WithEvents lblReorder As Label Friend WithEvents ucrInputAddReorder As ucrInputComboBox + Friend WithEvents ucrChkBinWidth As ucrCheck + Friend WithEvents ucrNudBinwidth As ucrNud End Class \ No newline at end of file diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index bbabb30553f..ca3fedf04df 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -115,6 +115,16 @@ Public Class dlgHistogram ucrChkDisplayAsDotPlot.AddFunctionNamesCondition(True, "geom_dotplot") ucrChkDisplayAsDotPlot.AddFunctionNamesCondition(False, "geom_dotplot", False) + ucrChkBinWidth.SetText("Binwidth") + 'ucrChkBinWidth.SetParameter(New RParameter("binwidth", 3)) + ucrChkBinWidth.AddToLinkedControls({ucrNudBinwidth}, {True}, bNewLinkedHideIfParameterMissing:=True) + + ucrNudBinwidth.SetParameter(New RParameter("binwidth", 3)) + ucrNudBinwidth.SetMinMax(0.00, 10.0) + ucrNudBinwidth.DecimalPlaces = 2 + ucrNudBinwidth.Increment = 0.01 + ucrNudBinwidth.SetRDefault(1.5) + ucrChkRidges.SetText("Density Ridges") ucrChkRidges.AddFunctionNamesCondition(True, "geom_density_ridges") ucrChkRidges.AddFunctionNamesCondition(False, "geom_density_ridges", False) @@ -132,6 +142,7 @@ Public Class dlgHistogram ucrInputAddReorder.SetLinkedDisplayControl(lblReorder) ucrPnlOptions.AddToLinkedControls({ucrChkDisplayAsDotPlot}, {rdoHistogram}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlOptions.AddToLinkedControls({ucrChkBinWidth}, {rdoHistogram, rdoFrequencyPolygon}, bNewLinkedHideIfParameterMissing:=True) ucrPnlOptions.AddToLinkedControls({ucrChkRidges}, {rdoDensity_ridges}, bNewLinkedHideIfParameterMissing:=True) ucrChkRidges.AddToLinkedControls(ucrInputStats, {"FALSE"}, bNewLinkedHideIfParameterMissing:=True) @@ -224,6 +235,8 @@ Public Class dlgHistogram ucrPnlOptions.SetRCode(clsRgeomPlotFunction, bReset) ucrChkPercentages.SetRCode(clsYScalecontinuousFunction, bReset) ucrChkDisplayAsDotPlot.SetRCode(clsRgeomPlotFunction, bReset) + ucrChkBinWidth.SetRCode(clsRgeomPlotFunction, bReset) + ucrNudBinwidth.SetRCode(clsRgeomPlotFunction, bReset) ucrChkRidges.SetRCode(clsRgeomPlotFunction, bReset) ucrVariablesAsFactorforHist.SetRCode(clsRaesFunction, bReset) If bReset Then @@ -273,6 +286,11 @@ Public Class dlgHistogram clsRgeomPlotFunction.RemoveParameterByName("stackgroups") End If End If + If Not ucrNudBinwidth.IsEmpty Then + clsRgeomPlotFunction.AddParameter("binwidth", 1.5, iPosition:=1) + Else + clsRgeomPlotFunction.RemoveParameterByName("binwidth") + End If ucrFactorReceiver.ChangeParameterName("fill") If Not ucrSaveHist.bUserTyped Then ucrSaveHist.SetPrefix("histogram") End If @@ -485,7 +503,12 @@ Public Class dlgHistogram End If End Sub - Private Sub CoreControls_ControlContentsChanged() Handles ucrVariablesAsFactorforHist.ControlContentsChanged, ucrSaveHist.ControlContentsChanged, ucrFactorReceiver.ControlContentsChanged, ucrChkRidges.ControlContentsChanged, ucrInputAddReorder.ControlContentsChanged + Private Sub CoreControls_ControlContentsChanged() Handles ucrVariablesAsFactorforHist.ControlContentsChanged, ucrSaveHist.ControlContentsChanged, ucrFactorReceiver.ControlContentsChanged, ucrChkRidges.ControlContentsChanged, ucrInputAddReorder.ControlContentsChanged, ucrChkBinWidth.ControlContentsChanged, ucrNudBinwidth.ControlContentsChanged TestOkEnabled() End Sub + + Private Sub ucrPnlOptions_Control(ucrChangedControl As ucrCore) Handles ucrVariablesAsFactorforHist.ControlValueChanged, ucrPnlOptions.ControlValueChanged, ucrInputAddReorder.ControlValueChanged, ucrFactorReceiver.ControlValueChanged, ucrChkRidges.ControlValueChanged, ucrChkDisplayAsDotPlot.ControlValueChanged + + End Sub + End Class \ No newline at end of file From 14c17baa50b1a6b9dc5c770dc366ef0b2664f58f Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Wed, 21 Feb 2024 13:22:37 +0100 Subject: [PATCH 03/88] code fixes --- instat/dlgHistogram.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index ca3fedf04df..d039fbd605f 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -235,13 +235,13 @@ Public Class dlgHistogram ucrPnlOptions.SetRCode(clsRgeomPlotFunction, bReset) ucrChkPercentages.SetRCode(clsYScalecontinuousFunction, bReset) ucrChkDisplayAsDotPlot.SetRCode(clsRgeomPlotFunction, bReset) - ucrChkBinWidth.SetRCode(clsRgeomPlotFunction, bReset) ucrNudBinwidth.SetRCode(clsRgeomPlotFunction, bReset) ucrChkRidges.SetRCode(clsRgeomPlotFunction, bReset) ucrVariablesAsFactorforHist.SetRCode(clsRaesFunction, bReset) If bReset Then ucrInputStats.SetRCode(clsHistAesFunction, bReset) ucrFactorReceiver.SetRCode(clsRaesFunction, bReset) + ucrChkBinWidth.SetRCode(clsRgeomPlotFunction, bReset) End If End Sub From 67236c0fe1941930e61f58eb1eeec1f90c2d51a4 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Wed, 21 Feb 2024 13:54:51 +0100 Subject: [PATCH 04/88] Code changes --- instat/dlgHistogram.vb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index d039fbd605f..995633f8ecc 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -235,13 +235,13 @@ Public Class dlgHistogram ucrPnlOptions.SetRCode(clsRgeomPlotFunction, bReset) ucrChkPercentages.SetRCode(clsYScalecontinuousFunction, bReset) ucrChkDisplayAsDotPlot.SetRCode(clsRgeomPlotFunction, bReset) - ucrNudBinwidth.SetRCode(clsRgeomPlotFunction, bReset) ucrChkRidges.SetRCode(clsRgeomPlotFunction, bReset) ucrVariablesAsFactorforHist.SetRCode(clsRaesFunction, bReset) If bReset Then ucrInputStats.SetRCode(clsHistAesFunction, bReset) ucrFactorReceiver.SetRCode(clsRaesFunction, bReset) ucrChkBinWidth.SetRCode(clsRgeomPlotFunction, bReset) + ucrNudBinwidth.SetRCode(clsRgeomPlotFunction, bReset) End If End Sub @@ -267,6 +267,14 @@ Public Class dlgHistogram clsRgeomPlotFunction.SetPackageName("ggplot2") ucrInputAddReorder.Visible = Not ucrFactorReceiver.IsEmpty() + + + If Not ucrNudBinwidth.IsEmpty Then + clsRgeomPlotFunction.AddParameter("binwidth", 1.5, iPosition:=1) + Else + clsRgeomPlotFunction.RemoveParameterByName("binwidth") + End If + If rdoHistogram.Checked Then If ucrChkDisplayAsDotPlot.Checked Then clsRgeomPlotFunction.SetRCommand("geom_dotplot") From 0404dbca39dcd3042ce59f0781189c295c64e55c Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Wed, 21 Feb 2024 14:11:13 +0100 Subject: [PATCH 05/88] Code changes --- instat/dlgHistogram.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index 995633f8ecc..764755f35db 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -125,6 +125,7 @@ Public Class dlgHistogram ucrNudBinwidth.Increment = 0.01 ucrNudBinwidth.SetRDefault(1.5) + ucrChkRidges.SetText("Density Ridges") ucrChkRidges.AddFunctionNamesCondition(True, "geom_density_ridges") ucrChkRidges.AddFunctionNamesCondition(False, "geom_density_ridges", False) @@ -237,6 +238,7 @@ Public Class dlgHistogram ucrChkDisplayAsDotPlot.SetRCode(clsRgeomPlotFunction, bReset) ucrChkRidges.SetRCode(clsRgeomPlotFunction, bReset) ucrVariablesAsFactorforHist.SetRCode(clsRaesFunction, bReset) + If bReset Then ucrInputStats.SetRCode(clsHistAesFunction, bReset) ucrFactorReceiver.SetRCode(clsRaesFunction, bReset) @@ -267,8 +269,6 @@ Public Class dlgHistogram clsRgeomPlotFunction.SetPackageName("ggplot2") ucrInputAddReorder.Visible = Not ucrFactorReceiver.IsEmpty() - - If Not ucrNudBinwidth.IsEmpty Then clsRgeomPlotFunction.AddParameter("binwidth", 1.5, iPosition:=1) Else From 15463ec4a2963004dd854cbdfa77ac96863c3e6f Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:36:38 +0100 Subject: [PATCH 06/88] Added the scale_y_continuos function to dotplot --- instat/dlgHistogram.designer.vb | 12 ++++++++++ instat/dlgHistogram.vb | 42 +++++++++++++++++++++++---------- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/instat/dlgHistogram.designer.vb b/instat/dlgHistogram.designer.vb index 54c1ade4367..ce9501cb7a3 100644 --- a/instat/dlgHistogram.designer.vb +++ b/instat/dlgHistogram.designer.vb @@ -66,6 +66,7 @@ Partial Class dlgHistogram Me.ucrHistogramSelector = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() Me.ucrPnlOptions = New instat.UcrPanel() + Me.ucrChkOmitYAxis = New instat.ucrCheck() Me.contextMenuStripOptions.SuspendLayout() Me.SuspendLayout() ' @@ -345,12 +346,22 @@ Partial Class dlgHistogram Me.ucrPnlOptions.Size = New System.Drawing.Size(433, 30) Me.ucrPnlOptions.TabIndex = 0 ' + 'ucrChkOmitYAxis + ' + Me.ucrChkOmitYAxis.AutoSize = True + Me.ucrChkOmitYAxis.Checked = False + Me.ucrChkOmitYAxis.Location = New System.Drawing.Point(8, 262) + Me.ucrChkOmitYAxis.Name = "ucrChkOmitYAxis" + Me.ucrChkOmitYAxis.Size = New System.Drawing.Size(153, 23) + Me.ucrChkOmitYAxis.TabIndex = 42 + ' 'dlgHistogram ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(448, 422) + Me.Controls.Add(Me.ucrChkOmitYAxis) Me.Controls.Add(Me.ucrNudBinwidth) Me.Controls.Add(Me.ucrChkBinWidth) Me.Controls.Add(Me.lblReorder) @@ -410,4 +421,5 @@ Partial Class dlgHistogram Friend WithEvents ucrInputAddReorder As ucrInputComboBox Friend WithEvents ucrChkBinWidth As ucrCheck Friend WithEvents ucrNudBinwidth As ucrNud + Friend WithEvents ucrChkOmitYAxis As ucrCheck End Class \ No newline at end of file diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index 764755f35db..631b761abb3 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -20,6 +20,9 @@ Public Class dlgHistogram Private bFirstLoad As Boolean = True Private bReset As Boolean = True Private clsBaseOperator As New ROperator + Private clsBaseOperator2 As New ROperator + Private clsYlabScalesFunction As New RFunction + Private clsBreaksFunction As New RFunction Private clsRggplotFunction As New RFunction Private clsRgeomPlotFunction As New RFunction Private clsRaesFunction As New RFunction @@ -114,6 +117,8 @@ Public Class dlgHistogram ucrChkDisplayAsDotPlot.SetText("Display as Dotplot") ucrChkDisplayAsDotPlot.AddFunctionNamesCondition(True, "geom_dotplot") ucrChkDisplayAsDotPlot.AddFunctionNamesCondition(False, "geom_dotplot", False) + ucrChkDisplayAsDotPlot.AddToLinkedControls({ucrChkOmitYAxis}, {True}, bNewLinkedHideIfParameterMissing:=True) + ucrChkOmitYAxis.SetText("Omit Y Axis") ucrChkBinWidth.SetText("Binwidth") 'ucrChkBinWidth.SetParameter(New RParameter("binwidth", 3)) @@ -158,11 +163,14 @@ Public Class dlgHistogram Private Sub SetDefaults() clsBaseOperator = New ROperator + clsBaseOperator2 = New ROperator clsRggplotFunction = New RFunction clsRgeomPlotFunction = New RFunction clsRaesFunction = New RFunction clsHistAesFunction = New RFunction clsPercentage = New RFunction + clsYlabScalesFunction = New RFunction + clsBreaksFunction = New RFunction clsForecatsReverse = New RFunction clsForecatsInfreqValue = New RFunction clsForecatsReverseValue = New RFunction @@ -176,6 +184,7 @@ Public Class dlgHistogram ucrInputAddReorder.SetText(strNone) ucrInputAddReorder.bUpdateRCodeFromControl = True + clsBaseOperator.SetOperation("+") clsBaseOperator.AddParameter("ggplot", clsRFunctionParameter:=clsRggplotFunction, iPosition:=0) clsBaseOperator.AddParameter(strFirstParameterName, clsRFunctionParameter:=clsRgeomPlotFunction, iPosition:=2) @@ -207,6 +216,13 @@ Public Class dlgHistogram clsForecatsInfreqValue.SetPackageName("forcats") clsForecatsInfreqValue.SetRCommand("fct_infreq") + 'clsBaseOperator2.SetOperation("+") + 'clsBaseOperator2.AddParameter("ggplot", clsRFunctionParameter:=clsYlabScalesFunction, iPosition:=0) + + clsYlabScalesFunction.SetRCommand("scale_y_continuous") + clsYlabScalesFunction.AddParameter("NULL", "NULL", bIncludeArgumentName:=False, iPosition:=0) + clsYlabScalesFunction.AddParameter("breaks", "NULL", iPosition:=1) + clsBaseOperator.AddParameter(GgplotDefaults.clsDefaultThemeParameter.Clone()) clsXlabsFunction = GgplotDefaults.clsXlabTitleFunction.Clone() clsYlabFunction = GgplotDefaults.clsYlabTitleFunction.Clone() @@ -244,6 +260,7 @@ Public Class dlgHistogram ucrFactorReceiver.SetRCode(clsRaesFunction, bReset) ucrChkBinWidth.SetRCode(clsRgeomPlotFunction, bReset) ucrNudBinwidth.SetRCode(clsRgeomPlotFunction, bReset) + ucrChkOmitYAxis.SetRCode(clsYlabScalesFunction, bReset) End If End Sub @@ -269,12 +286,6 @@ Public Class dlgHistogram clsRgeomPlotFunction.SetPackageName("ggplot2") ucrInputAddReorder.Visible = Not ucrFactorReceiver.IsEmpty() - If Not ucrNudBinwidth.IsEmpty Then - clsRgeomPlotFunction.AddParameter("binwidth", 1.5, iPosition:=1) - Else - clsRgeomPlotFunction.RemoveParameterByName("binwidth") - End If - If rdoHistogram.Checked Then If ucrChkDisplayAsDotPlot.Checked Then clsRgeomPlotFunction.SetRCommand("geom_dotplot") @@ -294,11 +305,7 @@ Public Class dlgHistogram clsRgeomPlotFunction.RemoveParameterByName("stackgroups") End If End If - If Not ucrNudBinwidth.IsEmpty Then - clsRgeomPlotFunction.AddParameter("binwidth", 1.5, iPosition:=1) - Else - clsRgeomPlotFunction.RemoveParameterByName("binwidth") - End If + ucrFactorReceiver.ChangeParameterName("fill") If Not ucrSaveHist.bUserTyped Then ucrSaveHist.SetPrefix("histogram") End If @@ -331,6 +338,7 @@ Public Class dlgHistogram End If autoTranslate(Me) UpdateParameter() + End Sub Private Sub UpdateParameter() @@ -387,7 +395,7 @@ Public Class dlgHistogram End If End Sub - Private Sub ucrPnlOptions_Control() Handles ucrPnlOptions.ControlValueChanged, ucrChkDisplayAsDotPlot.ControlValueChanged, ucrChkRidges.ControlValueChanged, ucrFactorReceiver.ControlValueChanged, ucrVariablesAsFactorforHist.ControlValueChanged, ucrInputAddReorder.ControlValueChanged + Private Sub ucrPnlOptions_Control() Handles ucrPnlOptions.ControlValueChanged, ucrChkDisplayAsDotPlot.ControlValueChanged, ucrChkRidges.ControlValueChanged, ucrFactorReceiver.ControlValueChanged, ucrVariablesAsFactorforHist.ControlValueChanged, ucrInputAddReorder.ControlValueChanged, ucrChkOmitYAxis.ControlValueChanged toolStripMenuItemHistogramOptions.Enabled = rdoHistogram.Checked AndAlso Not ucrChkDisplayAsDotPlot.Checked toolStripMenuItemDotOptions.Enabled = rdoHistogram.Checked AndAlso ucrChkDisplayAsDotPlot.Checked toolStripMenuItemDensityOptions.Enabled = rdoDensity_ridges.Checked AndAlso Not ucrChkRidges.Checked @@ -518,5 +526,13 @@ Public Class dlgHistogram Private Sub ucrPnlOptions_Control(ucrChangedControl As ucrCore) Handles ucrVariablesAsFactorforHist.ControlValueChanged, ucrPnlOptions.ControlValueChanged, ucrInputAddReorder.ControlValueChanged, ucrFactorReceiver.ControlValueChanged, ucrChkRidges.ControlValueChanged, ucrChkDisplayAsDotPlot.ControlValueChanged End Sub - + Private Sub ucrChkOmitYAxis_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkOmitYAxis.ControlValueChanged, ucrChkDisplayAsDotPlot.ControlValueChanged + If ucrChkDisplayAsDotPlot.Checked Then + If ucrChkOmitYAxis.Checked Then + clsBaseOperator.AddParameter("scale", clsRFunctionParameter:=clsYlabScalesFunction, iPosition:=4, bIncludeArgumentName:=False) + Else + clsBaseOperator.RemoveParameterByName("scale") + End If + End If + End Sub End Class \ No newline at end of file From 86738fd7898370616582b061e146968af8b0fdd3 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Fri, 23 Feb 2024 13:08:46 +0100 Subject: [PATCH 07/88] Code Changes --- instat/dlgHistogram.vb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index 631b761abb3..fa34ea640a4 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -20,9 +20,7 @@ Public Class dlgHistogram Private bFirstLoad As Boolean = True Private bReset As Boolean = True Private clsBaseOperator As New ROperator - Private clsBaseOperator2 As New ROperator Private clsYlabScalesFunction As New RFunction - Private clsBreaksFunction As New RFunction Private clsRggplotFunction As New RFunction Private clsRgeomPlotFunction As New RFunction Private clsRaesFunction As New RFunction @@ -163,14 +161,12 @@ Public Class dlgHistogram Private Sub SetDefaults() clsBaseOperator = New ROperator - clsBaseOperator2 = New ROperator clsRggplotFunction = New RFunction clsRgeomPlotFunction = New RFunction clsRaesFunction = New RFunction clsHistAesFunction = New RFunction clsPercentage = New RFunction clsYlabScalesFunction = New RFunction - clsBreaksFunction = New RFunction clsForecatsReverse = New RFunction clsForecatsInfreqValue = New RFunction clsForecatsReverseValue = New RFunction @@ -216,9 +212,6 @@ Public Class dlgHistogram clsForecatsInfreqValue.SetPackageName("forcats") clsForecatsInfreqValue.SetRCommand("fct_infreq") - 'clsBaseOperator2.SetOperation("+") - 'clsBaseOperator2.AddParameter("ggplot", clsRFunctionParameter:=clsYlabScalesFunction, iPosition:=0) - clsYlabScalesFunction.SetRCommand("scale_y_continuous") clsYlabScalesFunction.AddParameter("NULL", "NULL", bIncludeArgumentName:=False, iPosition:=0) clsYlabScalesFunction.AddParameter("breaks", "NULL", iPosition:=1) From ca81275840484544da67a874657cf0799facbf64 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Fri, 23 Feb 2024 16:30:35 +0100 Subject: [PATCH 08/88] Added the Min. Height option to the dialog --- instat/dlgHistogram.designer.vb | 30 +++++++++++++++++++++++++++++- instat/dlgHistogram.vb | 21 +++++++++++++++------ 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/instat/dlgHistogram.designer.vb b/instat/dlgHistogram.designer.vb index ce9501cb7a3..56387030e90 100644 --- a/instat/dlgHistogram.designer.vb +++ b/instat/dlgHistogram.designer.vb @@ -67,6 +67,8 @@ Partial Class dlgHistogram Me.ucrBase = New instat.ucrButtons() Me.ucrPnlOptions = New instat.UcrPanel() Me.ucrChkOmitYAxis = New instat.ucrCheck() + Me.ucrNudMinHeight = New instat.ucrNud() + Me.ucrChkMinHeight = New instat.ucrCheck() Me.contextMenuStripOptions.SuspendLayout() Me.SuspendLayout() ' @@ -350,17 +352,41 @@ Partial Class dlgHistogram ' Me.ucrChkOmitYAxis.AutoSize = True Me.ucrChkOmitYAxis.Checked = False - Me.ucrChkOmitYAxis.Location = New System.Drawing.Point(8, 262) + Me.ucrChkOmitYAxis.Location = New System.Drawing.Point(10, 262) Me.ucrChkOmitYAxis.Name = "ucrChkOmitYAxis" Me.ucrChkOmitYAxis.Size = New System.Drawing.Size(153, 23) Me.ucrChkOmitYAxis.TabIndex = 42 ' + 'ucrNudMinHeight + ' + Me.ucrNudMinHeight.AutoSize = True + Me.ucrNudMinHeight.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudMinHeight.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudMinHeight.Location = New System.Drawing.Point(100, 313) + Me.ucrNudMinHeight.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudMinHeight.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudMinHeight.Name = "ucrNudMinHeight" + Me.ucrNudMinHeight.Size = New System.Drawing.Size(50, 20) + Me.ucrNudMinHeight.TabIndex = 44 + Me.ucrNudMinHeight.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrChkMinHeight + ' + Me.ucrChkMinHeight.AutoSize = True + Me.ucrChkMinHeight.Checked = False + Me.ucrChkMinHeight.Location = New System.Drawing.Point(10, 311) + Me.ucrChkMinHeight.Name = "ucrChkMinHeight" + Me.ucrChkMinHeight.Size = New System.Drawing.Size(153, 23) + Me.ucrChkMinHeight.TabIndex = 43 + ' 'dlgHistogram ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(448, 422) + Me.Controls.Add(Me.ucrNudMinHeight) + Me.Controls.Add(Me.ucrChkMinHeight) Me.Controls.Add(Me.ucrChkOmitYAxis) Me.Controls.Add(Me.ucrNudBinwidth) Me.Controls.Add(Me.ucrChkBinWidth) @@ -422,4 +448,6 @@ Partial Class dlgHistogram Friend WithEvents ucrChkBinWidth As ucrCheck Friend WithEvents ucrNudBinwidth As ucrNud Friend WithEvents ucrChkOmitYAxis As ucrCheck + Friend WithEvents ucrNudMinHeight As ucrNud + Friend WithEvents ucrChkMinHeight As ucrCheck End Class \ No newline at end of file diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index fa34ea640a4..f1ed3d8bb33 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -119,7 +119,6 @@ Public Class dlgHistogram ucrChkOmitYAxis.SetText("Omit Y Axis") ucrChkBinWidth.SetText("Binwidth") - 'ucrChkBinWidth.SetParameter(New RParameter("binwidth", 3)) ucrChkBinWidth.AddToLinkedControls({ucrNudBinwidth}, {True}, bNewLinkedHideIfParameterMissing:=True) ucrNudBinwidth.SetParameter(New RParameter("binwidth", 3)) @@ -132,6 +131,16 @@ Public Class dlgHistogram ucrChkRidges.SetText("Density Ridges") ucrChkRidges.AddFunctionNamesCondition(True, "geom_density_ridges") ucrChkRidges.AddFunctionNamesCondition(False, "geom_density_ridges", False) + ucrChkRidges.AddToLinkedControls({ucrChkMinHeight}, {True}, bNewLinkedHideIfParameterMissing:=True) + + ucrChkMinHeight.SetText("Min Height") + ucrChkMinHeight.AddToLinkedControls({ucrNudMinHeight}, {True}, bNewLinkedHideIfParameterMissing:=True) + + ucrNudMinHeight.SetParameter(New RParameter("rel_min_height", 4)) + ucrNudMinHeight.SetMinMax(0.00, 10.0) + ucrNudMinHeight.DecimalPlaces = 3 + ucrNudMinHeight.Increment = 0.01 + ucrNudMinHeight.SetRDefault(0.01) ucrVariablesAsFactorforHist.SetParameter(New RParameter("x", 0)) ucrVariablesAsFactorforHist.SetFactorReceiver(ucrFactorReceiver) @@ -252,7 +261,9 @@ Public Class dlgHistogram ucrInputStats.SetRCode(clsHistAesFunction, bReset) ucrFactorReceiver.SetRCode(clsRaesFunction, bReset) ucrChkBinWidth.SetRCode(clsRgeomPlotFunction, bReset) + ucrChkMinHeight.SetRCode(clsRgeomPlotFunction, bReset) ucrNudBinwidth.SetRCode(clsRgeomPlotFunction, bReset) + ucrNudMinHeight.SetRCode(clsRgeomPlotFunction, bReset) ucrChkOmitYAxis.SetRCode(clsYlabScalesFunction, bReset) End If End Sub @@ -388,7 +399,7 @@ Public Class dlgHistogram End If End Sub - Private Sub ucrPnlOptions_Control() Handles ucrPnlOptions.ControlValueChanged, ucrChkDisplayAsDotPlot.ControlValueChanged, ucrChkRidges.ControlValueChanged, ucrFactorReceiver.ControlValueChanged, ucrVariablesAsFactorforHist.ControlValueChanged, ucrInputAddReorder.ControlValueChanged, ucrChkOmitYAxis.ControlValueChanged + Private Sub ucrPnlOptions_Control() Handles ucrPnlOptions.ControlValueChanged, ucrChkDisplayAsDotPlot.ControlValueChanged, ucrChkRidges.ControlValueChanged, ucrFactorReceiver.ControlValueChanged, ucrVariablesAsFactorforHist.ControlValueChanged, ucrInputAddReorder.ControlValueChanged, ucrChkOmitYAxis.ControlValueChanged, ucrNudBinwidth.ControlValueChanged toolStripMenuItemHistogramOptions.Enabled = rdoHistogram.Checked AndAlso Not ucrChkDisplayAsDotPlot.Checked toolStripMenuItemDotOptions.Enabled = rdoHistogram.Checked AndAlso ucrChkDisplayAsDotPlot.Checked toolStripMenuItemDensityOptions.Enabled = rdoDensity_ridges.Checked AndAlso Not ucrChkRidges.Checked @@ -512,13 +523,10 @@ Public Class dlgHistogram End If End Sub - Private Sub CoreControls_ControlContentsChanged() Handles ucrVariablesAsFactorforHist.ControlContentsChanged, ucrSaveHist.ControlContentsChanged, ucrFactorReceiver.ControlContentsChanged, ucrChkRidges.ControlContentsChanged, ucrInputAddReorder.ControlContentsChanged, ucrChkBinWidth.ControlContentsChanged, ucrNudBinwidth.ControlContentsChanged + Private Sub CoreControls_ControlContentsChanged() Handles ucrVariablesAsFactorforHist.ControlContentsChanged, ucrSaveHist.ControlContentsChanged, ucrFactorReceiver.ControlContentsChanged, ucrChkRidges.ControlContentsChanged, ucrInputAddReorder.ControlContentsChanged, ucrChkBinWidth.ControlContentsChanged, ucrNudBinwidth.ControlContentsChanged, ucrNudMinHeight.ControlContentsChanged TestOkEnabled() End Sub - Private Sub ucrPnlOptions_Control(ucrChangedControl As ucrCore) Handles ucrVariablesAsFactorforHist.ControlValueChanged, ucrPnlOptions.ControlValueChanged, ucrInputAddReorder.ControlValueChanged, ucrFactorReceiver.ControlValueChanged, ucrChkRidges.ControlValueChanged, ucrChkDisplayAsDotPlot.ControlValueChanged - - End Sub Private Sub ucrChkOmitYAxis_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkOmitYAxis.ControlValueChanged, ucrChkDisplayAsDotPlot.ControlValueChanged If ucrChkDisplayAsDotPlot.Checked Then If ucrChkOmitYAxis.Checked Then @@ -528,4 +536,5 @@ Public Class dlgHistogram End If End If End Sub + End Class \ No newline at end of file From b23ca8fb98b36c401b97b42c9f7e290a3121bd70 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Fri, 23 Feb 2024 17:05:26 +0100 Subject: [PATCH 09/88] code changes --- instat/dlgHistogram.vb | 3 --- 1 file changed, 3 deletions(-) diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index 223dad7ed85..93634a3383a 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -794,9 +794,6 @@ Public Class dlgHistogram AutoFacetStation() SetPipeAssignTo() End Sub - Private Sub CoreControls_ControlContentsChanged() Handles ucrVariablesAsFactorforHist.ControlContentsChanged, ucrSaveHist.ControlContentsChanged, ucrFactorReceiver.ControlContentsChanged, ucrChkRidges.ControlContentsChanged, ucrInputAddReorder.ControlContentsChanged - TestOkEnabled() - End Sub End Class \ No newline at end of file From d0653abfe5a64ed28d821107d2d1c962483cabba Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Mon, 26 Feb 2024 13:37:50 +0100 Subject: [PATCH 10/88] Code Changes --- instat/dlgHistogram.designer.vb | 17 ++++------------- instat/dlgHistogram.vb | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/instat/dlgHistogram.designer.vb b/instat/dlgHistogram.designer.vb index bf178743286..6734e758e20 100644 --- a/instat/dlgHistogram.designer.vb +++ b/instat/dlgHistogram.designer.vb @@ -66,19 +66,14 @@ Partial Class dlgHistogram Me.ucrHistogramSelector = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() Me.ucrPnlOptions = New instat.UcrPanel() - Me.ucrChkOmitYAxis = New instat.ucrCheck() Me.ucrNudMinHeight = New instat.ucrNud() Me.ucrChkMinHeight = New instat.ucrCheck() - - Me.lblReorder = New System.Windows.Forms.Label() - Me.ucrInputAddReorder = New instat.ucrInputComboBox() Me.ucrInputStation = New instat.ucrInputComboBox() Me.ucr1stFactorReceiver = New instat.ucrReceiverSingle() Me.lblFacetBy = New System.Windows.Forms.Label() Me.ucrInputLegendPosition = New instat.ucrInputComboBox() Me.ucrChkLegend = New instat.ucrCheck() - Me.contextMenuStripOptions.SuspendLayout() Me.SuspendLayout() ' @@ -209,7 +204,7 @@ Partial Class dlgHistogram Me.ucrNudBinwidth.AutoSize = True Me.ucrNudBinwidth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudBinwidth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudBinwidth.Location = New System.Drawing.Point(100, 287) + Me.ucrNudBinwidth.Location = New System.Drawing.Point(100, 262) Me.ucrNudBinwidth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudBinwidth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudBinwidth.Name = "ucrNudBinwidth" @@ -221,7 +216,7 @@ Partial Class dlgHistogram ' Me.ucrChkBinWidth.AutoSize = True Me.ucrChkBinWidth.Checked = False - Me.ucrChkBinWidth.Location = New System.Drawing.Point(10, 285) + Me.ucrChkBinWidth.Location = New System.Drawing.Point(10, 260) Me.ucrChkBinWidth.Name = "ucrChkBinWidth" Me.ucrChkBinWidth.Size = New System.Drawing.Size(153, 23) Me.ucrChkBinWidth.TabIndex = 40 @@ -362,7 +357,7 @@ Partial Class dlgHistogram ' Me.ucrChkOmitYAxis.AutoSize = True Me.ucrChkOmitYAxis.Checked = False - Me.ucrChkOmitYAxis.Location = New System.Drawing.Point(10, 262) + Me.ucrChkOmitYAxis.Location = New System.Drawing.Point(10, 287) Me.ucrChkOmitYAxis.Name = "ucrChkOmitYAxis" Me.ucrChkOmitYAxis.Size = New System.Drawing.Size(153, 23) Me.ucrChkOmitYAxis.TabIndex = 42 @@ -449,21 +444,17 @@ Partial Class dlgHistogram Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - - Me.ClientSize = New System.Drawing.Size(448, 422) + Me.ClientSize = New System.Drawing.Size(448, 461) Me.Controls.Add(Me.ucrNudMinHeight) Me.Controls.Add(Me.ucrChkMinHeight) Me.Controls.Add(Me.ucrChkOmitYAxis) Me.Controls.Add(Me.ucrNudBinwidth) Me.Controls.Add(Me.ucrChkBinWidth) - - Me.ClientSize = New System.Drawing.Size(448, 461) Me.Controls.Add(Me.ucrInputStation) Me.Controls.Add(Me.ucr1stFactorReceiver) Me.Controls.Add(Me.lblFacetBy) Me.Controls.Add(Me.ucrInputLegendPosition) Me.Controls.Add(Me.ucrChkLegend) - Me.Controls.Add(Me.lblReorder) Me.Controls.Add(Me.ucrInputAddReorder) Me.Controls.Add(Me.cmdOptions) diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index 93634a3383a..66f0ec04a3a 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -419,6 +419,8 @@ Public Class dlgHistogram ElseIf rdoFrequencyPolygon.Checked Then ucrFactorReceiver.ChangeParameterName("colour") clsRgeomPlotFunction.SetRCommand("geom_freqpoly") + clsRgeomPlotFunction.RemoveParameterByName("binpositions") + clsRgeomPlotFunction.RemoveParameterByName("stackgroups") If Not ucrSaveHist.bUserTyped Then ucrSaveHist.SetPrefix("frequency_polygon") End If @@ -740,6 +742,25 @@ Public Class dlgHistogram End If End Sub + Private Sub ucrChkMinHeight_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkMinHeight.ControlValueChanged, ucrNudMinHeight.ControlValueChanged + If ucrChkRidges.Checked Then + If ucrChkMinHeight.Checked Then + clsRgeomPlotFunction.AddParameter("rel_min_height", ucrNudMinHeight.GetText, iPosition:=4) + Else + clsRgeomPlotFunction.RemoveParameterByName("rel_min_height") + End If + End If + End Sub + + Private Sub ucrChkBinWidth_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkBinWidth.ControlValueChanged, ucrNudBinwidth.ControlValueChanged + If Not rdoDensity_ridges.Checked Then + If ucrChkBinWidth.Checked Then + clsRgeomPlotFunction.AddParameter("binwidth", ucrNudBinwidth.GetText, iPosition:=4) + Else + clsRgeomPlotFunction.RemoveParameterByName("binwidth") + End If + End If + End Sub Private Sub ucr1stFactorReceiver_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucr1stFactorReceiver.ControlValueChanged, ucrVariablesAsFactorforHist.ControlValueChanged AddRemoveFacets() From 152b44c7868ec4100befb1d35d389e3c234b6620 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Tue, 27 Feb 2024 09:36:06 +0100 Subject: [PATCH 11/88] Code Changes --- instat/dlgHistogram.vb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index 66f0ec04a3a..90c1427accf 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -397,6 +397,8 @@ Public Class dlgHistogram If Not ucrSaveHist.bUserTyped Then ucrSaveHist.SetPrefix("histogram") End If If rdoDensity_ridges.Checked Then + clsRgeomPlotFunction.RemoveParameterByName("binpositions") + clsRgeomPlotFunction.RemoveParameterByName("stackgroups") If ucrChkRidges.Checked Then ucrFactorReceiver.ChangeParameterName("y") clsHistAesFunction.RemoveParameterByName("y") From b8919cd82a93978f60a891c93320408d695e5e58 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Wed, 28 Feb 2024 15:03:18 +0100 Subject: [PATCH 12/88] Code Changes --- instat/dlgHistogram.designer.vb | 2 +- instat/dlgHistogram.vb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/instat/dlgHistogram.designer.vb b/instat/dlgHistogram.designer.vb index 6734e758e20..19c609961f4 100644 --- a/instat/dlgHistogram.designer.vb +++ b/instat/dlgHistogram.designer.vb @@ -216,7 +216,7 @@ Partial Class dlgHistogram ' Me.ucrChkBinWidth.AutoSize = True Me.ucrChkBinWidth.Checked = False - Me.ucrChkBinWidth.Location = New System.Drawing.Point(10, 260) + Me.ucrChkBinWidth.Location = New System.Drawing.Point(10, 262) Me.ucrChkBinWidth.Name = "ucrChkBinWidth" Me.ucrChkBinWidth.Size = New System.Drawing.Size(153, 23) Me.ucrChkBinWidth.TabIndex = 40 diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index 90c1427accf..64a8dc764ba 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -595,6 +595,9 @@ Public Class dlgHistogram Me.ucrInputAddReorder.Location = New Point(283, 289) Me.ucrSaveHist.Location = New Point(10, 360) Me.ucrChkLegend.Location = New Point(11, 329) + Me.ucrChkBinWidth.Location = New Point(10, 262) + Me.ucrChkOmitYAxis.Location = New Point(10, 287) + Me.ucrNudBinwidth.Location = New Point(100, 262) Me.ucrInputStation.Location = New Point(318, 328) Me.ucrInputLegendPosition.Location = New Point(87, 328) Me.ucr1stFactorReceiver.Location = New Point(205, 329) @@ -604,6 +607,8 @@ Public Class dlgHistogram Me.Size = New Size(464, 500) Me.lblReorder.Location = New Point(286, 298) Me.ucrInputAddReorder.Location = New Point(287, 314) + Me.ucrChkMinHeight.Location = New Point(10, 311) + Me.ucrNudMinHeight.Location = New Point(100, 311) Me.ucrSaveHist.Location = New Point(10, 380) Me.ucrBase.Location = New Point(10, 408) Me.ucrChkLegend.Location = New Point(11, 349) @@ -616,6 +621,7 @@ Public Class dlgHistogram Me.lblReorder.Location = New Point(283, 250) Me.ucrInputAddReorder.Location = New Point(283, 264) Me.ucrSaveHist.Location = New Point(10, 330) + Me.ucrChkBinWidth.Location = New Point(10, 262) Me.ucrChkLegend.Location = New Point(11, 296) Me.ucrInputStation.Location = New Point(318, 294) Me.ucrInputLegendPosition.Location = New Point(87, 294) From d40e4bcd7fc801c4fc6b7ad1ea3c90865333c777 Mon Sep 17 00:00:00 2001 From: Ntalumeso Date: Mon, 4 Mar 2024 11:30:50 +0300 Subject: [PATCH 13/88] Changed AfterCellEdit to CellEditTextChanging --- instat/ucrFactor.vb | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/instat/ucrFactor.vb b/instat/ucrFactor.vb index d727b17e2eb..715ce4f6710 100644 --- a/instat/ucrFactor.vb +++ b/instat/ucrFactor.vb @@ -189,15 +189,15 @@ Public Class ucrFactor ''' ''' ''' - Private Sub _grdSheet_AfterCellEdit(sender As Object, e As CellAfterEditEventArgs) Handles _grdSheet.AfterCellEdit + Private Sub _grdSheet_CellEditTextChanging(sender As Object, e As CellEditTextChangingEventArgs) Handles _grdSheet.CellEditTextChanging Dim bValid As Boolean = True 'do levels entry validation If _grdSheet.ColumnHeaders(e.Cell.Column).Text = DefaultColumnNames.Level Then - If Not IsNumeric(e.NewData) Then + If Not IsNumeric(e.Text) Then MsgBox("Levels must be numeric values", MsgBoxStyle.Information, "Invalid Value") bValid = False - ElseIf e.NewData.Contains(".") Then + ElseIf e.Text.Contains(".") Then MsgBox("Levels must not be decimal", MsgBoxStyle.Information, "Invalid Value") bValid = False @@ -207,13 +207,13 @@ Public Class ucrFactor If bValid Then 'set the new data before calling OnControlValueChanged 'very important especially when writing to the parameter value - _grdSheet(e.Cell.Row, e.Cell.Column) = e.NewData + _grdSheet(e.Cell.Row, e.Cell.Column) = e.Text 'this will raise ControlContentsChanged event 'and also update parameter and R code with the values OnControlValueChanged() e.Cell.Style.BackColor = Color.Gold Else - e.EndReason = EndEditReason.Cancel + 'Todo what will happen if the text is not valid End If End Sub @@ -937,24 +937,4 @@ Public Class ucrFactor SetToggleButtonSettings() End Sub - Private Sub _grdSheet_CellEditTextChanging(sender As Object, e As CellEditTextChangingEventArgs) Handles _grdSheet.CellEditTextChanging - Dim bValid As Boolean = True - 'do levels entry validation - If _grdSheet.ColumnHeaders(e.Cell.Column).Text = DefaultColumnNames.Level Then - If Not IsNumeric(e.Text) Then - MsgBox("Levels must be numeric values", MsgBoxStyle.Information, "Invalid Value") - bValid = False - ElseIf e.Text.Contains(".") Then - MsgBox("Levels must not be decimal", MsgBoxStyle.Information, "Invalid Value") - - bValid = False - End If - End If - If bValid Then - _grdSheet(e.Cell.Row, e.Cell.Column) = e.Text - 'this will raise ControlContentsChanged event - 'and also update parameter and R code with the values - OnControlValueChanged() - End If - End Sub End Class \ No newline at end of file From 22f78ffd21f9d65e6e3deffaf97600cdf31e319d Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:35:36 +0100 Subject: [PATCH 14/88] Main code changes --- instat/dlgHistogram.designer.vb | 198 ++++++++++++++++---------------- instat/dlgHistogram.vb | 32 +++--- 2 files changed, 117 insertions(+), 113 deletions(-) diff --git a/instat/dlgHistogram.designer.vb b/instat/dlgHistogram.designer.vb index 19c609961f4..ae09cf258e4 100644 --- a/instat/dlgHistogram.designer.vb +++ b/instat/dlgHistogram.designer.vb @@ -52,8 +52,16 @@ Partial Class dlgHistogram Me.toolStripMenuItemDensityRidgesOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemFrequencyPolygonOptions = New System.Windows.Forms.ToolStripMenuItem() Me.lblReorder = New System.Windows.Forms.Label() + Me.lblFacetBy = New System.Windows.Forms.Label() + Me.ucrNudMinHeight = New instat.ucrNud() + Me.ucrChkMinHeight = New instat.ucrCheck() + Me.ucrChkOmitYAxis = New instat.ucrCheck() Me.ucrNudBinwidth = New instat.ucrNud() Me.ucrChkBinWidth = New instat.ucrCheck() + Me.ucrInputStation = New instat.ucrInputComboBox() + Me.ucr1stFactorReceiver = New instat.ucrReceiverSingle() + Me.ucrInputLegendPosition = New instat.ucrInputComboBox() + Me.ucrChkLegend = New instat.ucrCheck() Me.ucrInputAddReorder = New instat.ucrInputComboBox() Me.cmdOptions = New instat.ucrSplitButton() Me.ucrChkDisplayAsDotPlot = New instat.ucrCheck() @@ -66,14 +74,6 @@ Partial Class dlgHistogram Me.ucrHistogramSelector = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() Me.ucrPnlOptions = New instat.UcrPanel() - Me.ucrChkOmitYAxis = New instat.ucrCheck() - Me.ucrNudMinHeight = New instat.ucrNud() - Me.ucrChkMinHeight = New instat.ucrCheck() - Me.ucrInputStation = New instat.ucrInputComboBox() - Me.ucr1stFactorReceiver = New instat.ucrReceiverSingle() - Me.lblFacetBy = New System.Windows.Forms.Label() - Me.ucrInputLegendPosition = New instat.ucrInputComboBox() - Me.ucrChkLegend = New instat.ucrCheck() Me.contextMenuStripOptions.SuspendLayout() Me.SuspendLayout() ' @@ -199,12 +199,54 @@ Partial Class dlgHistogram Me.lblReorder.TabIndex = 38 Me.lblReorder.Text = "Reorder:" ' + 'lblFacetBy + ' + Me.lblFacetBy.AutoSize = True + Me.lblFacetBy.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFacetBy.Location = New System.Drawing.Point(208, 334) + Me.lblFacetBy.Name = "lblFacetBy" + Me.lblFacetBy.Size = New System.Drawing.Size(52, 13) + Me.lblFacetBy.TabIndex = 84 + Me.lblFacetBy.Tag = "" + Me.lblFacetBy.Text = "Facet By:" + ' + 'ucrNudMinHeight + ' + Me.ucrNudMinHeight.AutoSize = True + Me.ucrNudMinHeight.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudMinHeight.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudMinHeight.Location = New System.Drawing.Point(159, 313) + Me.ucrNudMinHeight.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudMinHeight.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudMinHeight.Name = "ucrNudMinHeight" + Me.ucrNudMinHeight.Size = New System.Drawing.Size(50, 20) + Me.ucrNudMinHeight.TabIndex = 44 + Me.ucrNudMinHeight.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrChkMinHeight + ' + Me.ucrChkMinHeight.AutoSize = True + Me.ucrChkMinHeight.Checked = False + Me.ucrChkMinHeight.Location = New System.Drawing.Point(10, 311) + Me.ucrChkMinHeight.Name = "ucrChkMinHeight" + Me.ucrChkMinHeight.Size = New System.Drawing.Size(143, 23) + Me.ucrChkMinHeight.TabIndex = 43 + ' + 'ucrChkOmitYAxis + ' + Me.ucrChkOmitYAxis.AutoSize = True + Me.ucrChkOmitYAxis.Checked = False + Me.ucrChkOmitYAxis.Location = New System.Drawing.Point(10, 287) + Me.ucrChkOmitYAxis.Name = "ucrChkOmitYAxis" + Me.ucrChkOmitYAxis.Size = New System.Drawing.Size(143, 23) + Me.ucrChkOmitYAxis.TabIndex = 42 + ' 'ucrNudBinwidth ' Me.ucrNudBinwidth.AutoSize = True Me.ucrNudBinwidth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudBinwidth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudBinwidth.Location = New System.Drawing.Point(100, 262) + Me.ucrNudBinwidth.Location = New System.Drawing.Point(161, 262) Me.ucrNudBinwidth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudBinwidth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudBinwidth.Name = "ucrNudBinwidth" @@ -218,9 +260,53 @@ Partial Class dlgHistogram Me.ucrChkBinWidth.Checked = False Me.ucrChkBinWidth.Location = New System.Drawing.Point(10, 262) Me.ucrChkBinWidth.Name = "ucrChkBinWidth" - Me.ucrChkBinWidth.Size = New System.Drawing.Size(153, 23) + Me.ucrChkBinWidth.Size = New System.Drawing.Size(144, 23) Me.ucrChkBinWidth.TabIndex = 40 ' + 'ucrInputStation + ' + Me.ucrInputStation.AddQuotesIfUnrecognised = True + Me.ucrInputStation.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputStation.GetSetSelectedIndex = -1 + Me.ucrInputStation.IsReadOnly = False + Me.ucrInputStation.Location = New System.Drawing.Point(318, 348) + Me.ucrInputStation.Name = "ucrInputStation" + Me.ucrInputStation.Size = New System.Drawing.Size(101, 21) + Me.ucrInputStation.TabIndex = 86 + ' + 'ucr1stFactorReceiver + ' + Me.ucr1stFactorReceiver.AutoSize = True + Me.ucr1stFactorReceiver.frmParent = Me + Me.ucr1stFactorReceiver.Location = New System.Drawing.Point(205, 349) + Me.ucr1stFactorReceiver.Margin = New System.Windows.Forms.Padding(0) + Me.ucr1stFactorReceiver.Name = "ucr1stFactorReceiver" + Me.ucr1stFactorReceiver.Selector = Nothing + Me.ucr1stFactorReceiver.Size = New System.Drawing.Size(110, 26) + Me.ucr1stFactorReceiver.strNcFilePath = "" + Me.ucr1stFactorReceiver.TabIndex = 85 + Me.ucr1stFactorReceiver.ucrSelector = Nothing + ' + 'ucrInputLegendPosition + ' + Me.ucrInputLegendPosition.AddQuotesIfUnrecognised = True + Me.ucrInputLegendPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLegendPosition.GetSetSelectedIndex = -1 + Me.ucrInputLegendPosition.IsReadOnly = False + Me.ucrInputLegendPosition.Location = New System.Drawing.Point(87, 348) + Me.ucrInputLegendPosition.Name = "ucrInputLegendPosition" + Me.ucrInputLegendPosition.Size = New System.Drawing.Size(112, 21) + Me.ucrInputLegendPosition.TabIndex = 88 + ' + 'ucrChkLegend + ' + Me.ucrChkLegend.AutoSize = True + Me.ucrChkLegend.Checked = False + Me.ucrChkLegend.Location = New System.Drawing.Point(11, 349) + Me.ucrChkLegend.Name = "ucrChkLegend" + Me.ucrChkLegend.Size = New System.Drawing.Size(98, 24) + Me.ucrChkLegend.TabIndex = 87 + ' 'ucrInputAddReorder ' Me.ucrInputAddReorder.AddQuotesIfUnrecognised = True @@ -353,92 +439,6 @@ Partial Class dlgHistogram Me.ucrPnlOptions.Size = New System.Drawing.Size(433, 30) Me.ucrPnlOptions.TabIndex = 0 ' - 'ucrChkOmitYAxis - ' - Me.ucrChkOmitYAxis.AutoSize = True - Me.ucrChkOmitYAxis.Checked = False - Me.ucrChkOmitYAxis.Location = New System.Drawing.Point(10, 287) - Me.ucrChkOmitYAxis.Name = "ucrChkOmitYAxis" - Me.ucrChkOmitYAxis.Size = New System.Drawing.Size(153, 23) - Me.ucrChkOmitYAxis.TabIndex = 42 - ' - 'ucrNudMinHeight - ' - Me.ucrNudMinHeight.AutoSize = True - Me.ucrNudMinHeight.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudMinHeight.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudMinHeight.Location = New System.Drawing.Point(100, 313) - Me.ucrNudMinHeight.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudMinHeight.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudMinHeight.Name = "ucrNudMinHeight" - Me.ucrNudMinHeight.Size = New System.Drawing.Size(50, 20) - Me.ucrNudMinHeight.TabIndex = 44 - Me.ucrNudMinHeight.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrChkMinHeight - ' - Me.ucrChkMinHeight.AutoSize = True - Me.ucrChkMinHeight.Checked = False - Me.ucrChkMinHeight.Location = New System.Drawing.Point(10, 311) - Me.ucrChkMinHeight.Name = "ucrChkMinHeight" - Me.ucrChkMinHeight.Size = New System.Drawing.Size(153, 23) - Me.ucrChkMinHeight.TabIndex = 43 - ' - 'ucrInputStation - ' - Me.ucrInputStation.AddQuotesIfUnrecognised = True - Me.ucrInputStation.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputStation.GetSetSelectedIndex = -1 - Me.ucrInputStation.IsReadOnly = False - Me.ucrInputStation.Location = New System.Drawing.Point(318, 348) - Me.ucrInputStation.Name = "ucrInputStation" - Me.ucrInputStation.Size = New System.Drawing.Size(101, 21) - Me.ucrInputStation.TabIndex = 86 - ' - 'ucr1stFactorReceiver - ' - Me.ucr1stFactorReceiver.AutoSize = True - Me.ucr1stFactorReceiver.frmParent = Me - Me.ucr1stFactorReceiver.Location = New System.Drawing.Point(205, 349) - Me.ucr1stFactorReceiver.Margin = New System.Windows.Forms.Padding(0) - Me.ucr1stFactorReceiver.Name = "ucr1stFactorReceiver" - Me.ucr1stFactorReceiver.Selector = Nothing - Me.ucr1stFactorReceiver.Size = New System.Drawing.Size(110, 26) - Me.ucr1stFactorReceiver.strNcFilePath = "" - Me.ucr1stFactorReceiver.TabIndex = 85 - Me.ucr1stFactorReceiver.ucrSelector = Nothing - ' - 'lblFacetBy - ' - Me.lblFacetBy.AutoSize = True - Me.lblFacetBy.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblFacetBy.Location = New System.Drawing.Point(208, 334) - Me.lblFacetBy.Name = "lblFacetBy" - Me.lblFacetBy.Size = New System.Drawing.Size(52, 13) - Me.lblFacetBy.TabIndex = 84 - Me.lblFacetBy.Tag = "" - Me.lblFacetBy.Text = "Facet By:" - ' - 'ucrInputLegendPosition - ' - Me.ucrInputLegendPosition.AddQuotesIfUnrecognised = True - Me.ucrInputLegendPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputLegendPosition.GetSetSelectedIndex = -1 - Me.ucrInputLegendPosition.IsReadOnly = False - Me.ucrInputLegendPosition.Location = New System.Drawing.Point(87, 348) - Me.ucrInputLegendPosition.Name = "ucrInputLegendPosition" - Me.ucrInputLegendPosition.Size = New System.Drawing.Size(112, 21) - Me.ucrInputLegendPosition.TabIndex = 88 - ' - 'ucrChkLegend - ' - Me.ucrChkLegend.AutoSize = True - Me.ucrChkLegend.Checked = False - Me.ucrChkLegend.Location = New System.Drawing.Point(11, 349) - Me.ucrChkLegend.Name = "ucrChkLegend" - Me.ucrChkLegend.Size = New System.Drawing.Size(98, 24) - Me.ucrChkLegend.TabIndex = 87 - ' 'dlgHistogram ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) @@ -446,10 +446,8 @@ Partial Class dlgHistogram Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(448, 461) Me.Controls.Add(Me.ucrNudMinHeight) - Me.Controls.Add(Me.ucrChkMinHeight) - Me.Controls.Add(Me.ucrChkOmitYAxis) Me.Controls.Add(Me.ucrNudBinwidth) - Me.Controls.Add(Me.ucrChkBinWidth) + Me.Controls.Add(Me.ucrChkOmitYAxis) Me.Controls.Add(Me.ucrInputStation) Me.Controls.Add(Me.ucr1stFactorReceiver) Me.Controls.Add(Me.lblFacetBy) @@ -473,6 +471,8 @@ Partial Class dlgHistogram Me.Controls.Add(Me.lblfactor) Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.ucrPnlOptions) + Me.Controls.Add(Me.ucrChkMinHeight) + Me.Controls.Add(Me.ucrChkBinWidth) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index 64a8dc764ba..57ac451575c 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -152,9 +152,9 @@ Public Class dlgHistogram ucrChkMinHeight.AddToLinkedControls({ucrNudMinHeight}, {True}, bNewLinkedHideIfParameterMissing:=True) ucrNudMinHeight.SetParameter(New RParameter("rel_min_height", 4)) - ucrNudMinHeight.SetMinMax(0.00, 10.0) + ucrNudMinHeight.SetMinMax(0.000, 10.0) ucrNudMinHeight.DecimalPlaces = 3 - ucrNudMinHeight.Increment = 0.01 + ucrNudMinHeight.Increment = 0.001 ucrNudMinHeight.SetRDefault(0.01) ucrVariablesAsFactorforHist.SetParameter(New RParameter("x", 0)) @@ -327,15 +327,15 @@ Public Class dlgHistogram ucrChkLegend.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True) ucrInputLegendPosition.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True) - + ucrNudBinwidth.SetRCode(clsRgeomPlotFunction, bReset) + ucrNudMinHeight.SetRCode(clsRgeomPlotFunction, bReset) + ucrChkMinHeight.SetRCode(clsRgeomPlotFunction, bReset) + ucrChkBinWidth.SetRCode(clsRgeomPlotFunction, bReset) + ucrChkOmitYAxis.SetRCode(clsBaseOperator, bReset) If bReset Then ucrInputStats.SetRCode(clsHistAesFunction, bReset) ucrFactorReceiver.SetRCode(clsRaesFunction, bReset) - ucrChkBinWidth.SetRCode(clsRgeomPlotFunction, bReset) - ucrChkMinHeight.SetRCode(clsRgeomPlotFunction, bReset) - ucrNudBinwidth.SetRCode(clsRgeomPlotFunction, bReset) - ucrNudMinHeight.SetRCode(clsRgeomPlotFunction, bReset) - ucrChkOmitYAxis.SetRCode(clsYlabScalesFunction, bReset) + End If End Sub @@ -377,6 +377,7 @@ Public Class dlgHistogram If ucrChkDisplayAsDotPlot.Checked Then clsRgeomPlotFunction.SetRCommand("geom_dotplot") clsRgeomPlotFunction.RemoveParameterByName("mapping") + clsRgeomPlotFunction.RemoveParameterByName("rel_min_height") If Not ucrFactorReceiver.IsEmpty Then clsRgeomPlotFunction.AddParameter("binpositions", Chr(34) & "all" & Chr(34), iPosition:=0) clsRgeomPlotFunction.AddParameter("stackgroups", "TRUE", iPosition:=1) @@ -392,13 +393,15 @@ Public Class dlgHistogram clsRgeomPlotFunction.RemoveParameterByName("stackgroups") End If End If - + clsBaseOperator.RemoveParameterByName("scale") ucrFactorReceiver.ChangeParameterName("fill") If Not ucrSaveHist.bUserTyped Then ucrSaveHist.SetPrefix("histogram") End If If rdoDensity_ridges.Checked Then clsRgeomPlotFunction.RemoveParameterByName("binpositions") clsRgeomPlotFunction.RemoveParameterByName("stackgroups") + clsRgeomPlotFunction.RemoveParameterByName("binwidth") + clsBaseOperator.RemoveParameterByName("scale") If ucrChkRidges.Checked Then ucrFactorReceiver.ChangeParameterName("y") clsHistAesFunction.RemoveParameterByName("y") @@ -423,6 +426,8 @@ Public Class dlgHistogram clsRgeomPlotFunction.SetRCommand("geom_freqpoly") clsRgeomPlotFunction.RemoveParameterByName("binpositions") clsRgeomPlotFunction.RemoveParameterByName("stackgroups") + clsRgeomPlotFunction.RemoveParameterByName("rel_min_height") + clsBaseOperator.RemoveParameterByName("scale") If Not ucrSaveHist.bUserTyped Then ucrSaveHist.SetPrefix("frequency_polygon") End If @@ -751,8 +756,8 @@ Public Class dlgHistogram End Sub Private Sub ucrChkMinHeight_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkMinHeight.ControlValueChanged, ucrNudMinHeight.ControlValueChanged - If ucrChkRidges.Checked Then - If ucrChkMinHeight.Checked Then + If ucrChkRidges.Checked AndAlso ucrChkMinHeight.Checked Then + If Not ucrNudMinHeight.IsEmpty Then clsRgeomPlotFunction.AddParameter("rel_min_height", ucrNudMinHeight.GetText, iPosition:=4) Else clsRgeomPlotFunction.RemoveParameterByName("rel_min_height") @@ -761,8 +766,8 @@ Public Class dlgHistogram End Sub Private Sub ucrChkBinWidth_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkBinWidth.ControlValueChanged, ucrNudBinwidth.ControlValueChanged - If Not rdoDensity_ridges.Checked Then - If ucrChkBinWidth.Checked Then + If ucrChkDisplayAsDotPlot.Checked OrElse ucrChkBinWidth.Checked Then + If Not ucrNudBinwidth.IsEmpty Then clsRgeomPlotFunction.AddParameter("binwidth", ucrNudBinwidth.GetText, iPosition:=4) Else clsRgeomPlotFunction.RemoveParameterByName("binwidth") @@ -824,5 +829,4 @@ Public Class dlgHistogram SetPipeAssignTo() End Sub - End Class \ No newline at end of file From 753e68fb964ceac6ab8d2c676510ef310aa75014 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:44:58 +0100 Subject: [PATCH 15/88] Design and Code changes --- instat/dlgHistogram.designer.vb | 4 ++-- instat/dlgHistogram.vb | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/instat/dlgHistogram.designer.vb b/instat/dlgHistogram.designer.vb index ae09cf258e4..cd3e8c675ef 100644 --- a/instat/dlgHistogram.designer.vb +++ b/instat/dlgHistogram.designer.vb @@ -215,7 +215,7 @@ Partial Class dlgHistogram Me.ucrNudMinHeight.AutoSize = True Me.ucrNudMinHeight.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudMinHeight.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudMinHeight.Location = New System.Drawing.Point(159, 313) + Me.ucrNudMinHeight.Location = New System.Drawing.Point(138, 313) Me.ucrNudMinHeight.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudMinHeight.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudMinHeight.Name = "ucrNudMinHeight" @@ -246,7 +246,7 @@ Partial Class dlgHistogram Me.ucrNudBinwidth.AutoSize = True Me.ucrNudBinwidth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudBinwidth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudBinwidth.Location = New System.Drawing.Point(161, 262) + Me.ucrNudBinwidth.Location = New System.Drawing.Point(139, 262) Me.ucrNudBinwidth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudBinwidth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudBinwidth.Name = "ucrNudBinwidth" diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index 57ac451575c..ceffb5cb7ed 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -602,7 +602,7 @@ Public Class dlgHistogram Me.ucrChkLegend.Location = New Point(11, 329) Me.ucrChkBinWidth.Location = New Point(10, 262) Me.ucrChkOmitYAxis.Location = New Point(10, 287) - Me.ucrNudBinwidth.Location = New Point(100, 262) + Me.ucrNudBinwidth.Location = New Point(139, 262) Me.ucrInputStation.Location = New Point(318, 328) Me.ucrInputLegendPosition.Location = New Point(87, 328) Me.ucr1stFactorReceiver.Location = New Point(205, 329) @@ -613,7 +613,7 @@ Public Class dlgHistogram Me.lblReorder.Location = New Point(286, 298) Me.ucrInputAddReorder.Location = New Point(287, 314) Me.ucrChkMinHeight.Location = New Point(10, 311) - Me.ucrNudMinHeight.Location = New Point(100, 311) + Me.ucrNudMinHeight.Location = New Point(138, 313) Me.ucrSaveHist.Location = New Point(10, 380) Me.ucrBase.Location = New Point(10, 408) Me.ucrChkLegend.Location = New Point(11, 349) @@ -628,6 +628,7 @@ Public Class dlgHistogram Me.ucrSaveHist.Location = New Point(10, 330) Me.ucrChkBinWidth.Location = New Point(10, 262) Me.ucrChkLegend.Location = New Point(11, 296) + Me.ucrNudBinwidth.Location = New Point(139, 262) Me.ucrInputStation.Location = New Point(318, 294) Me.ucrInputLegendPosition.Location = New Point(87, 294) Me.ucr1stFactorReceiver.Location = New Point(205, 296) From 876a580a5012ca5ef4897cc9fb8224919410b07b Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Tue, 5 Mar 2024 16:47:21 +0100 Subject: [PATCH 16/88] Adding the loops function to the transform dialog --- instat/dlgTransform.Designer.vb | 55 ++++++++++++++++++++++++++++++++- instat/dlgTransform.vb | 52 ++++++++++++++++++++++++++++--- 2 files changed, 102 insertions(+), 5 deletions(-) diff --git a/instat/dlgTransform.Designer.vb b/instat/dlgTransform.Designer.vb index c3df268c5ff..b0115e8bf16 100644 --- a/instat/dlgTransform.Designer.vb +++ b/instat/dlgTransform.Designer.vb @@ -108,6 +108,10 @@ Partial Class dlgTransform Me.ucrSelectorForRank = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrChkMissingLast = New instat.ucrCheck() Me.ucrChkDecreasing = New instat.ucrCheck() + Me.ucrPnlColumnSelectOptions = New instat.UcrPanel() + Me.rdoSingle = New System.Windows.Forms.RadioButton() + Me.rdoMultiple = New System.Windows.Forms.RadioButton() + Me.ucrNewColName = New instat.ucrSave() Me.grpTies.SuspendLayout() Me.grpMissingValues.SuspendLayout() Me.grpNumericOptions.SuspendLayout() @@ -894,7 +898,7 @@ Partial Class dlgTransform Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrBase.Location = New System.Drawing.Point(10, 392) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 16 ' 'ucrSelectorForRank @@ -927,12 +931,57 @@ Partial Class dlgTransform Me.ucrChkDecreasing.Size = New System.Drawing.Size(100, 23) Me.ucrChkDecreasing.TabIndex = 12 ' + 'ucrPnlColumnSelectOptions + ' + Me.ucrPnlColumnSelectOptions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlColumnSelectOptions.Location = New System.Drawing.Point(237, 52) + Me.ucrPnlColumnSelectOptions.Name = "ucrPnlColumnSelectOptions" + Me.ucrPnlColumnSelectOptions.Size = New System.Drawing.Size(185, 29) + Me.ucrPnlColumnSelectOptions.TabIndex = 37 + ' + 'rdoSingle + ' + Me.rdoSingle.AutoSize = True + Me.rdoSingle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoSingle.Location = New System.Drawing.Point(255, 59) + Me.rdoSingle.Name = "rdoSingle" + Me.rdoSingle.Size = New System.Drawing.Size(54, 17) + Me.rdoSingle.TabIndex = 37 + Me.rdoSingle.TabStop = True + Me.rdoSingle.Text = "Single" + Me.rdoSingle.UseVisualStyleBackColor = True + ' + 'rdoMultiple + ' + Me.rdoMultiple.AutoSize = True + Me.rdoMultiple.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoMultiple.Location = New System.Drawing.Point(321, 60) + Me.rdoMultiple.Name = "rdoMultiple" + Me.rdoMultiple.Size = New System.Drawing.Size(61, 17) + Me.rdoMultiple.TabIndex = 68 + Me.rdoMultiple.TabStop = True + Me.rdoMultiple.Text = "Multiple" + Me.rdoMultiple.UseVisualStyleBackColor = True + ' + 'ucrNewColName + ' + Me.ucrNewColName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrNewColName.Location = New System.Drawing.Point(10, 368) + Me.ucrNewColName.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrNewColName.Name = "ucrNewColName" + Me.ucrNewColName.Size = New System.Drawing.Size(331, 22) + Me.ucrNewColName.TabIndex = 69 + ' 'dlgTransform ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(440, 445) + Me.Controls.Add(Me.ucrNewColName) + Me.Controls.Add(Me.rdoMultiple) + Me.Controls.Add(Me.rdoSingle) + Me.Controls.Add(Me.ucrPnlColumnSelectOptions) Me.Controls.Add(Me.grpNumericOptions) Me.Controls.Add(Me.grpNonNegative) Me.Controls.Add(Me.grpTies) @@ -1050,4 +1099,8 @@ Partial Class dlgTransform Friend WithEvents ucrInputLogicOperations As ucrInputComboBox Friend WithEvents rdoLogical As RadioButton Friend WithEvents ucrPnlNumericOptions As UcrPanel + Friend WithEvents rdoMultiple As RadioButton + Friend WithEvents rdoSingle As RadioButton + Friend WithEvents ucrPnlColumnSelectOptions As UcrPanel + Friend WithEvents ucrNewColName As ucrSave End Class diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index e81ca5dccb9..84cba455a22 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -49,6 +49,7 @@ Public Class dlgTransform Private clsConstantDummyFunction As New RFunction Private clsNumericDummyFunction As New RFunction Private clsNonNegativeDummyFunction As New RFunction + Private clsGetColSelectionNamesFunction As New RFunction Private clsPreviewTextFunction As New RCodeStructure Private clsBooleanOperator As New ROperator Private clsIsNAFunction As New RFunction @@ -77,17 +78,22 @@ Public Class dlgTransform Dim dctAddValues As New Dictionary(Of String, String) Dim dctPowerValues As New Dictionary(Of String, String) + ucrPnlTransformOptions.AddRadioButton(rdoRank) ucrPnlTransformOptions.AddRadioButton(rdoNumeric) ucrPnlTransformOptions.AddRadioButton(rdoSort) ucrPnlTransformOptions.AddRadioButton(rdoNonNegative) ucrPnlTransformOptions.AddRadioButton(rdoScale) + ucrPnlColumnSelectOptions.AddRadioButton(rdoSingle) + ucrPnlColumnSelectOptions.AddRadioButton(rdoMultiple) ucrPnlTransformOptions.AddParameterValuesCondition(rdoRank, "check", "rank") ucrPnlTransformOptions.AddParameterValuesCondition(rdoNumeric, "check", "numeric") ucrPnlTransformOptions.AddParameterValuesCondition(rdoSort, "check", "sort") ucrPnlTransformOptions.AddParameterValuesCondition(rdoNonNegative, "check", "non-negative") ucrPnlTransformOptions.AddParameterValuesCondition(rdoScale, "check", "scale") + ucrPnlColumnSelectOptions.AddParameterValuesCondition(rdoSingle, "check", "single") + ucrPnlColumnSelectOptions.AddParameterValuesCondition(rdoMultiple, "check", "multiple") ucrReceiverRank.SetParameter(New RParameter("x", 0)) ucrReceiverRank.Selector = ucrSelectorForRank @@ -147,6 +153,7 @@ Public Class dlgTransform ucrPnlNonNegative.AddParameterValuesCondition(rdoNaturalLog, "check", "log") ucrPnlNonNegative.AddParameterValuesCondition(rdoPower, "check", "power") + ucrPnlColumnSelectOptions.AddToLinkedControls(ucrNewColName, {rdoMultiple}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudSignifDigits, {rdoSignificantDigits}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudRoundOfDigits, {rdoRoundOf}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudLagLeadPosition, {rdoLead}, bNewLinkedHideIfParameterMissing:=True) @@ -289,6 +296,12 @@ Public Class dlgTransform ucrChkPreview.AddParameterValuesCondition(True, "preview", "FALSE") ucrChkPreview.AddParameterValuesCondition(False, "preview", "TRUE") + 'ucrNewColName + ucrNewColName.SetIsComboBox() + ucrNewColName.SetSaveTypeAsColumn() + ucrNewColName.SetDataFrameSelector(ucrSelectorForRank.ucrAvailableDataFrames) + ucrNewColName.SetLabelText("New Column:") + ucrNewColName.setLinkedReceiver(ucrReceiverRank) ucrChkOmitNA.SetText("Omit NA") ucrChkOmitNA.SetParameter(New RParameter("na.rm", 1)) @@ -333,11 +346,17 @@ Public Class dlgTransform clsBooleanOperator = New ROperator clsIsNAFunction = New RFunction clsRemoveLabelsFunction = New RFunction + clsGetColSelectionNamesFunction = New RFunction + ucrSelectorForRank.Reset() ucrReceiverRank.SetMeAsReceiver() ucrSaveNew.Reset() + ucrNewColName.Reset() ucrInputLogicOperations.SetText("==") + rdoSingle.Checked = True + ucrNewColName.Visible = False + rdoMultiple.Checked = ucrNewColName.Visible clsConstantDummyFunction.AddParameter("checked", "FALSE", iPosition:=0) clsConstantDummyFunction.AddParameter("preview", "TRUE", iPosition:=1) @@ -350,6 +369,8 @@ Public Class dlgTransform clsSortFunction.AddParameter("decreasing", "TRUE", iPosition:=1) clsSortFunction.AddParameter("na.last", "TRUE", iPosition:=2) + clsGetColSelectionNamesFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_column_selected_column_names") + clsRoundFunction.SetRCommand("round") clsSignifFunction.SetRCommand("signif") @@ -439,6 +460,7 @@ Public Class dlgTransform Private Sub SetRCodeForControls(bReset As Boolean) bResetRCode = False + ucrReceiverRank.AddAdditionalCodeParameterPair(clsSortFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=1) ucrReceiverRank.AddAdditionalCodeParameterPair(clsRoundFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=2) ucrReceiverRank.AddAdditionalCodeParameterPair(clsSignifFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=3) @@ -455,7 +477,9 @@ Public Class dlgTransform ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleMinFunction, New RParameter("x", 0), iAdditionalPairNo:=13) ucrReceiverRank.AddAdditionalCodeParameterPair(clsBooleanOperator, New RParameter("x", 0), iAdditionalPairNo:=14) ucrReceiverRank.AddAdditionalCodeParameterPair(clsIsNAFunction, New RParameter("x", 0), iAdditionalPairNo:=15) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsGetColSelectionNamesFunction, New RParameter("x", 0), iAdditionalPairNo:=16) ucrChkOmitNA.AddAdditionalCodeParameterPair(clsStandardDevFunction, ucrChkOmitNA.GetParameter(), iAdditionalPairNo:=1) + ucrSelectorForRank.AddAdditionalCodeParameterPair(clsGetColSelectionNamesFunction, ucrSelectorForRank.GetParameter, iAdditionalPairNo:=1) ucrSaveNew.AddAdditionalRCode(clsLeadFunction, iAdditionalPairNo:=1) ucrSaveNew.AddAdditionalRCode(clsLagFunction, iAdditionalPairNo:=2) @@ -496,6 +520,8 @@ Public Class dlgTransform ucrPnlNonNegative.SetRCode(clsNonNegativeDummyFunction, bReset) ucrChkOmitNA.SetRCode(clsMeanFunction, bReset) ucrChkPreview.SetRCode(clsConstantDummyFunction, bReset) + + bResetRCode = True End Sub @@ -512,8 +538,14 @@ Public Class dlgTransform End Sub Private Sub NewDefaultName() - If (Not ucrSaveNew.bUserTyped) AndAlso Not ucrReceiverRank.IsEmpty Then - ucrSaveNew.SetPrefix(ucrReceiverRank.GetVariableNames(bWithQuotes:=False)) + If rdoSingle.Checked Then + If (Not ucrSaveNew.bUserTyped) AndAlso Not ucrReceiverRank.IsEmpty Then + ucrSaveNew.SetPrefix(ucrReceiverRank.GetVariableNames(bWithQuotes:=False)) + End If + ElseIf rdoMultiple.Checked Then + If (Not ucrNewColName.bUserTyped) AndAlso Not ucrReceiverRank.IsEmpty Then + ucrNewColName.SetName(ucrReceiverRank.GetVariableNames(bWithQuotes:=False) & "_transformed") + End If End If End Sub @@ -524,13 +556,25 @@ Public Class dlgTransform ucrChkEditPreview.Checked = False End Sub - Private Sub ucrPnlTransformOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlTransformOptions.ControlValueChanged, ucrPnlNumericOptions.ControlValueChanged, ucrInputLogicalValues.ControlValueChanged, + Private Sub ucrPnlTransformOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlTransformOptions.ControlValueChanged, ucrPnlNumericOptions.ControlValueChanged, ucrPnlColumnSelectOptions.ControlValueChanged, ucrInputLogicalValues.ControlValueChanged, ucrPnlNonNegative.ControlValueChanged, ucrPnlMissingValues.ControlValueChanged, ucrPnlTies.ControlValueChanged, ucrChkPreview.ControlValueChanged, ucrReceiverRank.ControlValueChanged, ucrNudDiffLag.ControlValueChanged, ucrNudLagLeadPosition.ControlValueChanged, ucrNudLagPosition.ControlValueChanged, ucrNudRoundOfDigits.ControlValueChanged, ucrNudSignifDigits.ControlValueChanged, ucrInputPower.ControlValueChanged, ucrInputMultiply.ControlValueChanged, ucrInputDivide.ControlValueChanged, ucrInputConstant.ControlValueChanged, ucrInputAdd.ControlValueChanged, ucrChkOmitNA.ControlValueChanged, ucrInputLogicOperations.ControlValueChanged, ucrChkAddConstant.ControlValueChanged, ucrChkMissingLast.ControlValueChanged, ucrChkDecreasing.ControlValueChanged, ucrChkDivide.ControlValueChanged, ucrChkAdd.ControlValueChanged, ucrChkMultiply.ControlValueChanged, ucrChkSubtract.ControlValueChanged If bResetRCode Then ucrBase.clsRsyntax.ClearCodes() + If rdoMultiple.Checked Then + clsDummyTransformFunction.AddParameter("check", "select", iPosition:=0) + ucrSelectorForRank.SetItemType("column_selection") + ucrReceiverRank.strSelectorHeading = "Column selections" + ElseIf rdoSingle.Checked Then + clsDummyTransformFunction.AddParameter("check", "variable", iPosition:=0) + ucrReceiverRank.bUseFilteredData = False + ucrReceiverRank.SetParameterIsRFunction() + ucrSelectorForRank.SetItemType("column") + ucrReceiverRank.strSelectorHeading = "Numerics" + + End If If rdoRank.Checked Then clsPreviewTextFunction = clsRankFunction.Clone clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) @@ -722,7 +766,7 @@ Public Class dlgTransform End Sub Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverRank.ControlContentsChanged, ucrSaveNew.ControlContentsChanged, - ucrPnlTransformOptions.ControlContentsChanged, ucrPnlNumericOptions.ControlContentsChanged, ucrPnlNonNegative.ControlContentsChanged, ucrChkDivide.ControlContentsChanged, + ucrPnlTransformOptions.ControlContentsChanged, ucrPnlNumericOptions.ControlContentsChanged, ucrPnlColumnSelectOptions.ControlContentsChanged, ucrPnlNonNegative.ControlContentsChanged, ucrChkDivide.ControlContentsChanged, ucrChkMultiply.ControlContentsChanged, ucrChkSubtract.ControlContentsChanged, ucrChkAdd.ControlContentsChanged, ucrChkPreview.ControlContentsChanged, ucrChkAddConstant.ControlContentsChanged, ucrInputPower.ControlContentsChanged, ucrInputPreview.ControlContentsChanged, ucrInputLogicalValues.ControlContentsChanged, ucrInputLogicOperations.ControlContentsChanged TestOKEnabled() From c6977bd5b8ef5011d6c4adea3bd813b11fe5d6e0 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Wed, 6 Mar 2024 09:13:06 +0100 Subject: [PATCH 17/88] Changing the label names to alternate between column and select --- instat/dlgTransform.vb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 84cba455a22..f85ba0a4c6d 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -567,12 +567,14 @@ Public Class dlgTransform clsDummyTransformFunction.AddParameter("check", "select", iPosition:=0) ucrSelectorForRank.SetItemType("column_selection") ucrReceiverRank.strSelectorHeading = "Column selections" + lblSelectColumns.Text = "Select:" ElseIf rdoSingle.Checked Then clsDummyTransformFunction.AddParameter("check", "variable", iPosition:=0) ucrReceiverRank.bUseFilteredData = False ucrReceiverRank.SetParameterIsRFunction() ucrSelectorForRank.SetItemType("column") ucrReceiverRank.strSelectorHeading = "Numerics" + lblSelectColumns.Text = "Column:" End If If rdoRank.Checked Then From 8e0c5889f9028769e19daed1e9c222ecc8616cb9 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Thu, 7 Mar 2024 14:24:40 +0100 Subject: [PATCH 18/88] More additional changes --- instat/dlgHistogram.vb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index ceffb5cb7ed..20f718dfdeb 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -329,13 +329,12 @@ Public Class dlgHistogram ucrInputLegendPosition.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True) ucrNudBinwidth.SetRCode(clsRgeomPlotFunction, bReset) ucrNudMinHeight.SetRCode(clsRgeomPlotFunction, bReset) - ucrChkMinHeight.SetRCode(clsRgeomPlotFunction, bReset) - ucrChkBinWidth.SetRCode(clsRgeomPlotFunction, bReset) ucrChkOmitYAxis.SetRCode(clsBaseOperator, bReset) If bReset Then ucrInputStats.SetRCode(clsHistAesFunction, bReset) ucrFactorReceiver.SetRCode(clsRaesFunction, bReset) - + ucrChkMinHeight.SetRCode(clsRgeomPlotFunction, bReset) + ucrChkBinWidth.SetRCode(clsRgeomPlotFunction, bReset) End If End Sub @@ -394,6 +393,7 @@ Public Class dlgHistogram End If End If clsBaseOperator.RemoveParameterByName("scale") + clsHistAesFunction.RemoveParameterByName("fill") ucrFactorReceiver.ChangeParameterName("fill") If Not ucrSaveHist.bUserTyped Then ucrSaveHist.SetPrefix("histogram") End If @@ -403,10 +403,11 @@ Public Class dlgHistogram clsRgeomPlotFunction.RemoveParameterByName("binwidth") clsBaseOperator.RemoveParameterByName("scale") If ucrChkRidges.Checked Then - ucrFactorReceiver.ChangeParameterName("y") + ucrFactorReceiver.ChangeParameterName("fill") clsHistAesFunction.RemoveParameterByName("y") clsHistAesFunction.AddParameter("x", clsRFunctionParameter:=ucrVariablesAsFactorforHist.GetVariables(), iPosition:=1) clsHistAesFunction.AddParameter("y", clsRFunctionParameter:=ucrFactorReceiver.GetVariables(), iPosition:=2) + clsHistAesFunction.AddParameter("fill", clsRFunctionParameter:=ucrFactorReceiver.GetVariables(), iPosition:=3) clsRgeomPlotFunction.SetPackageName("ggridges") clsRgeomPlotFunction.SetRCommand("geom_density_ridges") clsRgeomPlotFunction.RemoveParameterByName("mapping") @@ -415,6 +416,7 @@ Public Class dlgHistogram End If Else ucrFactorReceiver.ChangeParameterName("colour") + clsHistAesFunction.RemoveParameterByName("fill") clsRgeomPlotFunction.SetRCommand("geom_density") clsRgeomPlotFunction.AddParameter("mapping", clsRFunctionParameter:=clsHistAesFunction) If Not ucrSaveHist.bUserTyped Then @@ -757,8 +759,8 @@ Public Class dlgHistogram End Sub Private Sub ucrChkMinHeight_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkMinHeight.ControlValueChanged, ucrNudMinHeight.ControlValueChanged - If ucrChkRidges.Checked AndAlso ucrChkMinHeight.Checked Then - If Not ucrNudMinHeight.IsEmpty Then + If ucrChkRidges.Checked Then + If ucrChkMinHeight.Checked Then clsRgeomPlotFunction.AddParameter("rel_min_height", ucrNudMinHeight.GetText, iPosition:=4) Else clsRgeomPlotFunction.RemoveParameterByName("rel_min_height") @@ -767,12 +769,10 @@ Public Class dlgHistogram End Sub Private Sub ucrChkBinWidth_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkBinWidth.ControlValueChanged, ucrNudBinwidth.ControlValueChanged - If ucrChkDisplayAsDotPlot.Checked OrElse ucrChkBinWidth.Checked Then - If Not ucrNudBinwidth.IsEmpty Then - clsRgeomPlotFunction.AddParameter("binwidth", ucrNudBinwidth.GetText, iPosition:=4) - Else - clsRgeomPlotFunction.RemoveParameterByName("binwidth") - End If + If ucrChkBinWidth.Checked Then + clsRgeomPlotFunction.AddParameter("binwidth", ucrNudBinwidth.GetText, iPosition:=4) + Else + clsRgeomPlotFunction.RemoveParameterByName("binwidth") End If End Sub From 0fe69456d81f9786e954ec41d8cb9c8cf67b0599 Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Thu, 14 Mar 2024 17:38:41 +0300 Subject: [PATCH 19/88] changes made --- instat/dlgTransform.vb | 375 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 351 insertions(+), 24 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index f85ba0a4c6d..6fc220edba9 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -20,30 +20,69 @@ Public Class dlgTransform Public bFirstLoad As Boolean = True Private bReset As Boolean = True Private clsRankFunction As New RFunction + Private clsRankColsFunction As New RFunction + Private clsSortFunction As New RFunction + Private clsSortColsFunction As New RFunction + Private clsRoundFunction As New RFunction + Private clsRoundColsFunction As New RFunction + Private clsSignifFunction As New RFunction + Private clsSignifColsFunction As New RFunction + Private clsLagFunction As New RFunction + Private clsLagColsFunction As New RFunction + Private clsLeadFunction As New RFunction + Private clsLeadColsFunction As New RFunction + Private clsDiffFunction As New RFunction + Private clsDiffColsFunction As New RFunction + Private clsConcDiffFunction As New RFunction + Private clsConcDiffColsFunction As New RFunction + Private clsReplicateFunction As New RFunction + Private clsReplicateColsFunction As New RFunction + Private clsMeanFunction As New RFunction + Private clsMeanColsFunction As New RFunction + Private clsStandardDevFunction As New RFunction + Private clsStandardDevColsFunction As New RFunction + Private clsSubtractOperator As New ROperator Private clsDivisionOperator As New ROperator + Private clsDivisionColsOperator As New ROperator + Private clsSquarerootFunction As New RFunction + Private clsSquarerootColsFunction As New RFunction + Private clsAddConstantOperator As New ROperator Private clsNaturalLogFunction As New RFunction + Private clsNaturalLogColsFunction As New RFunction + Private clsLogBase10Function As New RFunction + Private clsLogBase10ColsFunction As New RFunction + Private clsRemoveLabelsFunction As New RFunction Private clsPowerOperator As New ROperator + Private clsPowerColsOperator As New ROperator + Private clsScaleSubtractOperator As New ROperator Private clsScaleMultiplyOperator As New ROperator Private clsScaleDivideOperator As New ROperator + Private clsScaleAddOperator As New ROperator + Private clsScaleAddColsOperator As New ROperator + Private clsScaleMeanFunction As New RFunction + Private clsScaleMeanColsFunction As New RFunction + Private clsScaleMinFunction As New RFunction + Private clsScaleMinColsFunction As New RFunction + Private clsPreviewOperator As New ROperator Private clsDummyTransformFunction As New RFunction Private clsConstantDummyFunction As New RFunction @@ -52,7 +91,18 @@ Public Class dlgTransform Private clsGetColSelectionNamesFunction As New RFunction Private clsPreviewTextFunction As New RCodeStructure Private clsBooleanOperator As New ROperator + Private clsBooleanColsOperator As New ROperator + Private clsAddColumnsFunction As New RFunction Private clsIsNAFunction As New RFunction + Private clsGetDataFrameFunction As New RFunction + Private clsColumnsFunction As New RFunction + Private clsPasteFunction As New RFunction + Private clsMutateFunction As New RFunction + Private clsAcrossFunction As New RFunction + Private clsEverythingFunction As New RFunction + Private clsPipeOperator As New ROperator + Private clsTildaOperator As New ROperator + Private clsAssignOperator As New ROperator Private bResetRCode As Boolean = True Private Sub dlgRank_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -84,6 +134,7 @@ Public Class dlgTransform ucrPnlTransformOptions.AddRadioButton(rdoSort) ucrPnlTransformOptions.AddRadioButton(rdoNonNegative) ucrPnlTransformOptions.AddRadioButton(rdoScale) + ucrPnlColumnSelectOptions.AddRadioButton(rdoSingle) ucrPnlColumnSelectOptions.AddRadioButton(rdoMultiple) @@ -92,8 +143,9 @@ Public Class dlgTransform ucrPnlTransformOptions.AddParameterValuesCondition(rdoSort, "check", "sort") ucrPnlTransformOptions.AddParameterValuesCondition(rdoNonNegative, "check", "non-negative") ucrPnlTransformOptions.AddParameterValuesCondition(rdoScale, "check", "scale") - ucrPnlColumnSelectOptions.AddParameterValuesCondition(rdoSingle, "check", "single") - ucrPnlColumnSelectOptions.AddParameterValuesCondition(rdoMultiple, "check", "multiple") + + ucrPnlColumnSelectOptions.AddParameterValuesCondition(rdoSingle, "checked", "single") + ucrPnlColumnSelectOptions.AddParameterValuesCondition(rdoMultiple, "checked", "multiple") ucrReceiverRank.SetParameter(New RParameter("x", 0)) ucrReceiverRank.Selector = ucrSelectorForRank @@ -153,7 +205,7 @@ Public Class dlgTransform ucrPnlNonNegative.AddParameterValuesCondition(rdoNaturalLog, "check", "log") ucrPnlNonNegative.AddParameterValuesCondition(rdoPower, "check", "power") - ucrPnlColumnSelectOptions.AddToLinkedControls(ucrNewColName, {rdoMultiple}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + 'ucrPnlColumnSelectOptions.AddToLinkedControls(ucrNewColName, {rdoMultiple}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudSignifDigits, {rdoSignificantDigits}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudRoundOfDigits, {rdoRoundOf}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudLagLeadPosition, {rdoLead}, bNewLinkedHideIfParameterMissing:=True) @@ -347,7 +399,27 @@ Public Class dlgTransform clsIsNAFunction = New RFunction clsRemoveLabelsFunction = New RFunction clsGetColSelectionNamesFunction = New RFunction - + clsGetDataFrameFunction = New RFunction + clsMutateFunction = New RFunction + clsAcrossFunction = New RFunction + clsEverythingFunction = New RFunction + clsPipeOperator = New ROperator + clsTildaOperator = New ROperator + clsRoundColsFunction = New RFunction + clsRankColsFunction = New RFunction + clsSortColsFunction = New RFunction + clsSignifColsFunction = New RFunction + clsLagColsFunction = New RFunction + clsLeadColsFunction = New RFunction + clsLeadColsFunction = New RFunction + clsConcDiffColsFunction = New RFunction + clsReplicateColsFunction = New RFunction + clsStandardDevColsFunction = New RFunction + clsBooleanColsOperator = New ROperator + clsAddColumnsFunction = New RFunction + clsPasteFunction = New RFunction + clsColumnsFunction = New RFunction + clsAssignOperator = New ROperator ucrSelectorForRank.Reset() ucrReceiverRank.SetMeAsReceiver() @@ -446,16 +518,132 @@ Public Class dlgTransform clsBooleanOperator.SetOperation("==") clsIsNAFunction.SetRCommand("is.na") + clsRankColsFunction.SetRCommand("~rank") + clsRankColsFunction.AddParameter("na.last", Chr(34) & "keep" & Chr(34), iPosition:=2) + clsRankColsFunction.AddParameter("ties.method", Chr(34) & "average" & Chr(34), iPosition:=3) + + clsSortColsFunction.SetRCommand("~sort") + clsSortColsFunction.AddParameter("decreasing", "TRUE", iPosition:=1) + clsSortColsFunction.AddParameter("na.last", "TRUE", iPosition:=2) + + clsRoundColsFunction.SetRCommand("~round") + + clsSignifColsFunction.SetRCommand("~signif") + + clsLagColsFunction.SetPackageName("~dplyr") + clsLagColsFunction.SetRCommand("lag") + + clsLeadColsFunction.SetPackageName("~dplyr") + clsLeadColsFunction.SetRCommand("lead") + + clsDiffColsFunction.SetRCommand("~diff") + clsDiffColsFunction.AddParameter("lag", "1", iPosition:=1) + + clsReplicateColsFunction.SetRCommand("~rep") + clsReplicateColsFunction.AddParameter("x", "NA", iPosition:=0) + + 'clsConcDiffFunction.SetRCommand("c") + 'clsConcDiffFunction.AddParameter("y", clsRFunctionParameter:=clsReplicateFunction, iPosition:=0, bIncludeArgumentName:=False) + 'clsConcDiffFunction.AddParameter("x", clsRFunctionParameter:=clsDiffFunction, iPosition:=1, bIncludeArgumentName:=False) + + clsMeanColsFunction.SetRCommand("~mean") + clsMeanColsFunction.AddParameter("na.rm", "TRUE", iPosition:=1) + + clsStandardDevColsFunction.SetRCommand("~sd") + clsStandardDevColsFunction.AddParameter("na.rm", "TRUE", iPosition:=1) + + clsSubtractOperator.SetOperation("-") + clsSubtractOperator.AddParameter("y", clsRFunctionParameter:=clsMeanFunction, iPosition:=1) + + clsDivisionOperator.SetOperation("/") + clsDivisionOperator.AddParameter("x", clsROperatorParameter:=clsSubtractOperator, iPosition:=0) + clsDivisionOperator.AddParameter("y", clsRFunctionParameter:=clsStandardDevFunction, iPosition:=1) + + clsSquarerootFunction.SetRCommand("sqrt") + + clsAddConstantOperator.SetOperation("+") + clsAddConstantOperator.AddParameter("c", "0", iPosition:=1) + + clsNaturalLogFunction.SetRCommand("log") + + clsLogBase10Function.SetRCommand("log10") + + clsPowerColsOperator.SetOperation("^") + clsPowerColsOperator.AddParameter("y", "1", iPosition:=1) + clsPowerColsOperator.bSpaceAroundOperation = False + + clsScaleMeanColsFunction.SetRCommand("~mean") + clsScaleMeanColsFunction.AddParameter("na.rm", "TRUE", iPosition:=1) + + clsScaleMinColsFunction.SetRCommand("~min") + clsScaleMinColsFunction.AddParameter("na.rm", "TRUE", iPosition:=1) + + clsScaleSubtractOperator.SetOperation("-") + clsScaleSubtractOperator.AddParameter("u", "0", iPosition:=1) + + clsScaleMultiplyOperator.SetOperation("*") + clsScaleMultiplyOperator.AddParameter("x", clsROperatorParameter:=clsScaleSubtractOperator, iPosition:=0) + clsScaleMultiplyOperator.AddParameter("y", "1", iPosition:=1) + + clsScaleDivideOperator.SetOperation("/") + clsScaleDivideOperator.AddParameter("x", clsROperatorParameter:=clsScaleMultiplyOperator, iPosition:=0) + clsScaleDivideOperator.AddParameter("z", "1", iPosition:=1) + clsScaleDivideOperator.bBrackets = False + + clsScaleAddColsOperator.SetOperation("+") + clsScaleAddColsOperator.AddParameter("x", clsROperatorParameter:=clsScaleDivideOperator, iPosition:=0) + clsScaleAddColsOperator.AddParameter("v", "0", iPosition:=1) + clsScaleAddColsOperator.bBrackets = False + + clsBooleanColsOperator.SetOperation("==") + + + clsGetDataFrameFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_data_frame") + + clsMutateFunction.SetPackageName("dplyr") + clsMutateFunction.SetRCommand("mutate") + + clsEverythingFunction.SetRCommand("everything") + clsEverythingFunction.AddParameter("dot", ".", bIncludeArgumentName:=False, iPosition:=0) + + clsAcrossFunction.SetPackageName("dplyr") + clsAcrossFunction.SetRCommand("across") + clsAcrossFunction.AddParameter("every", clsRFunctionParameter:=clsEverythingFunction, bIncludeArgumentName:=False, iPosition:=0) + + clsTildaOperator.SetOperation("~") + + clsPipeOperator.SetOperation("%>%") + clsPipeOperator.AddParameter("left", clsRFunctionParameter:=clsGetDataFrameFunction, iPosition:=0) + clsPipeOperator.AddParameter("right", clsRFunctionParameter:=clsMutateFunction, iPosition:=1) + clsPipeOperator.SetAssignTo("col") + clsRemoveLabelsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$append_to_variables_metadata") clsRemoveLabelsFunction.AddParameter("property", Chr(34) & "labels" & Chr(34), iPosition:=2) clsRemoveLabelsFunction.AddParameter("new_val", Chr(34) & Chr(34), iPosition:=3) clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) + clsDummyTransformFunction.AddParameter("checked", "single", iPosition:=1) clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsRoundFunction) + clsColumnsFunction.SetRCommand("colnames") + clsColumnsFunction.AddParameter("col_data", "col",, bIncludeArgumentName:=False) + + clsPasteFunction.SetRCommand("paste0") + clsPasteFunction.AddParameter("data", clsRFunctionParameter:=clsColumnsFunction, iPosition:=0, bIncludeArgumentName:=False) + + clsAssignOperator.SetOperation("<-") + clsAssignOperator.AddParameter("left", clsRFunctionParameter:=clsColumnsFunction, iPosition:=0) + clsAssignOperator.AddParameter("right", clsRFunctionParameter:=clsPasteFunction, iPosition:=1) + + + clsAddColumnsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") + clsAddColumnsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRank.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsAddColumnsFunction.AddParameter("before", "FALSE", iPosition:=2) + + + 'ucrBase.clsRsyntax.SetBaseRFunction(clsRoundFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) @@ -480,6 +668,7 @@ Public Class dlgTransform ucrReceiverRank.AddAdditionalCodeParameterPair(clsGetColSelectionNamesFunction, New RParameter("x", 0), iAdditionalPairNo:=16) ucrChkOmitNA.AddAdditionalCodeParameterPair(clsStandardDevFunction, ucrChkOmitNA.GetParameter(), iAdditionalPairNo:=1) ucrSelectorForRank.AddAdditionalCodeParameterPair(clsGetColSelectionNamesFunction, ucrSelectorForRank.GetParameter, iAdditionalPairNo:=1) + ucrNudRoundOfDigits.AddAdditionalCodeParameterPair(clsRoundColsFunction, New RParameter("digits", 1), iAdditionalPairNo:=1) ucrSaveNew.AddAdditionalRCode(clsLeadFunction, iAdditionalPairNo:=1) ucrSaveNew.AddAdditionalRCode(clsLagFunction, iAdditionalPairNo:=2) @@ -496,8 +685,10 @@ Public Class dlgTransform ucrSaveNew.AddAdditionalRCode(clsPreviewOperator, iAdditionalPairNo:=13) ucrSaveNew.AddAdditionalRCode(clsBooleanOperator, iAdditionalPairNo:=14) ucrSaveNew.AddAdditionalRCode(clsIsNAFunction, iAdditionalPairNo:=15) + 'ucrSaveNew.AddAdditionalRCode(clsPipeOperator, iAdditionalPairNo:=16) ucrPnlTransformOptions.SetRCode(clsDummyTransformFunction, bReset) + ucrPnlColumnSelectOptions.SetRCode(clsDummyTransformFunction, bReset) ucrReceiverRank.SetRCode(clsRankFunction, bReset) ucrChkDecreasing.SetRCode(clsSortFunction, bReset) ucrChkMissingLast.SetRCode(clsSortFunction, bReset) @@ -538,13 +729,27 @@ Public Class dlgTransform End Sub Private Sub NewDefaultName() + Dim strColNames As String + If rdoNumeric.Checked Then + strColNames = "Numeric" + ElseIf rdoNonNegative.Checked Then + strColNames = "NonNumeric" + ElseIf rdoRank.Checked Then + strColNames = "Rank" + ElseIf rdoScale.Checked Then + strColNames = "sort" + ElseIf rdoScale.Checked Then + strColNames = "scale" + End If If rdoSingle.Checked Then If (Not ucrSaveNew.bUserTyped) AndAlso Not ucrReceiverRank.IsEmpty Then ucrSaveNew.SetPrefix(ucrReceiverRank.GetVariableNames(bWithQuotes:=False)) End If ElseIf rdoMultiple.Checked Then - If (Not ucrNewColName.bUserTyped) AndAlso Not ucrReceiverRank.IsEmpty Then - ucrNewColName.SetName(ucrReceiverRank.GetVariableNames(bWithQuotes:=False) & "_transformed") + If Not ucrReceiverRank.IsEmpty Then + clsPasteFunction.AddParameter("col_data", Chr(34) & "_" & strColNames & Chr(34), iPosition:=1, bIncludeArgumentName:=False) + + clsAddColumnsFunction.AddParameter("col_data", "col", iPosition:=1) End If End If End Sub @@ -556,27 +761,17 @@ Public Class dlgTransform ucrChkEditPreview.Checked = False End Sub - Private Sub ucrPnlTransformOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlTransformOptions.ControlValueChanged, ucrPnlNumericOptions.ControlValueChanged, ucrPnlColumnSelectOptions.ControlValueChanged, ucrInputLogicalValues.ControlValueChanged, + Private Sub ucrPnlTransformOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlTransformOptions.ControlValueChanged, ucrPnlNumericOptions.ControlValueChanged, ucrInputLogicalValues.ControlValueChanged, ucrPnlNonNegative.ControlValueChanged, ucrPnlMissingValues.ControlValueChanged, ucrPnlTies.ControlValueChanged, ucrChkPreview.ControlValueChanged, ucrReceiverRank.ControlValueChanged, ucrNudDiffLag.ControlValueChanged, ucrNudLagLeadPosition.ControlValueChanged, - ucrNudLagPosition.ControlValueChanged, ucrNudRoundOfDigits.ControlValueChanged, ucrNudSignifDigits.ControlValueChanged, ucrInputPower.ControlValueChanged, ucrInputMultiply.ControlValueChanged, + ucrNudLagPosition.ControlValueChanged, ucrNudRoundOfDigits.ControlValueChanged, ucrNudSignifDigits.ControlValueChanged, ucrInputPower.ControlValueChanged, ucrInputMultiply.ControlValueChanged, ucrPnlColumnSelectOptions.ControlValueChanged, ucrInputDivide.ControlValueChanged, ucrInputConstant.ControlValueChanged, ucrInputAdd.ControlValueChanged, ucrChkOmitNA.ControlValueChanged, ucrInputLogicOperations.ControlValueChanged, ucrChkAddConstant.ControlValueChanged, ucrChkMissingLast.ControlValueChanged, ucrChkDecreasing.ControlValueChanged, ucrChkDivide.ControlValueChanged, ucrChkAdd.ControlValueChanged, ucrChkMultiply.ControlValueChanged, ucrChkSubtract.ControlValueChanged - If bResetRCode Then - ucrBase.clsRsyntax.ClearCodes() - If rdoMultiple.Checked Then - clsDummyTransformFunction.AddParameter("check", "select", iPosition:=0) - ucrSelectorForRank.SetItemType("column_selection") - ucrReceiverRank.strSelectorHeading = "Column selections" - lblSelectColumns.Text = "Select:" - ElseIf rdoSingle.Checked Then - clsDummyTransformFunction.AddParameter("check", "variable", iPosition:=0) - ucrReceiverRank.bUseFilteredData = False - ucrReceiverRank.SetParameterIsRFunction() - ucrSelectorForRank.SetItemType("column") - ucrReceiverRank.strSelectorHeading = "Numerics" - lblSelectColumns.Text = "Column:" - End If + ucrBase.clsRsyntax.ClearCodes() + + If rdoSingle.Checked Then + + ' If bResetRCode Then If rdoRank.Checked Then clsPreviewTextFunction = clsRankFunction.Clone clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) @@ -670,13 +865,135 @@ Public Class dlgTransform ucrBase.clsRsyntax.SetBaseROperator(clsScaleAddOperator) ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) End If + 'End If + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAssignOperator) + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddColumnsFunction) + + clsDummyTransformFunction.AddParameter("checked", "single", iPosition:=1) + ucrReceiverRank.bUseFilteredData = False + ucrReceiverRank.SetParameterIsRFunction() + ucrSelectorForRank.SetItemType("column") + ucrReceiverRank.strSelectorHeading = "Numerics" + lblSelectColumns.Text = "Column:" + Else + LoopsParameters() + ucrBase.clsRsyntax.ClearCodes() + + ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) + ucrBase.clsRsyntax.AddToAfterCodes(clsAssignOperator, 0) + ucrBase.clsRsyntax.AddToAfterCodes(clsAddColumnsFunction, 1) + + clsDummyTransformFunction.AddParameter("checked", "multiple", iPosition:=1) + ucrSelectorForRank.SetItemType("column_selection") + ucrReceiverRank.strSelectorHeading = "Column selections" + lblSelectColumns.Text = "Select:" End If + SetPreviewText() UpdateNonNegativeParameters() NewDefaultName() ResetPreview() End Sub + Private Sub LoopsParameters() + 'ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) + If rdoRank.Checked Then + clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) + clsPreviewTextFunction = clsRankColsFunction.Clone + clsRankColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("right", clsRFunctionParameter:=clsRankColsFunction, iPosition:=1) + clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsRankColsFunction, bIncludeArgumentName:=False, iPosition:=1) + ElseIf rdoSort.Checked Then + clsDummyTransformFunction.AddParameter("check", "sort", iPosition:=0) + clsPreviewTextFunction = clsSortColsFunction.Clone + clsSortColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("left", clsRFunctionParameter:=clsSortColsFunction, iPosition:=0) + clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsSortColsFunction, bIncludeArgumentName:=False, iPosition:=1) + ElseIf rdoNumeric.Checked Then + clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) + If rdoRoundOf.Checked Then + clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) + + clsRoundColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("round", clsRFunctionParameter:=clsRoundColsFunction, iPosition:=1, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsRoundColsFunction, bIncludeArgumentName:=False) + ElseIf rdoSignificantDigits.Checked Then + clsNumericDummyFunction.AddParameter("check", "signif", iPosition:=0) + + clsSignifColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsSignifColsFunction, iPosition:=1, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsSignifColsFunction, bIncludeArgumentName:=False) + ElseIf rdoLag.Checked Then + clsNumericDummyFunction.AddParameter("check", "lag", iPosition:=0) + + clsLagColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsLagColsFunction, iPosition:=1, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsLagColsFunction, bIncludeArgumentName:=False) + ElseIf rdoLead.Checked Then + clsNumericDummyFunction.AddParameter("check", "lead", iPosition:=0) + + clsLeadColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsLeadColsFunction, iPosition:=1, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsLeadColsFunction, bIncludeArgumentName:=False) + ElseIf rdoDifference.Checked Then + clsNumericDummyFunction.AddParameter("check", "diff", iPosition:=0) + + clsConcDiffColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsConcDiffColsFunction, iPosition:=1, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsConcDiffColsFunction, bIncludeArgumentName:=False) + ElseIf rdoStandardize.Checked Then + clsNumericDummyFunction.AddParameter("check", "standardise", iPosition:=0) + + clsDivisionColsOperator.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("sig", clsROperatorParameter:=clsDivisionColsOperator, iPosition:=1, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsDivisionColsOperator, bIncludeArgumentName:=False) + ElseIf rdoLogical.Checked Then + clsNumericDummyFunction.AddParameter("check", "logical", iPosition:=0) + clsBooleanColsOperator.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("sig", clsROperatorParameter:=clsBooleanColsOperator, iPosition:=1, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsBooleanColsOperator, bIncludeArgumentName:=False) + End If + ElseIf rdoNonNegative.Checked Then + clsDummyTransformFunction.AddParameter("check", "non-negative", iPosition:=0) + If rdoSquareRoot.Checked Then + clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) + + clsSquarerootColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsSquarerootFunction, iPosition:=1, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsSquarerootColsFunction, bIncludeArgumentName:=False) + ElseIf rdoPower.Checked Then + clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) + + clsNonNegativeDummyFunction.AddParameter("check", "power", iPosition:=0) + + clsPowerColsOperator.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("sig", clsROperatorParameter:=clsPowerOperator, iPosition:=1, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsPowerColsOperator, bIncludeArgumentName:=False) + ElseIf rdoLogToBase10.Checked Then + clsNonNegativeDummyFunction.AddParameter("check", "log10", iPosition:=0) + + + clsLogBase10ColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsLogBase10Function, iPosition:=1, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsLogBase10ColsFunction, bIncludeArgumentName:=False) + ElseIf rdoNaturalLog.Checked Then + clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) + + clsNaturalLogColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsNaturalLogFunction, iPosition:=1, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsNaturalLogColsFunction, bIncludeArgumentName:=False) + End If + ElseIf rdoScale.Checked Then + clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) + + clsScaleAddColsOperator.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("sig", clsROperatorParameter:=clsScaleAddOperator, iPosition:=1, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsScaleAddColsOperator, bIncludeArgumentName:=False) + End If + + clsMutateFunction.AddParameter("var", clsRFunctionParameter:=clsAcrossFunction, bIncludeArgumentName:=False, iPosition:=0) + End Sub + Private Sub SetPreviewText() clsPreviewTextFunction.RemoveAssignTo() If Not ucrReceiverRank.IsEmpty Then @@ -773,4 +1090,14 @@ Public Class dlgTransform ucrChkAddConstant.ControlContentsChanged, ucrInputPower.ControlContentsChanged, ucrInputPreview.ControlContentsChanged, ucrInputLogicalValues.ControlContentsChanged, ucrInputLogicOperations.ControlContentsChanged TestOKEnabled() End Sub + + Private Sub ucrPnlColumnSelectOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlColumnSelectOptions.ControlValueChanged, ucrReceiverRank.ControlValueChanged, ucrSelectorForRank.ControlValueChanged + + clsGetDataFrameFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRank.strCurrentDataFrame & Chr(34), iPosition:=0, bIncludeArgumentName:=False) + clsGetDataFrameFunction.AddParameter("column_selection_name ", ucrReceiverRank.GetVariableNames, iPosition:=1) + clsGetDataFrameFunction.SetAssignTo(ucrSelectorForRank.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + + clsAddColumnsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRank.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + + End Sub End Class \ No newline at end of file From 2cdab1187b3edec5017dc7da425606c6e6814775 Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Fri, 15 Mar 2024 14:03:46 +0300 Subject: [PATCH 20/88] changes --- instat/dlgTransform.vb | 69 ++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 6fc220edba9..9c4d4a34bee 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -53,13 +53,17 @@ Public Class dlgTransform Private clsStandardDevColsFunction As New RFunction Private clsSubtractOperator As New ROperator + Private clsSubtractColsOperator As New ROperator + Private clsDivisionOperator As New ROperator + Private clsDivisionColsOperator As New ROperator Private clsSquarerootFunction As New RFunction Private clsSquarerootColsFunction As New RFunction Private clsAddConstantOperator As New ROperator + Private clsAddConstantColsOperator As New ROperator Private clsNaturalLogFunction As New RFunction Private clsNaturalLogColsFunction As New RFunction @@ -205,7 +209,7 @@ Public Class dlgTransform ucrPnlNonNegative.AddParameterValuesCondition(rdoNaturalLog, "check", "log") ucrPnlNonNegative.AddParameterValuesCondition(rdoPower, "check", "power") - 'ucrPnlColumnSelectOptions.AddToLinkedControls(ucrNewColName, {rdoMultiple}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlColumnSelectOptions.AddToLinkedControls(ucrSaveNew, {rdoSingle}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudSignifDigits, {rdoSignificantDigits}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudRoundOfDigits, {rdoRoundOf}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudLagLeadPosition, {rdoLead}, bNewLinkedHideIfParameterMissing:=True) @@ -380,6 +384,7 @@ Public Class dlgTransform clsDivisionOperator = New ROperator clsSquarerootFunction = New RFunction clsAddConstantOperator = New ROperator + clsAddConstantColsOperator = New ROperator clsNaturalLogFunction = New RFunction clsLogBase10Function = New RFunction clsPowerOperator = New ROperator @@ -542,9 +547,9 @@ Public Class dlgTransform clsReplicateColsFunction.SetRCommand("~rep") clsReplicateColsFunction.AddParameter("x", "NA", iPosition:=0) - 'clsConcDiffFunction.SetRCommand("c") - 'clsConcDiffFunction.AddParameter("y", clsRFunctionParameter:=clsReplicateFunction, iPosition:=0, bIncludeArgumentName:=False) - 'clsConcDiffFunction.AddParameter("x", clsRFunctionParameter:=clsDiffFunction, iPosition:=1, bIncludeArgumentName:=False) + clsConcDiffColsFunction.SetRCommand("c") + clsConcDiffColsFunction.AddParameter("y", clsRFunctionParameter:=clsReplicateColsFunction, iPosition:=0, bIncludeArgumentName:=False) + clsConcDiffColsFunction.AddParameter("x", clsRFunctionParameter:=clsDiffColsFunction, iPosition:=1, bIncludeArgumentName:=False) clsMeanColsFunction.SetRCommand("~mean") clsMeanColsFunction.AddParameter("na.rm", "TRUE", iPosition:=1) @@ -552,21 +557,21 @@ Public Class dlgTransform clsStandardDevColsFunction.SetRCommand("~sd") clsStandardDevColsFunction.AddParameter("na.rm", "TRUE", iPosition:=1) - clsSubtractOperator.SetOperation("-") - clsSubtractOperator.AddParameter("y", clsRFunctionParameter:=clsMeanFunction, iPosition:=1) + clsSubtractColsOperator.SetOperation("-") + clsSubtractColsOperator.AddParameter("y", clsRFunctionParameter:=clsMeanColsFunction, iPosition:=1) - clsDivisionOperator.SetOperation("/") - clsDivisionOperator.AddParameter("x", clsROperatorParameter:=clsSubtractOperator, iPosition:=0) - clsDivisionOperator.AddParameter("y", clsRFunctionParameter:=clsStandardDevFunction, iPosition:=1) + clsDivisionColsOperator.SetOperation("/") + clsDivisionColsOperator.AddParameter("x", clsROperatorParameter:=clsSubtractColsOperator, iPosition:=0) + clsDivisionColsOperator.AddParameter("y", clsRFunctionParameter:=clsStandardDevColsFunction, iPosition:=1) clsSquarerootFunction.SetRCommand("sqrt") - clsAddConstantOperator.SetOperation("+") - clsAddConstantOperator.AddParameter("c", "0", iPosition:=1) + clsAddConstantColsOperator.SetOperation("+") + clsAddConstantColsOperator.AddParameter("c", "0", iPosition:=1) - clsNaturalLogFunction.SetRCommand("log") + clsNaturalLogColsFunction.SetRCommand("log") - clsLogBase10Function.SetRCommand("log10") + clsLogBase10ColsFunction.SetRCommand("~log10") clsPowerColsOperator.SetOperation("^") clsPowerColsOperator.AddParameter("y", "1", iPosition:=1) @@ -617,7 +622,6 @@ Public Class dlgTransform clsPipeOperator.AddParameter("right", clsRFunctionParameter:=clsMutateFunction, iPosition:=1) clsPipeOperator.SetAssignTo("col") - clsRemoveLabelsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$append_to_variables_metadata") clsRemoveLabelsFunction.AddParameter("property", Chr(34) & "labels" & Chr(34), iPosition:=2) clsRemoveLabelsFunction.AddParameter("new_val", Chr(34) & Chr(34), iPosition:=3) @@ -659,6 +663,13 @@ Public Class dlgTransform ucrReceiverRank.AddAdditionalCodeParameterPair(clsSubtractOperator, New RParameter("x", 0), iAdditionalPairNo:=8) ucrReceiverRank.AddAdditionalCodeParameterPair(clsStandardDevFunction, New RParameter("x", 0), iAdditionalPairNo:=9) ucrNudDiffLag.AddAdditionalCodeParameterPair(clsReplicateFunction, New RParameter("times", 1), iAdditionalPairNo:=1) + ucrNudDiffLag.AddAdditionalCodeParameterPair(clsReplicateColsFunction, New RParameter("times", 1), iAdditionalPairNo:=2) + ucrNudDiffLag.AddAdditionalCodeParameterPair(clsDiffColsFunction, New RParameter("times", 1), iAdditionalPairNo:=3) + ucrNudLagLeadPosition.AddAdditionalCodeParameterPair(clsLeadColsFunction, New RParameter("n", 1), iAdditionalPairNo:=1) + ucrNudLagPosition.AddAdditionalCodeParameterPair(clsLagColsFunction, New RParameter("lag", 1), iAdditionalPairNo:=1) + ucrNudSignifDigits.AddAdditionalCodeParameterPair(clsSignifColsFunction, New RParameter("digits", 1), iAdditionalPairNo:=1) + ucrInputPower.AddAdditionalCodeParameterPair(clsPowerColsOperator, New RParameter("y", 1), iAdditionalPairNo:=1) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsAddConstantOperator, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=10) ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleSubtractOperator, New RParameter("x", 0), iAdditionalPairNo:=11) ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleMeanFunction, New RParameter("x", 0), iAdditionalPairNo:=12) @@ -666,6 +677,8 @@ Public Class dlgTransform ucrReceiverRank.AddAdditionalCodeParameterPair(clsBooleanOperator, New RParameter("x", 0), iAdditionalPairNo:=14) ucrReceiverRank.AddAdditionalCodeParameterPair(clsIsNAFunction, New RParameter("x", 0), iAdditionalPairNo:=15) ucrReceiverRank.AddAdditionalCodeParameterPair(clsGetColSelectionNamesFunction, New RParameter("x", 0), iAdditionalPairNo:=16) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsLeadColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=17) + ucrChkOmitNA.AddAdditionalCodeParameterPair(clsStandardDevFunction, ucrChkOmitNA.GetParameter(), iAdditionalPairNo:=1) ucrSelectorForRank.AddAdditionalCodeParameterPair(clsGetColSelectionNamesFunction, ucrSelectorForRank.GetParameter, iAdditionalPairNo:=1) ucrNudRoundOfDigits.AddAdditionalCodeParameterPair(clsRoundColsFunction, New RParameter("digits", 1), iAdditionalPairNo:=1) @@ -878,10 +891,10 @@ Public Class dlgTransform Else LoopsParameters() ucrBase.clsRsyntax.ClearCodes() - - ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) - ucrBase.clsRsyntax.AddToAfterCodes(clsAssignOperator, 0) - ucrBase.clsRsyntax.AddToAfterCodes(clsAddColumnsFunction, 1) + ucrBase.clsRsyntax.SetAssignTo("col") + ucrBase.clsRsyntax.AddToAfterCodes(clsPipeOperator, 0) + ucrBase.clsRsyntax.AddToAfterCodes(clsAssignOperator, 1) + ucrBase.clsRsyntax.AddToAfterCodes(clsAddColumnsFunction, 2) clsDummyTransformFunction.AddParameter("checked", "multiple", iPosition:=1) ucrSelectorForRank.SetItemType("column_selection") @@ -944,7 +957,9 @@ Public Class dlgTransform ElseIf rdoStandardize.Checked Then clsNumericDummyFunction.AddParameter("check", "standardise", iPosition:=0) - clsDivisionColsOperator.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + clsMeanColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + clsStandardDevColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + 'clsTildaOperator.AddParameter("sig", clsROperatorParameter:=clsDivisionColsOperator, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsDivisionColsOperator, bIncludeArgumentName:=False) ElseIf rdoLogical.Checked Then @@ -1019,10 +1034,18 @@ Public Class dlgTransform Private Sub UpdateConstantParameter() If ucrChkAddConstant.Checked Then - clsSquarerootFunction.AddParameter("x", clsROperatorParameter:=clsAddConstantOperator, iPosition:=0) - clsPowerOperator.AddParameter("x", clsROperatorParameter:=clsAddConstantOperator, iPosition:=0) - clsLogBase10Function.AddParameter("x", clsROperatorParameter:=clsAddConstantOperator, iPosition:=0) - clsNaturalLogFunction.AddParameter("x", clsROperatorParameter:=clsAddConstantOperator, iPosition:=0) + If rdoSingle.Checked Then + clsSquarerootFunction.AddParameter("x", clsROperatorParameter:=clsAddConstantOperator, iPosition:=0) + clsPowerOperator.AddParameter("x", clsROperatorParameter:=clsAddConstantOperator, iPosition:=0) + clsLogBase10Function.AddParameter("x", clsROperatorParameter:=clsAddConstantOperator, iPosition:=0) + clsNaturalLogFunction.AddParameter("x", clsROperatorParameter:=clsAddConstantOperator, iPosition:=0) + Else + clsSquarerootColsFunction.AddParameter("x", clsROperatorParameter:=clsAddConstantColsOperator, iPosition:=0) + clsPowerColsOperator.AddParameter("x", clsROperatorParameter:=clsAddConstantColsOperator, iPosition:=0) + clsLogBase10ColsFunction.AddParameter("x", clsROperatorParameter:=clsAddConstantColsOperator, iPosition:=0) + clsNaturalLogColsFunction.AddParameter("x", clsROperatorParameter:=clsAddConstantColsOperator, iPosition:=0) + End If + End If If bResetRCode Then If ucrChkAddConstant.Checked Then From 9263a48d7ec6ceec67898194ae1614d5706dd8c7 Mon Sep 17 00:00:00 2001 From: Stephen Lloyd Date: Sun, 17 Mar 2024 10:58:34 +0100 Subject: [PATCH 21/88] initial refactoring: tidied public/private; ordered all members --- instat/clsRSyntax.vb | 869 +++++++++++-------------------- instat/dlgCalculationsSummary.vb | 4 +- instat/dlgDuplicateColumns.vb | 2 +- instat/dlgExportToClimsoft.vb | 8 +- instat/dlgJitter.vb | 6 +- instat/dlgModelling.vb | 11 +- instat/dlgRandomSubsets.vb | 2 +- instat/dlgRownamesOrNumbers.vb | 2 +- instat/dlgShowModel.vb | 4 +- instat/dlgSummaryTables.vb | 2 +- instat/dlgTransformText.vb | 1 - instat/dlgTransposeColumns.vb | 2 +- instat/dlgTwoVariableUseModel.vb | 4 +- instat/dlgUseModel.vb | 4 +- instat/dlgWordwrap.vb | 1 - instat/sdgSimpleRegOptions.vb | 2 +- instat/ucrButtons.vb | 6 +- instat/ucrTry.vb | 4 +- 18 files changed, 329 insertions(+), 605 deletions(-) diff --git a/instat/clsRSyntax.vb b/instat/clsRSyntax.vb index 90b4913385d..ae95b7b9be1 100644 --- a/instat/clsRSyntax.vb +++ b/instat/clsRSyntax.vb @@ -53,25 +53,15 @@ Public Class RSyntax ' 'TODO SJL It's not valid for an object of this class to be more than one of the 3 types above. ' However the booleans potentially allow this. Replace with an enumeration? - ''' An R function of the form 'RCommand(param1=param1Val, param2=param2Val, ...)'. - Public clsBaseFunction As New RFunction - - ''' An R operation of the form 'leftSide Operator rightSide' (e.g. "x+y"). - Public clsBaseOperator As New ROperator - - ''' An R command (of any type). - Public clsBaseCommandString As New RCodeStructure 'TODO SJL 17/04/20 What's the connection between this and 'bUeseCommandString' and 'strCommandString'? - - - ''' The R command in the form of a string. - Public strCommandString As String = "" - - ''' The R functions/operators/commands that should be run before the base R code. - Public lstBeforeCodes As New List(Of RCodeStructure) + ''' If true then don't include the output part in the script (i.e. the part of the + ''' script to the left of the assignment operator '<-'). + Public bExcludeAssignedFunctionOutput As Boolean = True - ''' The R functions/operators/commands that should be run after the base R code. - Public lstAfterCodes As New List(Of RCodeStructure) + ''' If true then run the R script in a separate thread. + Public bSeparateThread As Boolean = True + ''' TODO SJL 07/04/20 Is only ever Nothing (or in one rare case False). Remove? + Public bShowWaitDialogOverride As Nullable(Of Boolean) = Nothing ''' If true then use 'clsBaseFunction' as this object's base R code. Public bUseBaseFunction As Boolean = False @@ -82,6 +72,14 @@ Public Class RSyntax ''' If true then use 'clsBaseCommandString' as this object's base R code. Public bUseCommandString As Boolean = False + ''' An R command (of any type). + Public clsBaseCommandString As New RCodeStructure 'TODO SJL 17/04/20 What's the connection between this and 'bUseCommandString' and 'strCommandString'? + + ''' An R function of the form 'RCommand(param1=param1Val, param2=param2Val, ...)'. + Public clsBaseFunction As New RFunction + + ''' An R operation of the form 'leftSide Operator rightSide' (e.g. "x+y"). + Public clsBaseOperator As New ROperator ''' Defines how to display the R output. ''' @@ -94,147 +92,16 @@ Public Class RSyntax ''' Public iCallType As Integer = 0 'TODO SJL 07/04/20 Use enumeration? + ''' The R command in the form of a string. + Public strCommandString As String = "" - ''' The script associated with the base R code. - Public strScript As String 'TODO SJL This is only used in the RSyntax.GetScript function. Also cleared once in ucrButtons. Refactor? - - ''' TODO SJL 07/04/20 Not used. Remove? - Public i As Integer - - ''' If true then don't include the output part in the script (i.e. the part of the - ''' script to the left of the assignment operator '<-'). - Public bExcludeAssignedFunctionOutput As Boolean = True - - ''' If true then run the R script in a separate thread. - Public bSeparateThread As Boolean = True - - ''' TODO SJL 07/04/20 Is only ever Nothing (or in one rare case False). Remove? - Public bShowWaitDialogOverride As Nullable(Of Boolean) = Nothing - - '''-------------------------------------------------------------------------------------------- - ''' Sets the function's name (e.g. "facet_grid") and flags that the R script - ''' associated with this object is no longer correctly assigned. - ''' - ''' Name of the R command. - '''-------------------------------------------------------------------------------------------- - Public Sub SetFunction(strFunctionName As String) - 'TODO legacy - confusing name - clsBaseFunction.SetRCommand(strFunctionName) - bUseBaseFunction = True - bUseBaseOperator = False - bUseCommandString = False - End Sub - - '''-------------------------------------------------------------------------------------------- - ''' TODO SJL 04/04/20 This function is not used, remove? - ''' - ''' The name. - '''-------------------------------------------------------------------------------------------- - Public Sub SetPackageName(strName As String) - If clsBaseFunction Is Nothing Then - MsgBox("Developer error: base function must be set before package name is set.") - Else - clsBaseFunction.SetPackageName(strName) - bUseBaseFunction = True - bUseBaseOperator = False - bUseCommandString = False - End If - End Sub - - '''-------------------------------------------------------------------------------------------- - ''' Sets this object to be R function . - ''' - ''' The R function to associate with this object. - '''-------------------------------------------------------------------------------------------- - Public Sub SetBaseRFunction(clsFunction As RFunction) - clsBaseFunction = clsFunction - bUseBaseFunction = True - bUseBaseOperator = False - bUseCommandString = False - End Sub - - '''-------------------------------------------------------------------------------------------- - ''' Sets this object to be R operator . - ''' - ''' The R operator to associate with this object. - '''-------------------------------------------------------------------------------------------- - Public Sub SetBaseROperator(clsOperator As ROperator) - clsBaseOperator = clsOperator - bUseBaseFunction = False - bUseBaseOperator = True - bUseCommandString = False - End Sub - - '''-------------------------------------------------------------------------------------------- - ''' Sets the operation's symbol to (e.g. "+") and if - ''' is true then includes the first operation - ''' parameter in brackets. - ''' - ''' The operation symbol (e.g. "+"). - ''' (Optional) If true then enclose first parameter in brackets. - ''' - '''-------------------------------------------------------------------------------------------- - Public Sub SetOperation(strOp As String, Optional bBracketTemp As Boolean = True) - clsBaseOperator.SetOperation(strOp, bBracketTemp) - bUseBaseFunction = False - bUseBaseOperator = True - bUseCommandString = False - End Sub - '''-------------------------------------------------------------------------------------------- - ''' Sets this object's R command to . This object's - ''' R command is then just a string (rather than a function or operation object) - ''' - ''' - ''' The R command string. - '''-------------------------------------------------------------------------------------------- - Public Sub SetCommandString(strCommand As String) - strCommandString = strCommand - bUseBaseFunction = False - bUseBaseOperator = False - bUseCommandString = True - End Sub + ''' The R functions/operators/commands that should be run before the base R code. + Private lstBeforeCodes As New List(Of RCodeStructure) - '''-------------------------------------------------------------------------------------------- - ''' Sets the 'assignTo' variables for this object's associated R function, R - ''' operation or R command string. - ''' - ''' The new value for the assignment string. - ''' (Optional) The new value for the dataframe. - ''' (Optional) The new value for the column. - ''' (Optional) The new value for the model. - ''' (Optional) The new value for the graph. - ''' (Optional) The new value for bAssignToIsPrefix. - ''' (Optional) The new value for bAssignToColumnWithoutNames. - ''' (Optional) The new value for bInsertColumnBefore. - ''' (Optional) The new value for bRequireCorrectLength. - '''-------------------------------------------------------------------------------------------- - Public Sub SetAssignTo(strAssignToName As String, Optional strTempDataframe As String = "", Optional strTempColumn As String = "", Optional strTempModel As String = "", Optional strTempGraph As String = "", Optional bAssignToIsPrefix As Boolean = False, Optional bAssignToColumnWithoutNames As Boolean = False, Optional bInsertColumnBefore As Boolean = False, Optional bRequireCorrectLength As Boolean = True, Optional strAdjacentColumn As String = "") - If bUseBaseOperator Then - clsBaseOperator.SetAssignTo(strTemp:=strAssignToName, strTempDataframe:=strTempDataframe, strTempColumn:=strTempColumn, strTempModel:=strTempModel, strTempGraph:=strTempGraph, bAssignToIsPrefix:=bAssignToIsPrefix, bAssignToColumnWithoutNames:=bAssignToColumnWithoutNames, bInsertColumnBefore:=bInsertColumnBefore, bRequireCorrectLength:=bRequireCorrectLength, strAdjacentColumn:=strAdjacentColumn) - ElseIf bUseBaseFunction Then - clsBaseFunction.SetAssignTo(strAssignToName, strTempDataframe:=strTempDataframe, strTempColumn:=strTempColumn, strTempModel:=strTempModel, strTempGraph:=strTempGraph, bAssignToIsPrefix:=bAssignToIsPrefix, bAssignToColumnWithoutNames:=bAssignToColumnWithoutNames, bInsertColumnBefore:=bInsertColumnBefore, bRequireCorrectLength:=bRequireCorrectLength, strAdjacentColumn:=strAdjacentColumn) - ElseIf bUseCommandString Then - clsBaseCommandString.SetAssignTo(strAssignToName, strTempDataframe:=strTempDataframe, strTempColumn:=strTempColumn, strTempModel:=strTempModel, strTempGraph:=strTempGraph, bAssignToIsPrefix:=bAssignToIsPrefix, bAssignToColumnWithoutNames:=bAssignToColumnWithoutNames, bInsertColumnBefore:=bInsertColumnBefore, bRequireCorrectLength:=bRequireCorrectLength, strAdjacentColumn:=strAdjacentColumn) - End If - End Sub + ''' The R functions/operators/commands that should be run after the base R code. + Private lstAfterCodes As New List(Of RCodeStructure) - '''-------------------------------------------------------------------------------------------- - ''' Resets all the 'AssignTo' variables. - ''' String variables are set to "". - ''' Booleans are set to false. - ''' - '''-------------------------------------------------------------------------------------------- - Public Sub RemoveAssignTo() - If bUseBaseOperator Then - clsBaseOperator.RemoveAssignTo() - End If - If bUseBaseFunction Then 'TODO SJL 04/04/20 should this be ElseIf? - clsBaseFunction.RemoveAssignTo() - ElseIf bUseCommandString Then - clsBaseCommandString.RemoveAssignTo() - End If - End Sub '''-------------------------------------------------------------------------------------------- ''' @@ -262,137 +129,189 @@ Public Class RSyntax End Sub '''-------------------------------------------------------------------------------------------- - ''' TODO SJL 04/04/20 This function is not used, remove? + ''' Adds R function/operation/command to the + ''' 'after' list. ''' - ''' The new parameter to add. + ''' The R function/operation/command to add. + ''' (Optional) The relative position of the parameter in this + ''' object's 'after' list. '''-------------------------------------------------------------------------------------------- - Public Sub AddParameter(clsRParam As RParameter) - 'TODO SJL 04/04/20 if we keep this function, should it also handle adding parameters to operations or string R commands? - clsBaseFunction.AddParameter(clsRParam) + Public Sub AddToAfterCodes(clsNewRCode As RCodeStructure, Optional iPosition As Integer = -1) + If Not lstAfterCodes.Contains(clsNewRCode) Then + lstAfterCodes.Add(clsNewRCode) + clsNewRCode.iPosition = iPosition 'TODO SJL 06/04/20 remove this line and the 'Else' (same as function above)? + Else + lstAfterCodes.Find(Function(x) x.Equals(clsNewRCode)).iPosition = iPosition + End If End Sub '''-------------------------------------------------------------------------------------------- - ''' TODO SJL 04/04/20 This function is not used, remove? - ''' - ''' The name. + ''' Adds R function/operation/command to the + ''' 'before' list. ''' - ''' The parameter. + ''' The R function/operation/command to add. + ''' (Optional) The relative position of the parameter in this + ''' object's 'before' list. '''-------------------------------------------------------------------------------------------- - Public Function GetParameter(strName As String) As RParameter - If bUseBaseFunction Then - Return clsBaseFunction.GetParameter(strName) - ElseIf bUseBaseOperator Then - Return clsBaseOperator.GetParameter(strName) + Public Sub AddToBeforeCodes(clsNewRCode As RCodeStructure, Optional iPosition As Integer = -1) + If Not lstBeforeCodes.Contains(clsNewRCode) Then + lstBeforeCodes.Add(clsNewRCode) End If - Return Nothing - End Function + lstBeforeCodes.Find(Function(x) x.Equals(clsNewRCode)).iPosition = iPosition + End Sub '''-------------------------------------------------------------------------------------------- - ''' TODO SJL 04/04/20 This function is superceded by the 'SetOperatorParameter' - ''' function below, remove? - ''' - ''' True to position. - ''' (Optional) Name of the parameter. - ''' (Optional) The value. - ''' (Optional) The cls r function. - ''' (Optional) The cls operation. - ''' (Optional) The cls create struct. - ''' (Optional) True to include, false to exclude the argument - ''' name. - '''-------------------------------------------------------------------------------------------- - Public Sub SetOperatorParameter(iPos As Boolean, Optional strParameterName As String = "", Optional strValue As String = "", Optional clsRFunc As RFunction = Nothing, Optional clsOp As ROperator = Nothing, Optional clsCs As RCodeStructure = Nothing, Optional bIncludeArgumentName As Boolean = True) - 'TODO legacy comment: This is temporary, just don't want to change all the files in one pull request... - ' Will have to change the first argument to an integer... - Dim iPosition As Integer - If iPos Then - iPosition = 0 - Else - iPosition = -1 - End If - clsBaseOperator.AddParameter(strParameterName, strValue, clsRFunc, clsOp, clsCs, bIncludeArgumentName, iPosition) + ''' Resets all the data members to default values. + '''-------------------------------------------------------------------------------------------- + Public Sub ClearCodes() + 'TODO SJL Some data members are not reset by this function. Add them? + lstBeforeCodes = New List(Of RCodeStructure) + lstAfterCodes = New List(Of RCodeStructure) + clsBaseFunction = New RFunction + clsBaseOperator = New ROperator + clsBaseCommandString = New RCodeStructure + strCommandString = "" + bUseBaseFunction = False + bUseBaseOperator = False + bUseCommandString = False End Sub '''-------------------------------------------------------------------------------------------- - ''' Creates and adds a parameter to the R operator associated with this object. - ''' Sets the parameter's name to . - ''' Sets the parameter's argument to one of , - ''' , , - ''' or . - ''' Sets the parameter's position and include/exclude argument name flag to - ''' and - ''' respectively. + ''' Returns true if the R function/operator/command is + ''' the R function/operator/command associated with this object. Also returns true + ''' if is in this object's 'before' or 'after' lists. + ''' Else returns false. ''' ''' - ''' (Optional) Name of the parameter. - ''' (Optional) The parameter value. - ''' (Optional) The R function parameter. - ''' (Optional) The R operator parameter. - ''' (Optional) The R code structure parameter. - ''' (Optional) True to include, false to exclude the - ''' argument name. - ''' (Optional) The relative position of the - ''' parameter in this object's parameter list. - '''-------------------------------------------------------------------------------------------- - Public Sub SetOperatorParameter(iPosition As Integer, Optional strParameterName As String = "", Optional strValue As String = "", Optional clsRFunc As RFunction = Nothing, Optional clsOp As ROperator = Nothing, Optional clsCs As RCodeStructure = Nothing, Optional bIncludeArgumentName As Boolean = True) - 'TODO SJL 17/04/20 This function should only be used if this class encapsulates an operator. But it doesn't check the booleans for this. - ' Also, 'clsBaseOperator' is public so 'AddParameter' can be called directly. Remove this function? - clsBaseOperator.AddParameter(strParameterName, strValue, clsRFunc, clsOp, clsCs, bIncludeArgumentName, iPosition) - End Sub - - '''-------------------------------------------------------------------------------------------- - ''' Adds an operator parameter. + ''' The R function/operator/command to search for. ''' - ''' Name of the parameter. - ''' (Optional) The parameter value. - ''' (Optional) The cls r function. - ''' (Optional) The cls operation. - ''' (Optional) The cls create struct. - ''' (Optional) True to include, false to exclude the argument - ''' name. - '''-------------------------------------------------------------------------------------------- - Public Sub AddOperatorParameter(strParameterName As String, Optional strParameterValue As String = "", Optional clsRFunc As RFunction = Nothing, Optional clsOp As ROperator = Nothing, Optional clsCs As RCodeStructure = Nothing, Optional bIncludeArgumentName As Boolean = True) - 'TDDO SJL 17/04/20 What's the difference between this function and the one above? Remove this function? - clsBaseOperator.AddParameter(strParameterName, strParameterValue, clsRFunc, clsOp, clsCs, bIncludeArgumentName) - End Sub + ''' True if the R function/operator/command is + ''' the R function/operator/command associated with this object. Also returns true + ''' if is in this object's 'before' or 'after' lists. + ''' Else returns false. + '''-------------------------------------------------------------------------------------------- + Public Function ContainsCode(clsRCode As RCodeStructure) As Boolean + Return (clsBaseFunction IsNot Nothing AndAlso clsBaseFunction.Equals(clsRCode)) _ + OrElse (clsBaseOperator IsNot Nothing _ + AndAlso clsBaseOperator.Equals(clsRCode) _ + AndAlso clsBaseOperator.Equals(clsRCode)) _ + OrElse lstBeforeCodes.Contains(clsRCode) _ + OrElse lstAfterCodes.Contains(clsRCode) + End Function '''-------------------------------------------------------------------------------------------- - ''' Removes the parameter named . + ''' Returns the list of 'after' R functions/operators/commands (i.e. the ones that + ''' run after the base R code). ''' - ''' Name of the parameter. - ''' [in,out] (Optional) The function to add the parameter to. - ''' If not specified then adds the parameter to 'clsBaseFunction'. + ''' The list of 'after' R functions/operators/commands (i.e. the ones that run + ''' after the base R code). '''-------------------------------------------------------------------------------------------- - Public Sub RemoveParameter(strParameterName As String, Optional ByRef clsFunction As RFunction = Nothing) - 'TODO SJL 17/04/20 This function should only be used if this class encapsulates a function. But it doesn't check the booleans for this. - ' Also, 'clsBaseFunction' is public so 'RemoveParameterByName' can be called directly. Remove this function? - If clsFunction Is Nothing Then - clsFunction = clsBaseFunction - End If - clsFunction.RemoveParameterByName(strParameterName) - End Sub + Public Function GetAfterCodes() As List(Of RCodeStructure) + lstAfterCodes.Sort(AddressOf CompareCodePositions) + Return lstAfterCodes + End Function '''-------------------------------------------------------------------------------------------- - ''' TODO SJL 04/04/20 This function is not used, remove? + ''' Returns the list of scripts associated with the list of 'after' R + ''' functions/operators/commands (i.e. the ones that run after the base R code). + ''' If a list object is flagged to exclude the script's output, and the output has + ''' already been assigned, then the list object's script does not include the output + ''' part. ''' - ''' Name of the parameter. + ''' The list of scripts associated with the list of 'after' R + ''' functions/operators/commands. '''-------------------------------------------------------------------------------------------- - Public Sub RemoveOperatorParameter(strParameterName As String) - clsBaseOperator.RemoveParameterByName(strParameterName) - End Sub + Public Function GetAfterCodesScripts() As List(Of String) + lstAfterCodes.Sort(AddressOf CompareCodePositions) + Return GetScriptsFromCodeList(lstAfterCodes) + End Function '''-------------------------------------------------------------------------------------------- - ''' TODO SJL 04/04/20 This function is not used, remove? + ''' Adds this object and its associated assign script to + ''' and respectively. + ''' If this object's parameters also contain functions or operators then also + ''' recursively adds their respective RCodeStructure objects and associated assign + ''' scripts to the respective lists. + ''' If this object has lists of 'before' or 'after' functions/operators/commands, + ''' then also adds these objects and their associated assign scripts to the + ''' respective lists. + ''' ''' - ''' [in,out] (Optional) The cls function. + ''' The list of RCodeStructure objects. + ''' The list of assign scripts . '''-------------------------------------------------------------------------------------------- - Public Sub ClearParameters(Optional ByRef clsFunction As RFunction = Nothing) - If clsFunction Is Nothing Then - clsFunction = clsBaseFunction + Public Sub GetAllAssignTo(lstCodes As List(Of RCodeStructure), lstValues As List(Of String)) + If bUseBaseFunction Then + clsBaseFunction.GetAllAssignTo(lstCodes, lstValues) + ElseIf bUseBaseOperator Then + clsBaseOperator.GetAllAssignTo(lstCodes, lstValues) End If - - clsFunction.ClearParameters() + lstBeforeCodes.Sort(AddressOf CompareCodePositions) + For Each clsTempCode As RCodeStructure In lstBeforeCodes + clsTempCode.GetAllAssignTo(lstCodes, lstValues) + Next + lstAfterCodes.Sort(AddressOf CompareCodePositions) + For Each clsTempCode As RCodeStructure In lstAfterCodes + clsTempCode.GetAllAssignTo(lstCodes, lstValues) + Next End Sub + '''-------------------------------------------------------------------------------------------- + ''' Returns the list of 'before' R functions/operators/commands (i.e. the ones that + ''' run before the base R code). + ''' + ''' The list of 'before' R functions/operators/commands (i.e. the ones that run + ''' before the base R code). + '''-------------------------------------------------------------------------------------------- + Public Function GetBeforeCodes() As List(Of RCodeStructure) + lstBeforeCodes.Sort(AddressOf CompareCodePositions) + Return lstBeforeCodes + End Function + + '''-------------------------------------------------------------------------------------------- + ''' Returns the list of scripts associated with the list of 'before' R + ''' functions/operators/commands (i.e. the ones that run before the base R code). + ''' If a list object is flagged to exclude the script's output, and the output has + ''' already been assigned, then the list object's script does not include the output + ''' part. + ''' + ''' The list of scripts associated with the list of 'before' R + ''' functions/operators/commands. + '''-------------------------------------------------------------------------------------------- + Public Function GetBeforeCodesScripts() As List(Of String) + lstBeforeCodes.Sort(AddressOf CompareCodePositions) + Return GetScriptsFromCodeList(lstBeforeCodes) + End Function + + '''-------------------------------------------------------------------------------------------- + ''' Returns all the function names in the 'before' and 'after' lists. If this object + ''' is an R function then also return the name of this function. + ''' + ''' All the function names in the 'before' and 'after' lists. If this object + ''' is an R function then also return the name of this function. + '''-------------------------------------------------------------------------------------------- + Public Function GetFunctionNames() As List(Of String) + Dim lstNames As New List(Of String) + Dim clsTempFunc As RFunction + + If clsBaseFunction IsNot Nothing Then + lstNames.Add(clsBaseFunction.strRCommand) + End If + For Each clsRCode As RCodeStructure In lstBeforeCodes + clsTempFunc = TryCast(clsRCode, RFunction) + If clsTempFunc IsNot Nothing Then + lstNames.Add(clsTempFunc.strRCommand) + End If + Next + For Each clsRCode As RCodeStructure In lstAfterCodes + clsTempFunc = TryCast(clsRCode, RFunction) + If clsTempFunc IsNot Nothing Then + lstNames.Add(clsTempFunc.strRCommand) + End If + Next + Return lstNames + End Function + '''-------------------------------------------------------------------------------------------- ''' Returns the script associated with this object's R function, R operator or ''' R command string. @@ -405,21 +324,19 @@ Public Class RSyntax '''-------------------------------------------------------------------------------------------- Public Function GetScript() As String Dim strTemp As String = "" + Dim strScript As String = "" If bUseBaseFunction Then strTemp = clsBaseFunction.ToScript(strScript) ElseIf bUseBaseOperator Then strTemp = clsBaseOperator.ToScript(strScript) - ElseIf bUseCommandString Then - strTemp = clsBaseCommandString.ToScript(strScript, strCommandString) End If If bExcludeAssignedFunctionOutput Then 'Sometimes the output of the R-command we deal with should not be part of the script... 'That's only the case when this output has already been assigned. If (bUseBaseFunction AndAlso clsBaseFunction.IsAssigned()) OrElse - (bUseBaseOperator AndAlso clsBaseFunction.IsAssigned()) OrElse - (bUseCommandString AndAlso clsBaseFunction.IsAssigned()) Then + (bUseBaseOperator AndAlso clsBaseFunction.IsAssigned()) Then Return strScript End If End If @@ -427,125 +344,130 @@ Public Class RSyntax End Function '''-------------------------------------------------------------------------------------------- - ''' Returns the list of scripts associated with the - ''' list of R functions/operators/commands. - ''' If a list object is flagged to exclude the script's output, and the output has - ''' already been assigned, then the list object's script does not include the output - ''' part. - ''' - ''' The list of R functions/operators/commands. + ''' Resets all the 'AssignTo' variables. + ''' String variables are set to "". + ''' Booleans are set to false. + ''' + '''-------------------------------------------------------------------------------------------- + Public Sub RemoveAssignTo() + If bUseBaseOperator Then + clsBaseOperator.RemoveAssignTo() + End If + If bUseBaseFunction Then 'TODO SJL 04/04/20 should this be ElseIf? + clsBaseFunction.RemoveAssignTo() + ElseIf bUseCommandString Then + clsBaseCommandString.RemoveAssignTo() + End If + End Sub + + '''-------------------------------------------------------------------------------------------- + ''' TODO SJL 06/04/20 This is a single line function on a public data member. + ''' I'm not sure what it adds. Remove?. ''' - ''' list of scripts associated with the - ''' list of R functions/operators/commands. + ''' The cls new r code. '''-------------------------------------------------------------------------------------------- - Private Function GetScriptsFromCodeList(lstCodes As List(Of RCodeStructure)) As List(Of String) - Dim strScript As String = "" 'TODO SJL 06/04/20 redundant assignments - Dim strTemp As String = "" - Dim lstScripts As New List(Of String) + Public Sub RemoveFromAfterCodes(clsNewRCode As RCodeStructure) + lstAfterCodes.Remove(clsNewRCode) + End Sub - For Each clsTempCode In lstCodes - strScript = "" - strTemp = clsTempCode.ToScript(strScript) - 'Sometimes the output of the R-command we deal with should not be part of the script... - If clsTempCode.bExcludeAssignedFunctionOutput AndAlso Not String.IsNullOrEmpty(clsTempCode.GetRObjectToAssignTo) Then - lstScripts.Add(strScript) - Else - lstScripts.Add(strScript & strTemp) - End If - Next - Return lstScripts - End Function + '''-------------------------------------------------------------------------------------------- + ''' TODO SJL 06/04/20 This is a single line function on a public data member. + ''' I'm not sure what it adds. Remove? + ''' + ''' The cls new r code. + '''-------------------------------------------------------------------------------------------- + Public Sub RemoveFromBeforeCodes(clsNewRCode As RCodeStructure) + lstBeforeCodes.Remove(clsNewRCode) + End Sub '''-------------------------------------------------------------------------------------------- - ''' Returns the list of scripts associated with the list of 'before' R - ''' functions/operators/commands (i.e. the ones that run before the base R code). - ''' If a list object is flagged to exclude the script's output, and the output has - ''' already been assigned, then the list object's script does not include the output - ''' part. + ''' Removes the parameter named . ''' - ''' The list of scripts associated with the list of 'before' R - ''' functions/operators/commands. + ''' Name of the parameter. + ''' [in,out] (Optional) The function to add the parameter to. + ''' If not specified then adds the parameter to 'clsBaseFunction'. '''-------------------------------------------------------------------------------------------- - Public Function GetBeforeCodesScripts() As List(Of String) - lstBeforeCodes.Sort(AddressOf CompareCodePositions) - Return GetScriptsFromCodeList(lstBeforeCodes) - End Function + Public Sub RemoveParameter(strParameterName As String, Optional ByRef clsFunction As RFunction = Nothing) + 'TODO SJL 17/04/20 This function should only be used if this class encapsulates a function. But it doesn't check the booleans for this. + ' Also, 'clsBaseFunction' is public so 'RemoveParameterByName' can be called directly. Remove this function? + If clsFunction Is Nothing Then + clsFunction = clsBaseFunction + End If + clsFunction.RemoveParameterByName(strParameterName) + End Sub '''-------------------------------------------------------------------------------------------- - ''' Returns the list of 'before' R functions/operators/commands (i.e. the ones that - ''' run before the base R code). + ''' Sets the 'assignTo' variables for this object's associated R function, R + ''' operation or R command string. ''' - ''' The list of 'before' R functions/operators/commands (i.e. the ones that run - ''' before the base R code). + ''' The new value for the assignment string. + ''' (Optional) The new value for the dataframe. + ''' (Optional) The new value for the column. + ''' (Optional) The new value for the model. + ''' (Optional) The new value for the graph. + ''' (Optional) The new value for bAssignToIsPrefix. + ''' (Optional) The new value for bAssignToColumnWithoutNames. + ''' (Optional) The new value for bInsertColumnBefore. + ''' (Optional) The new value for bRequireCorrectLength. '''-------------------------------------------------------------------------------------------- - Public Function GetBeforeCodes() As List(Of RCodeStructure) - lstBeforeCodes.Sort(AddressOf CompareCodePositions) - Return lstBeforeCodes - End Function + Public Sub SetAssignTo(strAssignToName As String, Optional strTempDataframe As String = "", Optional strTempColumn As String = "", Optional strTempModel As String = "", Optional strTempGraph As String = "", Optional bAssignToIsPrefix As Boolean = False, Optional bAssignToColumnWithoutNames As Boolean = False, Optional bInsertColumnBefore As Boolean = False, Optional bRequireCorrectLength As Boolean = True, Optional strAdjacentColumn As String = "") + If bUseBaseOperator Then + clsBaseOperator.SetAssignTo(strTemp:=strAssignToName, strTempDataframe:=strTempDataframe, strTempColumn:=strTempColumn, strTempModel:=strTempModel, strTempGraph:=strTempGraph, bAssignToIsPrefix:=bAssignToIsPrefix, bAssignToColumnWithoutNames:=bAssignToColumnWithoutNames, bInsertColumnBefore:=bInsertColumnBefore, bRequireCorrectLength:=bRequireCorrectLength, strAdjacentColumn:=strAdjacentColumn) + ElseIf bUseBaseFunction Then + clsBaseFunction.SetAssignTo(strAssignToName, strTempDataframe:=strTempDataframe, strTempColumn:=strTempColumn, strTempModel:=strTempModel, strTempGraph:=strTempGraph, bAssignToIsPrefix:=bAssignToIsPrefix, bAssignToColumnWithoutNames:=bAssignToColumnWithoutNames, bInsertColumnBefore:=bInsertColumnBefore, bRequireCorrectLength:=bRequireCorrectLength, strAdjacentColumn:=strAdjacentColumn) + ElseIf bUseCommandString Then + clsBaseCommandString.SetAssignTo(strAssignToName, strTempDataframe:=strTempDataframe, strTempColumn:=strTempColumn, strTempModel:=strTempModel, strTempGraph:=strTempGraph, bAssignToIsPrefix:=bAssignToIsPrefix, bAssignToColumnWithoutNames:=bAssignToColumnWithoutNames, bInsertColumnBefore:=bInsertColumnBefore, bRequireCorrectLength:=bRequireCorrectLength, strAdjacentColumn:=strAdjacentColumn) + End If + End Sub '''-------------------------------------------------------------------------------------------- - ''' Returns the list of scripts associated with the list of 'after' R - ''' functions/operators/commands (i.e. the ones that run after the base R code). - ''' If a list object is flagged to exclude the script's output, and the output has - ''' already been assigned, then the list object's script does not include the output - ''' part. + ''' Sets this object to be R function . ''' - ''' The list of scripts associated with the list of 'after' R - ''' functions/operators/commands. + ''' The R function to associate with this object. '''-------------------------------------------------------------------------------------------- - Public Function GetAfterCodesScripts() As List(Of String) - lstAfterCodes.Sort(AddressOf CompareCodePositions) - Return GetScriptsFromCodeList(lstAfterCodes) - End Function + Public Sub SetBaseRFunction(clsFunction As RFunction) + clsBaseFunction = clsFunction + bUseBaseFunction = True + bUseBaseOperator = False + End Sub '''-------------------------------------------------------------------------------------------- - ''' Returns the list of 'after' R functions/operators/commands (i.e. the ones that - ''' run after the base R code). + ''' Sets this object to be R operator . ''' - ''' The list of 'after' R functions/operators/commands (i.e. the ones that run - ''' after the base R code). + ''' The R operator to associate with this object. '''-------------------------------------------------------------------------------------------- - Public Function GetAfterCodes() As List(Of RCodeStructure) - lstAfterCodes.Sort(AddressOf CompareCodePositions) - Return lstAfterCodes - End Function + Public Sub SetBaseROperator(clsOperator As ROperator) + clsBaseOperator = clsOperator + bUseBaseFunction = False + bUseBaseOperator = True + End Sub '''-------------------------------------------------------------------------------------------- - ''' Adds this object and its associated assign script to - ''' and respectively. - ''' If this object's parameters also contain functions or operators then also - ''' recursively adds their respective RCodeStructure objects and associated assign - ''' scripts to the respective lists. - ''' If this object has lists of 'before' or 'after' functions/operators/commands, - ''' then also adds these objects and their associated assign scripts to the - ''' respective lists. - ''' + ''' Sets this object's R command to . This object's + ''' R command is then just a string (rather than a function or operation object) + ''' ''' - ''' The list of RCodeStructure objects. - ''' The list of assign scripts . + ''' The R command string. '''-------------------------------------------------------------------------------------------- - Public Sub GetAllAssignTo(lstCodes As List(Of RCodeStructure), lstValues As List(Of String)) - If bUseBaseFunction Then - clsBaseFunction.GetAllAssignTo(lstCodes, lstValues) - ElseIf bUseBaseOperator Then - clsBaseOperator.GetAllAssignTo(lstCodes, lstValues) - ElseIf bUseCommandString Then - clsBaseCommandString.GetAllAssignTo(lstCodes, lstValues) - End If - lstBeforeCodes.Sort(AddressOf CompareCodePositions) - For Each clsTempCode As RCodeStructure In lstBeforeCodes - clsTempCode.GetAllAssignTo(lstCodes, lstValues) - Next - lstAfterCodes.Sort(AddressOf CompareCodePositions) - For Each clsTempCode As RCodeStructure In lstAfterCodes - clsTempCode.GetAllAssignTo(lstCodes, lstValues) - Next + Public Sub SetCommandString(strCommand As String) + strCommandString = strCommand + bUseBaseFunction = False + bUseBaseOperator = False + bUseCommandString = True End Sub - ''' TODO SJL 04/04/20 This function is not used, remove? - Public Sub SortParameters() - 'This sub is used to reorder the parameters according to their Position property. - 'It will be called only in places where it is necessary ie before ToScript or RemoveAdditionalParameters in ROperator. + '''-------------------------------------------------------------------------------------------- + ''' Sets the function's name (e.g. "facet_grid") and flags that the R script + ''' associated with this object is no longer correctly assigned. + ''' + ''' Name of the R command. + '''-------------------------------------------------------------------------------------------- + Public Sub SetFunction(strFunctionName As String) + 'TODO legacy - confusing name + clsBaseFunction.SetRCommand(strFunctionName) + bUseBaseFunction = True + bUseBaseOperator = False + bUseCommandString = False End Sub '''-------------------------------------------------------------------------------------------- @@ -578,234 +500,33 @@ Public Class RSyntax End Function '''-------------------------------------------------------------------------------------------- - ''' If the output from the R command needs to be assigned, then returns - ''' the part of the script to the left of the assignment operator ('<-'). - ''' If the output from the R command doesn't to be assigned, then returns an empty - ''' string. - ''' - ''' If the output from the R command needs to be assigned, then returns - ''' the part of the script to the left of the assignment operator ('<-'). - ''' If the output from the R command doesn't to be assigned, then returns an empty - ''' string. - '''-------------------------------------------------------------------------------------------- - Public Function GetstrAssignTo() As String - If bUseBaseFunction Then - Return clsBaseFunction.GetRObjectToAssignTo() - ElseIf bUseBaseOperator Then - Return clsBaseOperator.GetRObjectToAssignTo() - ElseIf bUseCommandString Then - Return clsBaseCommandString.GetRObjectToAssignTo() - Else - Return "" - End If - End Function - - '''-------------------------------------------------------------------------------------------- - ''' Returns true if is in the list of 'before' R - ''' functions/operators/commands (i.e. the ones that run before the base R code), - ''' else returns false. - ''' - ''' The object to search for in the list of 'before' R - ''' functions/operators/commands. - ''' - ''' True if is in the list of 'before' R - ''' functions/operators/commands (i.e. the ones that run before the base R code), - ''' else returns false. - '''-------------------------------------------------------------------------------------------- - Public Function BeforeCodesContain(clsNewRCode As RCodeStructure) As Boolean - 'TODO SJL 04/04/20 This function is only called from within this class. Make private? Or remove and inline the code? - Return lstBeforeCodes.Contains(clsNewRCode) - End Function - - '''-------------------------------------------------------------------------------------------- - ''' Returns true if is in the list of 'after' R - ''' functions/operators/commands (i.e. the ones that run after the base R code), - ''' else returns false. - ''' - ''' The object to search for in the list of 'after' R - ''' functions/operators/commands. - ''' - ''' True if is in the list of 'after' R - ''' functions/operators/commands (i.e. the ones that run after the base R code), - ''' else returns false. - '''-------------------------------------------------------------------------------------------- - Public Function AfterCodesContain(clsNewRCode As RCodeStructure) As Boolean - 'TODO SJL 04/04/20 This function is only called from within this class. Make private? Or remove and inline the code? - Return lstAfterCodes.Contains(clsNewRCode) - End Function - - '''-------------------------------------------------------------------------------------------- - ''' Returns true if a function named is in the - ''' list of 'before' R functions/operators/commands (i.e. the ones that run before - ''' the base R code), else returns false. - ''' - ''' The function to search for in the list of 'before' R - ''' functions/operators/commands. - ''' - ''' True if a function named is in the - ''' list of 'before' R functions/operators/commands (i.e. the ones that run before - ''' the base R code), else returns false. - '''-------------------------------------------------------------------------------------------- - Public Function BeforeCodesContain(strFunctionName As String) As Boolean - 'TODO SJL 04/04/20 This function is only called from within this class. Inline or make private? - Dim clsTempFunc As RFunction - For Each clsRCode As RCodeStructure In lstBeforeCodes - clsTempFunc = TryCast(clsRCode, RFunction) - If clsTempFunc IsNot Nothing AndAlso clsTempFunc.strRCommand = strFunctionName Then - Return True - End If - Next - Return False - End Function - - '''-------------------------------------------------------------------------------------------- - ''' Returns true if a function named is in the - ''' list of 'after' R functions/operators/commands (i.e. the ones that run after - ''' the base R code), else returns false. - ''' - ''' The function to search for in the list of 'after' R - ''' functions/operators/commands. - ''' - ''' True if function is in the list of 'after' R - ''' functions/operators/commands (i.e. the ones that run after the base R code), - ''' else returns false. - '''-------------------------------------------------------------------------------------------- - Public Function AfterCodesContain(strFunctionName As String) As Boolean - 'TODO SJL 04/04/20 This function is only called from within this class. Make private? - 'TODO SJL 06/04/20I think this function is identical to the function above! - ' There's a bug in the list name below. Even after this is corrected, both functions could be - ' combined into one (or they could call a shared private function). - Dim clsTempFunc As RFunction - For Each clsRCode As RCodeStructure In lstBeforeCodes 'TODO SJL 06/04/20 Should this be 'lstAfterCodes'? - clsTempFunc = TryCast(clsRCode, RFunction) - If clsTempFunc IsNot Nothing AndAlso clsTempFunc.strRCommand = strFunctionName Then - Return True - End If - Next - Return False - End Function - - '''-------------------------------------------------------------------------------------------- - ''' Returns true if the R function/operator/command is - ''' the R function/operator/command associated with this object. Also returns true - ''' if is in this object's 'before' or 'after' lists. - ''' Else returns false. - ''' - ''' - ''' The R function/operator/command to search for. - ''' - ''' True if the R function/operator/command is - ''' the R function/operator/command associated with this object. Also returns true - ''' if is in this object's 'before' or 'after' lists. - ''' Else returns false. - '''-------------------------------------------------------------------------------------------- - Public Function ContainsCode(clsRCode As RCodeStructure) As Boolean - Return (clsBaseFunction IsNot Nothing AndAlso clsBaseFunction.Equals(clsRCode)) OrElse (clsBaseOperator IsNot Nothing AndAlso clsBaseOperator.Equals(clsRCode) AndAlso clsBaseOperator.Equals(clsRCode)) OrElse BeforeCodesContain(clsRCode) OrElse AfterCodesContain(clsRCode) - End Function - - '''-------------------------------------------------------------------------------------------- - ''' TODO SJL 04/04/20 This function is not used, remove? - ''' - ''' Name of the function. + ''' Returns the list of scripts associated with the + ''' list of R functions/operators/commands. + ''' If a list object is flagged to exclude the script's output, and the output has + ''' already been assigned, then the list object's script does not include the output + ''' part. ''' - ''' True if it succeeds, false if it fails. - '''-------------------------------------------------------------------------------------------- - Public Function ContainsFunctionName(strFunctionName As String) As Boolean - Return (clsBaseFunction IsNot Nothing AndAlso clsBaseFunction.strRCommand = strFunctionName) OrElse BeforeCodesContain(strFunctionName) OrElse AfterCodesContain(strFunctionName) - End Function - - '''-------------------------------------------------------------------------------------------- - ''' Returns all the function names in the 'before' and 'after' lists. If this object - ''' is an R function then also return the name of this function. + ''' The list of R functions/operators/commands. ''' - ''' All the function names in the 'before' and 'after' lists. If this object - ''' is an R function then also return the name of this function. + ''' list of scripts associated with the + ''' list of R functions/operators/commands. '''-------------------------------------------------------------------------------------------- - Public Function GetFunctionNames() As List(Of String) - Dim lstNames As New List(Of String) - Dim clsTempFunc As RFunction + Private Function GetScriptsFromCodeList(lstCodes As List(Of RCodeStructure)) As List(Of String) + Dim strItemScript As String + Dim strTemp As String + Dim lstScripts As New List(Of String) - If clsBaseFunction IsNot Nothing Then - lstNames.Add(clsBaseFunction.strRCommand) - End If - For Each clsRCode As RCodeStructure In lstBeforeCodes - clsTempFunc = TryCast(clsRCode, RFunction) - If clsTempFunc IsNot Nothing Then - lstNames.Add(clsTempFunc.strRCommand) - End If - Next - For Each clsRCode As RCodeStructure In lstAfterCodes - clsTempFunc = TryCast(clsRCode, RFunction) - If clsTempFunc IsNot Nothing Then - lstNames.Add(clsTempFunc.strRCommand) + For Each clsTempCode In lstCodes + strItemScript = "" + strTemp = clsTempCode.ToScript(strItemScript) + 'Sometimes the output of the R-command we deal with should not be part of the script... + If clsTempCode.bExcludeAssignedFunctionOutput AndAlso Not String.IsNullOrEmpty(clsTempCode.GetRObjectToAssignTo) Then + lstScripts.Add(strItemScript) + Else + lstScripts.Add(strItemScript & strTemp) End If Next - Return lstNames + Return lstScripts End Function - '''-------------------------------------------------------------------------------------------- - ''' Adds R function/operation/command to the - ''' 'before' list. - ''' - ''' The R function/operation/command to add. - ''' (Optional) The relative position of the parameter in this - ''' object's 'before' list. - '''-------------------------------------------------------------------------------------------- - Public Sub AddToBeforeCodes(clsNewRCode As RCodeStructure, Optional iPosition As Integer = -1) - If Not BeforeCodesContain(clsNewRCode) Then - lstBeforeCodes.Add(clsNewRCode) - End If - lstBeforeCodes.Find(Function(x) x.Equals(clsNewRCode)).iPosition = iPosition - End Sub - - '''-------------------------------------------------------------------------------------------- - ''' Adds R function/operation/command to the - ''' 'after' list. - ''' - ''' The R function/operation/command to add. - ''' (Optional) The relative position of the parameter in this - ''' object's 'after' list. - '''-------------------------------------------------------------------------------------------- - Public Sub AddToAfterCodes(clsNewRCode As RCodeStructure, Optional iPosition As Integer = -1) - If Not AfterCodesContain(clsNewRCode) Then - lstAfterCodes.Add(clsNewRCode) - clsNewRCode.iPosition = iPosition 'TODO SJL 06/04/20 remove this line and the 'Else' (same as function above)? - Else - lstAfterCodes.Find(Function(x) x.Equals(clsNewRCode)).iPosition = iPosition - End If - End Sub - - '''-------------------------------------------------------------------------------------------- - ''' TODO SJL 06/04/20 This is a single line function on a public data member. - ''' I'm not sure what it adds. Remove? - ''' - ''' The cls new r code. - '''-------------------------------------------------------------------------------------------- - Public Sub RemoveFromBeforeCodes(clsNewRCode As RCodeStructure) - lstBeforeCodes.Remove(clsNewRCode) - End Sub - - '''-------------------------------------------------------------------------------------------- - ''' TODO SJL 06/04/20 This is a single line function on a public data member. - ''' I'm not sure what it adds. Remove?. - ''' - ''' The cls new r code. - '''-------------------------------------------------------------------------------------------- - Public Sub RemoveFromAfterCodes(clsNewRCode As RCodeStructure) - lstAfterCodes.Remove(clsNewRCode) - End Sub - - ''' Resets all the data members to default values. - Public Sub ClearCodes() - 'TODO SJL Some data members are not reset by this function. Add them? - lstBeforeCodes = New List(Of RCodeStructure) - lstAfterCodes = New List(Of RCodeStructure) - clsBaseFunction = New RFunction - clsBaseOperator = New ROperator - clsBaseCommandString = New RCodeStructure - strCommandString = "" - bUseBaseFunction = False - bUseBaseOperator = False - bUseCommandString = False - End Sub End Class \ No newline at end of file diff --git a/instat/dlgCalculationsSummary.vb b/instat/dlgCalculationsSummary.vb index be355c79b09..7ed156dd6ed 100644 --- a/instat/dlgCalculationsSummary.vb +++ b/instat/dlgCalculationsSummary.vb @@ -96,7 +96,7 @@ Public Class dlgCalculationsSummary For Each lviTemp As ListViewItem In lstCalculations.SelectedItems iIndex = lstCalculations.Items.IndexOf(lviTemp) lstCalculations.Items.Remove(lviTemp) - ucrBase.clsRsyntax.RemoveFromBeforeCodes(ucrBase.clsRsyntax.lstBeforeCodes.Find(Function(x) x.Tag = lviTemp.Text)) + ucrBase.clsRsyntax.RemoveFromBeforeCodes(ucrBase.clsRsyntax.GetBeforeCodes().Find(Function(x) x.Tag = lviTemp.Text)) dctCalculations.Remove(lviTemp.Text) Next End Sub @@ -139,7 +139,7 @@ Public Class dlgCalculationsSummary strCalcName = lstCalculations.SelectedItems(0).Text End If lstCalculations.SelectedItems(0).Text = strCalcName - clsApplyCalculation = ucrBase.clsRsyntax.lstBeforeCodes.Find(Function(x) x.Tag = strCalcName) + clsApplyCalculation = ucrBase.clsRsyntax.GetBeforeCodes().Find(Function(x) x.Tag = strCalcName) If clsSelectedCalculationFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "save") <> -1 AndAlso clsSelectedCalculationFunction.GetParameter("save").strArgumentValue = "2" Then clsApplyCalculation.iCallType = 0 clsApplyCalculation.AddParameter("display", "FALSE") diff --git a/instat/dlgDuplicateColumns.vb b/instat/dlgDuplicateColumns.vb index b69e0e7aded..449efa4c616 100644 --- a/instat/dlgDuplicateColumns.vb +++ b/instat/dlgDuplicateColumns.vb @@ -125,7 +125,7 @@ Public Class dlgDuplicateColumns Private Sub SetDefaults() clsDuplicateFunction = New RFunction clsConvertFunction = New RFunction - ucrBase.clsRsyntax.lstAfterCodes.Clear() + ucrBase.clsRsyntax.GetAfterCodes.Clear() ucrSelectorForDuplicateColumn.Reset() ucrSaveColumn.Reset() diff --git a/instat/dlgExportToClimsoft.vb b/instat/dlgExportToClimsoft.vb index 72c2faa3d8a..91876cd7eaf 100644 --- a/instat/dlgExportToClimsoft.vb +++ b/instat/dlgExportToClimsoft.vb @@ -171,7 +171,7 @@ Public Class dlgExportToClimsoft End Sub Private Sub ucrReceiverElements_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverElements.ControlValueChanged - ucrBase.clsRsyntax.lstBeforeCodes.Clear() + ucrBase.clsRsyntax.GetBeforeCodes().Clear() clsCurrentNewColumnFunction = ucrReceiverElements.GetVariables(True).Clone clsCurrentNewColumnFunction.SetAssignTo("columns") ucrBase.clsRsyntax.AddToBeforeCodes(clsCurrentNewColumnFunction) @@ -212,14 +212,14 @@ Public Class dlgExportToClimsoft cmdBrowse.Visible = True ElseIf ucrChkNewDataFrame.Checked AndAlso Not ucrChkExportDataFrame.Checked Then ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) - ucrBase.clsRsyntax.lstAfterCodes.Clear() + ucrBase.clsRsyntax.GetAfterCodes().Clear() cmdBrowse.Visible = False ElseIf ucrChkExportDataFrame.Checked AndAlso Not ucrChkNewDataFrame.Checked Then - ucrBase.clsRsyntax.lstBeforeCodes.Clear() + ucrBase.clsRsyntax.GetBeforeCodes().Clear() ucrBase.clsRsyntax.AddToBeforeCodes(clsCurrentNewColumnFunction) ucrBase.clsRsyntax.SetBaseRFunction(clsExportClimsoftFunction) - ucrBase.clsRsyntax.lstAfterCodes.Clear() + ucrBase.clsRsyntax.GetAfterCodes().Clear() cmdBrowse.Visible = True End If End Sub diff --git a/instat/dlgJitter.vb b/instat/dlgJitter.vb index 302ce59c5f0..448b89e180b 100644 --- a/instat/dlgJitter.vb +++ b/instat/dlgJitter.vb @@ -42,9 +42,9 @@ Public Class dlgJitter ucrReceiverJitter.SetMeAsReceiver() ucrReceiverJitter.strSelectorHeading = "Numerics" - ucrBase.clsRsyntax.SetOperation("+") + ucrBase.clsRsyntax.clsBaseOperator.SetOperation("+") clsRunif.SetRCommand("runif") - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRunif) + ucrBase.clsRsyntax.clsBaseOperator.AddParameter(clsRFunctionParameter:=clsRunif) 'ucrInputNewColumnName.SetItemsTypeAsColumns() 'ucrInputNewColumnName.SetDefaultTypeAsColumn() 'ucrInputNewColumnName.SetDataFrameSelector(ucrSelectorForJitter.ucrAvailableDataFrames) @@ -164,7 +164,7 @@ Public Class dlgJitter End Sub Private Sub ucrReceiverJitter_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverJitter.ControlValueChanged - ucrBase.clsRsyntax.SetOperatorParameter(1, clsRFunc:=ucrReceiverJitter.GetVariables) + ucrBase.clsRsyntax.clsBaseOperator.AddParameter(clsRFunctionParameter:=ucrReceiverJitter.GetVariables, iPosition:=1) End Sub diff --git a/instat/dlgModelling.vb b/instat/dlgModelling.vb index 112f49d6a00..9af0dd39c44 100644 --- a/instat/dlgModelling.vb +++ b/instat/dlgModelling.vb @@ -228,7 +228,16 @@ Public Class dlgModelling Private Sub assignToControlsChanged(ucrChangedControl As ucrCore) Handles ucrSaveResult.ControlValueChanged Dim strAssginTo As String - strAssginTo = ucrBase.clsRsyntax.GetstrAssignTo() + If ucrBase.clsRsyntax.bUseBaseFunction Then + strAssginTo = ucrBase.clsRsyntax.clsBaseFunction.GetRObjectToAssignTo() + ElseIf ucrBase.clsRsyntax.bUseBaseOperator Then + strAssginTo = ucrBase.clsRsyntax.clsBaseOperator.GetRObjectToAssignTo() + ElseIf ucrBase.clsRsyntax.bUseCommandString Then + strAssginTo = ucrBase.clsRsyntax.clsBaseCommandString.GetRObjectToAssignTo() + Else + strAssginTo = "" + End If + '--------------------------------------------------------------------- 'model summaries outputs diff --git a/instat/dlgRandomSubsets.vb b/instat/dlgRandomSubsets.vb index 024499229d5..77f40c69528 100644 --- a/instat/dlgRandomSubsets.vb +++ b/instat/dlgRandomSubsets.vb @@ -80,7 +80,7 @@ Public Class dlgRandomSubsets ucrSelectorRandomSubsets.Reset() ucrNewDataFrame.Reset() - ucrBase.clsRsyntax.lstBeforeCodes.Clear() + ucrBase.clsRsyntax.GetBeforeCodes().Clear() NewDefaultName() ReplaceParameters() diff --git a/instat/dlgRownamesOrNumbers.vb b/instat/dlgRownamesOrNumbers.vb index dee1a9c4e04..6c4028729a9 100644 --- a/instat/dlgRownamesOrNumbers.vb +++ b/instat/dlgRownamesOrNumbers.vb @@ -113,7 +113,7 @@ Public Class dlgRowNamesOrNumbers ucrNewColumnName.Reset() ucrSelectorRowNames.Reset() - ucrBase.clsRsyntax.lstAfterCodes.Clear() + ucrBase.clsRsyntax.GetAfterCodes().Clear() clsDummyFunction.AddParameter("checked_rdo", "copy_row", iPosition:=1) clsDummyFunction.AddParameter("add_key", "TRUE", iPosition:=2) diff --git a/instat/dlgShowModel.vb b/instat/dlgShowModel.vb index 476f8b47c2f..879bb8c8d14 100644 --- a/instat/dlgShowModel.vb +++ b/instat/dlgShowModel.vb @@ -268,8 +268,8 @@ Public Class dlgShowModel clsProbabilitiesFunction.AddParameter("return", Chr(34) & "plot" & Chr(34), iPosition:=9) ElseIf rdoValues.Checked Then cmdDistributionOptions.Enabled = False - ucrBase.clsRsyntax.RemoveOperatorParameter("1") - ucrBase.clsRsyntax.RemoveOperatorParameter("2") + ucrBase.clsRsyntax.clsBaseOperator.RemoveParameterByName("1") + ucrBase.clsRsyntax.clsBaseOperator.RemoveParameterByName("2") clsQuantilesFunction.AddParameter("return", Chr(34) & "values" & Chr(34), iPosition:=9) clsProbabilitiesFunction.AddParameter("return", Chr(34) & "values" & Chr(34), iPosition:=9) End If diff --git a/instat/dlgSummaryTables.vb b/instat/dlgSummaryTables.vb index 6224d2dbdc4..4c553f4f818 100644 --- a/instat/dlgSummaryTables.vb +++ b/instat/dlgSummaryTables.vb @@ -221,7 +221,7 @@ Public Class dlgSummaryTables ucrSelectorSummaryTables.Reset() ucrSaveTable.Reset() - ucrBase.clsRsyntax.lstBeforeCodes.Clear() + ucrBase.clsRsyntax.GetBeforeCodes().Clear() clsDummyFunction.AddParameter("theme", "select", iPosition:=11) clsDummyFunction.AddParameter("rdo_checked", "rdoFrequency", iPosition:=1) diff --git a/instat/dlgTransformText.vb b/instat/dlgTransformText.vb index b0d570247b6..d4559e71ce2 100644 --- a/instat/dlgTransformText.vb +++ b/instat/dlgTransformText.vb @@ -50,7 +50,6 @@ Public Class dlgTransformText Dim dctInputSeparator As New Dictionary(Of String, String) ucrBase.iHelpTopicID = 343 - ucrBase.clsRsyntax.bUseBaseFunction = True 'ucrReceiver ucrReceiverTransformText.SetParameter(New RParameter("string", 0)) diff --git a/instat/dlgTransposeColumns.vb b/instat/dlgTransposeColumns.vb index 0673dacc656..6dab56ea4cd 100644 --- a/instat/dlgTransposeColumns.vb +++ b/instat/dlgTransposeColumns.vb @@ -105,7 +105,7 @@ Public Class dlgTransposeColumns NewDefaultName() End Sub Private Sub ucrReceiverColumnsToTranspose_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverColumnsToTranspose.ControlValueChanged - ucrBase.clsRsyntax.lstBeforeCodes.Clear() + ucrBase.clsRsyntax.GetBeforeCodes().Clear() clsGetColumnNamesFunction = ucrReceiverColumnsToTranspose.GetVariables(True).Clone clsGetColumnNamesFunction.SetAssignTo("columns") ucrBase.clsRsyntax.AddToBeforeCodes(clsGetColumnNamesFunction) diff --git a/instat/dlgTwoVariableUseModel.vb b/instat/dlgTwoVariableUseModel.vb index 604c852e2f6..0f5e96ac92e 100644 --- a/instat/dlgTwoVariableUseModel.vb +++ b/instat/dlgTwoVariableUseModel.vb @@ -50,11 +50,11 @@ Public Class dlgTwoVariableUseModel 'autoplot function does not support glm/lm models ' sdgSimpleRegOptions.chkFittedModel.Enabled = False 'ucrBase.iHelpTopicID = - ucrBaseUseModel.clsRsyntax.SetOperation("+") + ucrBaseUseModel.clsRsyntax.clsBaseOperator.SetOperation("+") ucrReceiverUseModel.SetItemType(RObjectTypeLabel.Model) ucrReceiverUseModel.Selector = ucrSelectorUseModel clsRCommand.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_models") - ucrBaseUseModel.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRCommand) + ucrBaseUseModel.clsRsyntax.clsBaseOperator.AddParameter(clsRFunctionParameter:=clsRCommand, iPosition:=0) ucrModel.IsReadOnly = True ' sdgSimpleRegOptions.SetRModelFunction(clsRCommand) ucrReceiverUseModel.strSelectorHeading = "Models" diff --git a/instat/dlgUseModel.vb b/instat/dlgUseModel.vb index e0f328504e2..6cdefc38f12 100644 --- a/instat/dlgUseModel.vb +++ b/instat/dlgUseModel.vb @@ -256,7 +256,7 @@ Public Class dlgUseModel Dim strModel As String Dim item As ListViewItem - ucrBase.clsRsyntax.lstBeforeCodes.Clear() + ucrBase.clsRsyntax.GetBeforeCodes.Clear() clsGetModel.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_object_data") ucrInputModels.SetName("[No models selected]") strExpression = ucrReceiverForTestColumn.GetVariableNames(False) @@ -277,7 +277,7 @@ Public Class dlgUseModel End If 'Checking if the commandString contains the commands from the segmented ,davie and pscore buttons.If so Again check if the list of before codes contains the clsAttach function before adiing If Not (InStr(ucrBase.clsRsyntax.strCommandString, "segmented::segmented") = 0) Or Not (InStr(ucrBase.clsRsyntax.strCommandString, "segmented::davies.test") = 0) Or Not (InStr(ucrBase.clsRsyntax.strCommandString, "segmented::pscore.test") = 0) Then - If Not ucrBase.clsRsyntax.lstBeforeCodes.Contains(clsAttach) Then + If Not ucrBase.clsRsyntax.GetBeforeCodes().Contains(clsAttach) Then ucrBase.clsRsyntax.AddToBeforeCodes(clsAttach) End If diff --git a/instat/dlgWordwrap.vb b/instat/dlgWordwrap.vb index 7bf92ad9369..bbd8078145d 100644 --- a/instat/dlgWordwrap.vb +++ b/instat/dlgWordwrap.vb @@ -41,7 +41,6 @@ Public Class dlgWordwrap Dim dctInputSeparator As New Dictionary(Of String, String) ucrBase.iHelpTopicID = 343 - ucrBase.clsRsyntax.bUseBaseFunction = True 'ucrReceiver ucrReceiverWrapText.SetParameter(New RParameter("column_data", 2)) diff --git a/instat/sdgSimpleRegOptions.vb b/instat/sdgSimpleRegOptions.vb index 8d394f27537..80940c110e5 100644 --- a/instat/sdgSimpleRegOptions.vb +++ b/instat/sdgSimpleRegOptions.vb @@ -230,7 +230,7 @@ Public Class sdgSimpleRegOptions Dim clsTempParam As RParameter Dim lstPlots As New List(Of Integer) - For Each clsRCode As RCodeStructure In clsRSyntax.lstAfterCodes + For Each clsRCode As RCodeStructure In clsRSyntax.GetAfterCodes() clsTempFunc = TryCast(clsRCode, RFunction) If clsTempFunc IsNot Nothing AndAlso clsTempFunc.strRCommand = "plot" AndAlso clsTempFunc.ContainsParameter("which") Then clsTempParam = clsTempFunc.GetParameter("which") diff --git a/instat/ucrButtons.vb b/instat/ucrButtons.vb index 6ef25d4ec1c..382465192ed 100644 --- a/instat/ucrButtons.vb +++ b/instat/ucrButtons.vb @@ -146,7 +146,7 @@ Public Class ucrButtons 'Run additional before codes lstBeforeScripts = clsRsyntax.GetBeforeCodesScripts() lstBeforeCodes = clsRsyntax.GetBeforeCodes() - For i As Integer = 0 To clsRsyntax.lstBeforeCodes.Count - 1 + For i As Integer = 0 To lstBeforeCodes.Count - 1 If bFirstCode Then strComment = strComments bFirstCode = False @@ -173,10 +173,6 @@ Public Class ucrButtons frmMain.AddToScriptWindow(clsRsyntax.GetScript(), bMakeVisible:=bMakeVisibleScriptWindow, bAppendAtCurrentCursorPosition:=bAppendScriptsAtCurrentScriptWindowCursorPosition) End If - 'This clears the script after it has been run, but leave the function and parameters in the base function - 'so that it can be run exactly the same when reopened. - clsRsyntax.strScript = "" - 'Run additional after codes lstAfterScripts = clsRsyntax.GetAfterCodesScripts() lstAfterCodes = clsRsyntax.GetAfterCodes() diff --git a/instat/ucrTry.vb b/instat/ucrTry.vb index dbf965054fd..9d5422469fe 100644 --- a/instat/ucrTry.vb +++ b/instat/ucrTry.vb @@ -94,7 +94,7 @@ Public Class ucrTry ElseIf IsNothing(ucrReceiverScript) AndAlso CheckForEmptyInputControl() Then ucrInputTryMessage.SetName("") Else - For Each clsTempCode In clsRSyntax.lstBeforeCodes + For Each clsTempCode In clsRSyntax.GetBeforeCodes() Dim clsCodeClone As RCodeStructure = clsTempCode.Clone() Dim strBeforeAfterScript As String = "" Dim strBeforeAfterTemp As String = clsCodeClone.ToScript(strBeforeAfterScript) @@ -181,7 +181,7 @@ Public Class ucrTry AddButtonInTryTextBox() Finally lstScripts = New List(Of String) - For Each clsTempCode In clsRSyntax.lstAfterCodes + For Each clsTempCode In clsRSyntax.GetAfterCodes() Dim clsCodeClone As RCodeStructure = clsTempCode.Clone() Dim strBeforeAfterScript As String = "" Dim strBeforeAfterTemp As String = clsCodeClone.ToScript(strBeforeAfterScript) From 23c3add10d425bb0e157eb7a1bb8eb92d3e47525 Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Mon, 18 Mar 2024 12:24:22 +0300 Subject: [PATCH 22/88] changes --- instat/dlgTransform.vb | 307 +++++++++++++++++++++++++---------------- 1 file changed, 187 insertions(+), 120 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 9c4d4a34bee..3d673e4e3de 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -75,6 +75,8 @@ Public Class dlgTransform Private clsPowerColsOperator As New ROperator Private clsScaleSubtractOperator As New ROperator + Private clsScaleSubtractColsOperator As New ROperator + Private clsScaleMultiplyOperator As New ROperator Private clsScaleDivideOperator As New ROperator @@ -98,6 +100,8 @@ Public Class dlgTransform Private clsBooleanColsOperator As New ROperator Private clsAddColumnsFunction As New RFunction Private clsIsNAFunction As New RFunction + Private clsIsNAColsFunction As New RFunction + Private clsGetDataFrameFunction As New RFunction Private clsColumnsFunction As New RFunction Private clsPasteFunction As New RFunction @@ -148,8 +152,8 @@ Public Class dlgTransform ucrPnlTransformOptions.AddParameterValuesCondition(rdoNonNegative, "check", "non-negative") ucrPnlTransformOptions.AddParameterValuesCondition(rdoScale, "check", "scale") - ucrPnlColumnSelectOptions.AddParameterValuesCondition(rdoSingle, "checked", "single") - ucrPnlColumnSelectOptions.AddParameterValuesCondition(rdoMultiple, "checked", "multiple") + ucrPnlColumnSelectOptions.AddParameterValuesCondition(rdoSingle, "col", "single") + ucrPnlColumnSelectOptions.AddParameterValuesCondition(rdoMultiple, "col", "multiple") ucrReceiverRank.SetParameter(New RParameter("x", 0)) ucrReceiverRank.Selector = ucrSelectorForRank @@ -425,6 +429,7 @@ Public Class dlgTransform clsPasteFunction = New RFunction clsColumnsFunction = New RFunction clsAssignOperator = New ROperator + clsIsNAColsFunction = New RFunction ucrSelectorForRank.Reset() ucrReceiverRank.SetMeAsReceiver() @@ -601,6 +606,7 @@ Public Class dlgTransform clsScaleAddColsOperator.bBrackets = False clsBooleanColsOperator.SetOperation("==") + clsIsNAColsFunction.SetRCommand("is.na") clsGetDataFrameFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_data_frame") @@ -627,7 +633,8 @@ Public Class dlgTransform clsRemoveLabelsFunction.AddParameter("new_val", Chr(34) & Chr(34), iPosition:=3) clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) - clsDummyTransformFunction.AddParameter("checked", "single", iPosition:=1) + clsDummyTransformFunction.AddParameter("col", "single", iPosition:=1) + clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) @@ -678,10 +685,30 @@ Public Class dlgTransform ucrReceiverRank.AddAdditionalCodeParameterPair(clsIsNAFunction, New RParameter("x", 0), iAdditionalPairNo:=15) ucrReceiverRank.AddAdditionalCodeParameterPair(clsGetColSelectionNamesFunction, New RParameter("x", 0), iAdditionalPairNo:=16) ucrReceiverRank.AddAdditionalCodeParameterPair(clsLeadColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=17) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsSortColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=18) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsRoundColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=19) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsSignifColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=20) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsLagColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=21) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsLeadColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=22) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsDiffColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=23) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsMeanColsFunction, New RParameter("x", 0), iAdditionalPairNo:=24) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsSubtractColsOperator, New RParameter("x", 0), iAdditionalPairNo:=25) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsStandardDevColsFunction, New RParameter("x", 0), iAdditionalPairNo:=26) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsRankColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=27) + + ucrReceiverRank.AddAdditionalCodeParameterPair(clsAddConstantColsOperator, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=28) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleSubtractColsOperator, New RParameter("x", 0), iAdditionalPairNo:=29) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleMeanColsFunction, New RParameter("x", 0), iAdditionalPairNo:=30) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleMinColsFunction, New RParameter("x", 0), iAdditionalPairNo:=31) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsBooleanColsOperator, New RParameter("x", 0), iAdditionalPairNo:=32) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsIsNAColsFunction, New RParameter("x", 0), iAdditionalPairNo:=33) + ucrChkOmitNA.AddAdditionalCodeParameterPair(clsStandardDevFunction, ucrChkOmitNA.GetParameter(), iAdditionalPairNo:=1) ucrSelectorForRank.AddAdditionalCodeParameterPair(clsGetColSelectionNamesFunction, ucrSelectorForRank.GetParameter, iAdditionalPairNo:=1) ucrNudRoundOfDigits.AddAdditionalCodeParameterPair(clsRoundColsFunction, New RParameter("digits", 1), iAdditionalPairNo:=1) + ucrChkOmitNA.AddAdditionalCodeParameterPair(clsMeanColsFunction, ucrChkOmitNA.GetParameter(), iAdditionalPairNo:=2) + ucrChkOmitNA.AddAdditionalCodeParameterPair(clsStandardDevColsFunction, ucrChkOmitNA.GetParameter(), iAdditionalPairNo:=3) ucrSaveNew.AddAdditionalRCode(clsLeadFunction, iAdditionalPairNo:=1) ucrSaveNew.AddAdditionalRCode(clsLagFunction, iAdditionalPairNo:=2) @@ -737,7 +764,7 @@ Public Class dlgTransform ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete) End If Else - ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete) + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty()) End If End Sub @@ -781,127 +808,127 @@ Public Class dlgTransform ucrChkMissingLast.ControlValueChanged, ucrChkDecreasing.ControlValueChanged, ucrChkDivide.ControlValueChanged, ucrChkAdd.ControlValueChanged, ucrChkMultiply.ControlValueChanged, ucrChkSubtract.ControlValueChanged ucrBase.clsRsyntax.ClearCodes() + If bResetRCode Then - If rdoSingle.Checked Then + If rdoSingle.Checked Then - ' If bResetRCode Then - If rdoRank.Checked Then - clsPreviewTextFunction = clsRankFunction.Clone - clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsRankFunction) - ucrBase.clsRsyntax.RemoveFromAfterCodes(clsRemoveLabelsFunction) - ElseIf rdoSort.Checked Then - clsPreviewTextFunction = clsSortFunction.Clone - clsDummyTransformFunction.AddParameter("check", "sort", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsSortFunction) - ucrBase.clsRsyntax.RemoveFromAfterCodes(clsRemoveLabelsFunction) - ElseIf rdoNumeric.Checked Then - clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) - If rdoRoundOf.Checked Then - clsPreviewTextFunction = clsRoundFunction.Clone - clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsRoundFunction) - ElseIf rdoSignificantDigits.Checked Then - clsPreviewTextFunction = clsSignifFunction.Clone - clsNumericDummyFunction.AddParameter("check", "signif", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsSignifFunction) - ElseIf rdoLag.Checked Then - clsPreviewTextFunction = clsLagFunction.Clone - clsNumericDummyFunction.AddParameter("check", "lag", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsLagFunction) - ElseIf rdoLead.Checked Then - clsPreviewTextFunction = clsLeadFunction.Clone - clsNumericDummyFunction.AddParameter("check", "lead", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsLeadFunction) - ElseIf rdoDifference.Checked Then - clsPreviewTextFunction = clsConcDiffFunction.Clone - clsNumericDummyFunction.AddParameter("check", "diff", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsConcDiffFunction) - ElseIf rdoStandardize.Checked Then - clsPreviewTextFunction = clsDivisionOperator.Clone - clsNumericDummyFunction.AddParameter("check", "standardise", iPosition:=0) - ucrBase.clsRsyntax.SetBaseROperator(clsDivisionOperator) - ElseIf rdoLogical.Checked Then - clsNumericDummyFunction.AddParameter("check", "logical", iPosition:=0) - clsPreviewTextFunction = clsBooleanOperator.Clone - ucrBase.clsRsyntax.SetBaseROperator(clsBooleanOperator) - Select Case ucrInputLogicOperations.GetText - Case "==" - clsBooleanOperator.SetOperation("==") - Case "<" - clsBooleanOperator.SetOperation("<") - Case "<=" - clsBooleanOperator.SetOperation("<=") - Case ">" - clsBooleanOperator.SetOperation(">") - Case ">=" - clsBooleanOperator.SetOperation(">=") - Case "!=" - clsBooleanOperator.SetOperation("!=") - Case "%in%" - clsBooleanOperator.SetOperation("%in%") - Case "is.na" - clsIsNAFunction.SetRCommand("is.na") - clsPreviewTextFunction = clsIsNAFunction.Clone - ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) - Case "!is.na" - clsIsNAFunction.SetRCommand("!is.na") - clsPreviewTextFunction = clsIsNAFunction.Clone - ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) - End Select - End If - ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) - ElseIf rdoNonNegative.Checked Then - UpdateConstantParameter() - clsDummyTransformFunction.AddParameter("check", "non-negative", iPosition:=0) - If rdoSquareRoot.Checked Then - clsPreviewTextFunction = clsSquarerootFunction.Clone - ucrBase.clsRsyntax.SetBaseRFunction(clsSquarerootFunction) - clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) - ElseIf rdoPower.Checked Then - clsPreviewTextFunction = clsPowerOperator.Clone - clsNonNegativeDummyFunction.AddParameter("check", "power", iPosition:=0) - ucrBase.clsRsyntax.SetBaseROperator(clsPowerOperator) - ElseIf rdoLogToBase10.Checked Then - clsPreviewTextFunction = clsLogBase10Function.Clone - clsNonNegativeDummyFunction.AddParameter("check", "log10", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsLogBase10Function) - ElseIf rdoNaturalLog.Checked Then - clsPreviewTextFunction = clsNaturalLogFunction.Clone - clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsNaturalLogFunction) + If rdoRank.Checked Then + clsPreviewTextFunction = clsRankFunction.Clone + clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsRankFunction) + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsRemoveLabelsFunction) + ElseIf rdoSort.Checked Then + clsPreviewTextFunction = clsSortFunction.Clone + clsDummyTransformFunction.AddParameter("check", "sort", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsSortFunction) + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsRemoveLabelsFunction) + ElseIf rdoNumeric.Checked Then + clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) + If rdoRoundOf.Checked Then + clsPreviewTextFunction = clsRoundFunction.Clone + clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsRoundFunction) + ElseIf rdoSignificantDigits.Checked Then + clsPreviewTextFunction = clsSignifFunction.Clone + clsNumericDummyFunction.AddParameter("check", "signif", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsSignifFunction) + ElseIf rdoLag.Checked Then + clsPreviewTextFunction = clsLagFunction.Clone + clsNumericDummyFunction.AddParameter("check", "lag", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsLagFunction) + ElseIf rdoLead.Checked Then + clsPreviewTextFunction = clsLeadFunction.Clone + clsNumericDummyFunction.AddParameter("check", "lead", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsLeadFunction) + ElseIf rdoDifference.Checked Then + clsPreviewTextFunction = clsConcDiffFunction.Clone + clsNumericDummyFunction.AddParameter("check", "diff", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsConcDiffFunction) + ElseIf rdoStandardize.Checked Then + clsPreviewTextFunction = clsDivisionOperator.Clone + clsNumericDummyFunction.AddParameter("check", "standardise", iPosition:=0) + ucrBase.clsRsyntax.SetBaseROperator(clsDivisionOperator) + ElseIf rdoLogical.Checked Then + clsNumericDummyFunction.AddParameter("check", "logical", iPosition:=0) + clsPreviewTextFunction = clsBooleanOperator.Clone + ucrBase.clsRsyntax.SetBaseROperator(clsBooleanOperator) + Select Case ucrInputLogicOperations.GetText + Case "==" + clsBooleanOperator.SetOperation("==") + Case "<" + clsBooleanOperator.SetOperation("<") + Case "<=" + clsBooleanOperator.SetOperation("<=") + Case ">" + clsBooleanOperator.SetOperation(">") + Case ">=" + clsBooleanOperator.SetOperation(">=") + Case "!=" + clsBooleanOperator.SetOperation("!=") + Case "%in%" + clsBooleanOperator.SetOperation("%in%") + Case "is.na" + clsIsNAFunction.SetRCommand("is.na") + clsPreviewTextFunction = clsIsNAFunction.Clone + ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) + Case "!is.na" + clsIsNAFunction.SetRCommand("!is.na") + clsPreviewTextFunction = clsIsNAFunction.Clone + ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) + End Select + End If + ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) + ElseIf rdoNonNegative.Checked Then + UpdateConstantParameter() + clsDummyTransformFunction.AddParameter("check", "non-negative", iPosition:=0) + If rdoSquareRoot.Checked Then + clsPreviewTextFunction = clsSquarerootFunction.Clone + ucrBase.clsRsyntax.SetBaseRFunction(clsSquarerootFunction) + clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) + ElseIf rdoPower.Checked Then + clsPreviewTextFunction = clsPowerOperator.Clone + clsNonNegativeDummyFunction.AddParameter("check", "power", iPosition:=0) + ucrBase.clsRsyntax.SetBaseROperator(clsPowerOperator) + ElseIf rdoLogToBase10.Checked Then + clsPreviewTextFunction = clsLogBase10Function.Clone + clsNonNegativeDummyFunction.AddParameter("check", "log10", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsLogBase10Function) + ElseIf rdoNaturalLog.Checked Then + clsPreviewTextFunction = clsNaturalLogFunction.Clone + clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsNaturalLogFunction) + End If + ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) + ElseIf rdoScale.Checked Then + clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) + clsPreviewTextFunction = clsScaleAddOperator.Clone + ucrBase.clsRsyntax.SetBaseROperator(clsScaleAddOperator) + ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) End If - ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) - ElseIf rdoScale.Checked Then - clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) - clsPreviewTextFunction = clsScaleAddOperator.Clone - ucrBase.clsRsyntax.SetBaseROperator(clsScaleAddOperator) - ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) + 'End If + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAssignOperator) + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddColumnsFunction) + + 'clsDummyTransformFunction.AddParameter("checked", "single", iPosition:=1) + 'ucrReceiverRank.bUseFilteredData = False + 'ucrReceiverRank.SetParameterIsRFunction() + 'ucrSelectorForRank.SetItemType("column") + 'ucrReceiverRank.strSelectorHeading = "Numerics" + 'lblSelectColumns.Text = "Column:" + Else + LoopsParameters() + ucrBase.clsRsyntax.ClearCodes() + ucrBase.clsRsyntax.SetAssignTo("col") + ucrBase.clsRsyntax.AddToAfterCodes(clsPipeOperator, 0) + ucrBase.clsRsyntax.AddToAfterCodes(clsAssignOperator, 1) + ucrBase.clsRsyntax.AddToAfterCodes(clsAddColumnsFunction, 2) + + 'clsDummyTransformFunction.AddParameter("checked", "multiple", iPosition:=1) + 'ucrSelectorForRank.SetItemType("column_selection") + 'ucrReceiverRank.strSelectorHeading = "Column selections" + 'lblSelectColumns.Text = "Select:" End If - 'End If - ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAssignOperator) - ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddColumnsFunction) - - clsDummyTransformFunction.AddParameter("checked", "single", iPosition:=1) - ucrReceiverRank.bUseFilteredData = False - ucrReceiverRank.SetParameterIsRFunction() - ucrSelectorForRank.SetItemType("column") - ucrReceiverRank.strSelectorHeading = "Numerics" - lblSelectColumns.Text = "Column:" - Else - LoopsParameters() - ucrBase.clsRsyntax.ClearCodes() - ucrBase.clsRsyntax.SetAssignTo("col") - ucrBase.clsRsyntax.AddToAfterCodes(clsPipeOperator, 0) - ucrBase.clsRsyntax.AddToAfterCodes(clsAssignOperator, 1) - ucrBase.clsRsyntax.AddToAfterCodes(clsAddColumnsFunction, 2) - - clsDummyTransformFunction.AddParameter("checked", "multiple", iPosition:=1) - ucrSelectorForRank.SetItemType("column_selection") - ucrReceiverRank.strSelectorHeading = "Column selections" - lblSelectColumns.Text = "Select:" End If - SetPreviewText() UpdateNonNegativeParameters() NewDefaultName() @@ -967,7 +994,34 @@ Public Class dlgTransform clsBooleanColsOperator.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) 'clsTildaOperator.AddParameter("sig", clsROperatorParameter:=clsBooleanColsOperator, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsBooleanColsOperator, bIncludeArgumentName:=False) + Select Case ucrInputLogicOperations.GetText + Case "==" + clsBooleanColsOperator.SetOperation("==") + Case "<" + clsBooleanColsOperator.SetOperation("<") + Case "<=" + clsBooleanColsOperator.SetOperation("<=") + Case ">" + clsBooleanColsOperator.SetOperation(">") + Case ">=" + clsBooleanColsOperator.SetOperation(">=") + Case "!=" + clsBooleanColsOperator.SetOperation("!=") + Case "%in%" + clsBooleanColsOperator.SetOperation("%in%") + Case "is.na" + clsIsNAColsFunction.SetRCommand("is.na") + clsPreviewTextFunction = clsIsNAFunction.Clone + ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) + Case "!is.na" + clsIsNAFunction.SetRCommand("!is.na") + clsPreviewTextFunction = clsIsNAFunction.Clone + ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) + End Select End If + ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) + + ElseIf rdoNonNegative.Checked Then clsDummyTransformFunction.AddParameter("check", "non-negative", iPosition:=0) If rdoSquareRoot.Checked Then @@ -1122,5 +1176,18 @@ Public Class dlgTransform clsAddColumnsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRank.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + If rdoMultiple.Checked Then + clsDummyTransformFunction.AddParameter("col", "multiple", iPosition:=0) + ucrSelectorForRank.SetItemType("column_selection") + ucrReceiverRank.strSelectorHeading = "Column selections" + lblSelectColumns.Text = "Select:" + ElseIf rdoSingle.Checked Then + clsDummyTransformFunction.AddParameter("col", "single", iPosition:=0) + 'ucrReceiverRank.bUseFilteredData = False + 'ucrReceiverRank.SetParameterIsRFunction() + ucrSelectorForRank.SetItemType("column") + ucrReceiverRank.strSelectorHeading = "Numerics" + lblSelectColumns.Text = "Column:" + End If End Sub End Class \ No newline at end of file From 5147f028d77708c6dbd0534c9cc111cbc3588a08 Mon Sep 17 00:00:00 2001 From: Stephen Lloyd Date: Mon, 18 Mar 2024 11:04:52 +0100 Subject: [PATCH 23/88] further refactoring of RSyntax --- instat/clsRSyntax.vb | 90 +++++++++++++++----------------------------- instat/ucrButtons.vb | 4 +- 2 files changed, 32 insertions(+), 62 deletions(-) diff --git a/instat/clsRSyntax.vb b/instat/clsRSyntax.vb index ae95b7b9be1..38973426cfb 100644 --- a/instat/clsRSyntax.vb +++ b/instat/clsRSyntax.vb @@ -211,21 +211,6 @@ Public Class RSyntax Return lstAfterCodes End Function - '''-------------------------------------------------------------------------------------------- - ''' Returns the list of scripts associated with the list of 'after' R - ''' functions/operators/commands (i.e. the ones that run after the base R code). - ''' If a list object is flagged to exclude the script's output, and the output has - ''' already been assigned, then the list object's script does not include the output - ''' part. - ''' - ''' The list of scripts associated with the list of 'after' R - ''' functions/operators/commands. - '''-------------------------------------------------------------------------------------------- - Public Function GetAfterCodesScripts() As List(Of String) - lstAfterCodes.Sort(AddressOf CompareCodePositions) - Return GetScriptsFromCodeList(lstAfterCodes) - End Function - '''-------------------------------------------------------------------------------------------- ''' Adds this object and its associated assign script to ''' and respectively. @@ -268,21 +253,6 @@ Public Class RSyntax Return lstBeforeCodes End Function - '''-------------------------------------------------------------------------------------------- - ''' Returns the list of scripts associated with the list of 'before' R - ''' functions/operators/commands (i.e. the ones that run before the base R code). - ''' If a list object is flagged to exclude the script's output, and the output has - ''' already been assigned, then the list object's script does not include the output - ''' part. - ''' - ''' The list of scripts associated with the list of 'before' R - ''' functions/operators/commands. - '''-------------------------------------------------------------------------------------------- - Public Function GetBeforeCodesScripts() As List(Of String) - lstBeforeCodes.Sort(AddressOf CompareCodePositions) - Return GetScriptsFromCodeList(lstBeforeCodes) - End Function - '''-------------------------------------------------------------------------------------------- ''' Returns all the function names in the 'before' and 'after' lists. If this object ''' is an R function then also return the name of this function. @@ -343,6 +313,36 @@ Public Class RSyntax Return strScript & strTemp End Function + '''-------------------------------------------------------------------------------------------- + ''' Returns the list of scripts associated with the + ''' list of R functions/operators/commands. + ''' If a list object is flagged to exclude the script's output, and the output has + ''' already been assigned, then the list object's script does not include the output + ''' part. + ''' + ''' The list of R functions/operators/commands. + ''' + ''' list of scripts associated with the + ''' list of R functions/operators/commands. + '''-------------------------------------------------------------------------------------------- + Public Function GetScriptsFromCodeList(lstCodes As List(Of RCodeStructure)) As List(Of String) + Dim strItemScript As String + Dim strTemp As String + Dim lstScripts As New List(Of String) + + For Each clsTempCode In lstCodes + strItemScript = "" + strTemp = clsTempCode.ToScript(strItemScript) + 'Sometimes the output of the R-command we deal with should not be part of the script... + If clsTempCode.bExcludeAssignedFunctionOutput AndAlso Not String.IsNullOrEmpty(clsTempCode.GetRObjectToAssignTo) Then + lstScripts.Add(strItemScript) + Else + lstScripts.Add(strItemScript & strTemp) + End If + Next + Return lstScripts + End Function + '''-------------------------------------------------------------------------------------------- ''' Resets all the 'AssignTo' variables. ''' String variables are set to "". @@ -499,34 +499,4 @@ Public Class RSyntax End If End Function - '''-------------------------------------------------------------------------------------------- - ''' Returns the list of scripts associated with the - ''' list of R functions/operators/commands. - ''' If a list object is flagged to exclude the script's output, and the output has - ''' already been assigned, then the list object's script does not include the output - ''' part. - ''' - ''' The list of R functions/operators/commands. - ''' - ''' list of scripts associated with the - ''' list of R functions/operators/commands. - '''-------------------------------------------------------------------------------------------- - Private Function GetScriptsFromCodeList(lstCodes As List(Of RCodeStructure)) As List(Of String) - Dim strItemScript As String - Dim strTemp As String - Dim lstScripts As New List(Of String) - - For Each clsTempCode In lstCodes - strItemScript = "" - strTemp = clsTempCode.ToScript(strItemScript) - 'Sometimes the output of the R-command we deal with should not be part of the script... - If clsTempCode.bExcludeAssignedFunctionOutput AndAlso Not String.IsNullOrEmpty(clsTempCode.GetRObjectToAssignTo) Then - lstScripts.Add(strItemScript) - Else - lstScripts.Add(strItemScript & strTemp) - End If - Next - Return lstScripts - End Function - End Class \ No newline at end of file diff --git a/instat/ucrButtons.vb b/instat/ucrButtons.vb index 382465192ed..9406a8b3535 100644 --- a/instat/ucrButtons.vb +++ b/instat/ucrButtons.vb @@ -144,8 +144,8 @@ Public Class ucrButtons clsRsyntax.GetAllAssignTo(lstAssignToCodes, lstAssignToStrings) 'Run additional before codes - lstBeforeScripts = clsRsyntax.GetBeforeCodesScripts() lstBeforeCodes = clsRsyntax.GetBeforeCodes() + lstBeforeScripts = clsRsyntax.GetScriptsFromCodeList(lstBeforeCodes) For i As Integer = 0 To lstBeforeCodes.Count - 1 If bFirstCode Then strComment = strComments @@ -174,8 +174,8 @@ Public Class ucrButtons End If 'Run additional after codes - lstAfterScripts = clsRsyntax.GetAfterCodesScripts() lstAfterCodes = clsRsyntax.GetAfterCodes() + lstAfterScripts = clsRsyntax.GetScriptsFromCodeList(lstAfterCodes) For i As Integer = 0 To lstAfterCodes.Count - 1 If bRun Then If bFirstCode Then From 7d93a20a39ea12fcdc6219ae6a82d169e231f1ac Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Mon, 18 Mar 2024 13:47:37 +0100 Subject: [PATCH 24/88] Code Changes --- instat/dlgTransform.vb | 314 +++++++++++++++++------------------------ 1 file changed, 128 insertions(+), 186 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 3d673e4e3de..d444cef62be 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -20,74 +20,54 @@ Public Class dlgTransform Public bFirstLoad As Boolean = True Private bReset As Boolean = True Private clsRankFunction As New RFunction - Private clsRankColsFunction As New RFunction - Private clsSortFunction As New RFunction - Private clsSortColsFunction As New RFunction - Private clsRoundFunction As New RFunction - Private clsRoundColsFunction As New RFunction - Private clsSignifFunction As New RFunction - Private clsSignifColsFunction As New RFunction - Private clsLagFunction As New RFunction - Private clsLagColsFunction As New RFunction - Private clsLeadFunction As New RFunction - Private clsLeadColsFunction As New RFunction - Private clsDiffFunction As New RFunction - Private clsDiffColsFunction As New RFunction - Private clsConcDiffFunction As New RFunction - Private clsConcDiffColsFunction As New RFunction - Private clsReplicateFunction As New RFunction - Private clsReplicateColsFunction As New RFunction - Private clsMeanFunction As New RFunction - Private clsMeanColsFunction As New RFunction - Private clsStandardDevFunction As New RFunction - Private clsStandardDevColsFunction As New RFunction - Private clsSubtractOperator As New ROperator - Private clsSubtractColsOperator As New ROperator - Private clsDivisionOperator As New ROperator Private clsDivisionColsOperator As New ROperator - Private clsSquarerootFunction As New RFunction + Private clsSubtractColsOperator As New ROperator Private clsSquarerootColsFunction As New RFunction - Private clsAddConstantOperator As New ROperator Private clsAddConstantColsOperator As New ROperator Private clsNaturalLogFunction As New RFunction Private clsNaturalLogColsFunction As New RFunction - + Private clsLagColsFunction As New RFunction + Private clsRankColsFunction As New RFunction Private clsLogBase10Function As New RFunction Private clsLogBase10ColsFunction As New RFunction + Private clsStandardDevColsFunction As New RFunction + Private clsMeanColsFunction As New RFunction + Private clsReplicateColsFunction As New RFunction + Private clsConcDiffColsFunction As New RFunction + Private clsDiffColsFunction As New RFunction + Private clsLeadColsFunction As New RFunction + Private clsSignifColsFunction As New RFunction + Private clsRoundColsFunction As New RFunction + Private clsSortColsFunction As New RFunction + Private clsPowerColsOperator As New ROperator + Private clsScaleSubtractColsOperator As New ROperator + Private clsScaleAddColsOperator As New ROperator + Private clsScaleMeanColsFunction As New RFunction + Private clsScaleMinColsFunction As New RFunction Private clsRemoveLabelsFunction As New RFunction Private clsPowerOperator As New ROperator - Private clsPowerColsOperator As New ROperator - Private clsScaleSubtractOperator As New ROperator - Private clsScaleSubtractColsOperator As New ROperator - Private clsScaleMultiplyOperator As New ROperator Private clsScaleDivideOperator As New ROperator - Private clsScaleAddOperator As New ROperator - Private clsScaleAddColsOperator As New ROperator - Private clsScaleMeanFunction As New RFunction - Private clsScaleMeanColsFunction As New RFunction - Private clsScaleMinFunction As New RFunction - Private clsScaleMinColsFunction As New RFunction Private clsPreviewOperator As New ROperator Private clsDummyTransformFunction As New RFunction @@ -569,12 +549,12 @@ Public Class dlgTransform clsDivisionColsOperator.AddParameter("x", clsROperatorParameter:=clsSubtractColsOperator, iPosition:=0) clsDivisionColsOperator.AddParameter("y", clsRFunctionParameter:=clsStandardDevColsFunction, iPosition:=1) - clsSquarerootFunction.SetRCommand("sqrt") + clsSquarerootColsFunction.SetRCommand("~sqrt") clsAddConstantColsOperator.SetOperation("+") clsAddConstantColsOperator.AddParameter("c", "0", iPosition:=1) - clsNaturalLogColsFunction.SetRCommand("log") + clsNaturalLogColsFunction.SetRCommand("~log") clsLogBase10ColsFunction.SetRCommand("~log10") @@ -709,7 +689,10 @@ Public Class dlgTransform ucrNudRoundOfDigits.AddAdditionalCodeParameterPair(clsRoundColsFunction, New RParameter("digits", 1), iAdditionalPairNo:=1) ucrChkOmitNA.AddAdditionalCodeParameterPair(clsMeanColsFunction, ucrChkOmitNA.GetParameter(), iAdditionalPairNo:=2) ucrChkOmitNA.AddAdditionalCodeParameterPair(clsStandardDevColsFunction, ucrChkOmitNA.GetParameter(), iAdditionalPairNo:=3) - + ucrPnlTies.AddAdditionalCodeParameterPair(clsRankColsFunction, New RParameter("ties.method", 1), iAdditionalPairNo:=1) + ucrPnlMissingValues.AddAdditionalCodeParameterPair(clsRankColsFunction, New RParameter("na.last", 2), iAdditionalPairNo:=1) + ucrChkMissingLast.AddAdditionalCodeParameterPair(clsSortColsFunction, New RParameter("na.last", 1), iAdditionalPairNo:=1) + ucrChkDecreasing.AddAdditionalCodeParameterPair(clsSortColsFunction, New RParameter("decreasing", 2), iAdditionalPairNo:=1) ucrSaveNew.AddAdditionalRCode(clsLeadFunction, iAdditionalPairNo:=1) ucrSaveNew.AddAdditionalRCode(clsLagFunction, iAdditionalPairNo:=2) ucrSaveNew.AddAdditionalRCode(clsSignifFunction, iAdditionalPairNo:=3) @@ -725,11 +708,9 @@ Public Class dlgTransform ucrSaveNew.AddAdditionalRCode(clsPreviewOperator, iAdditionalPairNo:=13) ucrSaveNew.AddAdditionalRCode(clsBooleanOperator, iAdditionalPairNo:=14) ucrSaveNew.AddAdditionalRCode(clsIsNAFunction, iAdditionalPairNo:=15) - 'ucrSaveNew.AddAdditionalRCode(clsPipeOperator, iAdditionalPairNo:=16) ucrPnlTransformOptions.SetRCode(clsDummyTransformFunction, bReset) ucrPnlColumnSelectOptions.SetRCode(clsDummyTransformFunction, bReset) - ucrReceiverRank.SetRCode(clsRankFunction, bReset) ucrChkDecreasing.SetRCode(clsSortFunction, bReset) ucrChkMissingLast.SetRCode(clsSortFunction, bReset) ucrSaveNew.SetRCode(clsRoundFunction, bReset) @@ -752,7 +733,9 @@ Public Class dlgTransform ucrChkOmitNA.SetRCode(clsMeanFunction, bReset) ucrChkPreview.SetRCode(clsConstantDummyFunction, bReset) - + If bReset Then + ucrReceiverRank.SetRCode(clsRankFunction, bReset) + End If bResetRCode = True End Sub @@ -769,25 +752,13 @@ Public Class dlgTransform End Sub Private Sub NewDefaultName() - Dim strColNames As String - If rdoNumeric.Checked Then - strColNames = "Numeric" - ElseIf rdoNonNegative.Checked Then - strColNames = "NonNumeric" - ElseIf rdoRank.Checked Then - strColNames = "Rank" - ElseIf rdoScale.Checked Then - strColNames = "sort" - ElseIf rdoScale.Checked Then - strColNames = "scale" - End If If rdoSingle.Checked Then If (Not ucrSaveNew.bUserTyped) AndAlso Not ucrReceiverRank.IsEmpty Then ucrSaveNew.SetPrefix(ucrReceiverRank.GetVariableNames(bWithQuotes:=False)) End If ElseIf rdoMultiple.Checked Then If Not ucrReceiverRank.IsEmpty Then - clsPasteFunction.AddParameter("col_data", Chr(34) & "_" & strColNames & Chr(34), iPosition:=1, bIncludeArgumentName:=False) + clsPasteFunction.AddParameter("col_data", Chr(34) & "_" & "transformed" & Chr(34), iPosition:=1, bIncludeArgumentName:=False) clsAddColumnsFunction.AddParameter("col_data", "col", iPosition:=1) End If @@ -808,127 +779,117 @@ Public Class dlgTransform ucrChkMissingLast.ControlValueChanged, ucrChkDecreasing.ControlValueChanged, ucrChkDivide.ControlValueChanged, ucrChkAdd.ControlValueChanged, ucrChkMultiply.ControlValueChanged, ucrChkSubtract.ControlValueChanged ucrBase.clsRsyntax.ClearCodes() - If bResetRCode Then + 'If bResetRCode Then - If rdoSingle.Checked Then + If rdoSingle.Checked Then - If rdoRank.Checked Then - clsPreviewTextFunction = clsRankFunction.Clone - clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsRankFunction) - ucrBase.clsRsyntax.RemoveFromAfterCodes(clsRemoveLabelsFunction) - ElseIf rdoSort.Checked Then - clsPreviewTextFunction = clsSortFunction.Clone - clsDummyTransformFunction.AddParameter("check", "sort", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsSortFunction) - ucrBase.clsRsyntax.RemoveFromAfterCodes(clsRemoveLabelsFunction) - ElseIf rdoNumeric.Checked Then - clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) - If rdoRoundOf.Checked Then - clsPreviewTextFunction = clsRoundFunction.Clone - clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsRoundFunction) - ElseIf rdoSignificantDigits.Checked Then - clsPreviewTextFunction = clsSignifFunction.Clone - clsNumericDummyFunction.AddParameter("check", "signif", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsSignifFunction) - ElseIf rdoLag.Checked Then - clsPreviewTextFunction = clsLagFunction.Clone - clsNumericDummyFunction.AddParameter("check", "lag", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsLagFunction) - ElseIf rdoLead.Checked Then - clsPreviewTextFunction = clsLeadFunction.Clone - clsNumericDummyFunction.AddParameter("check", "lead", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsLeadFunction) - ElseIf rdoDifference.Checked Then - clsPreviewTextFunction = clsConcDiffFunction.Clone - clsNumericDummyFunction.AddParameter("check", "diff", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsConcDiffFunction) - ElseIf rdoStandardize.Checked Then - clsPreviewTextFunction = clsDivisionOperator.Clone - clsNumericDummyFunction.AddParameter("check", "standardise", iPosition:=0) - ucrBase.clsRsyntax.SetBaseROperator(clsDivisionOperator) - ElseIf rdoLogical.Checked Then - clsNumericDummyFunction.AddParameter("check", "logical", iPosition:=0) - clsPreviewTextFunction = clsBooleanOperator.Clone - ucrBase.clsRsyntax.SetBaseROperator(clsBooleanOperator) - Select Case ucrInputLogicOperations.GetText - Case "==" - clsBooleanOperator.SetOperation("==") - Case "<" - clsBooleanOperator.SetOperation("<") - Case "<=" - clsBooleanOperator.SetOperation("<=") - Case ">" - clsBooleanOperator.SetOperation(">") - Case ">=" - clsBooleanOperator.SetOperation(">=") - Case "!=" - clsBooleanOperator.SetOperation("!=") - Case "%in%" - clsBooleanOperator.SetOperation("%in%") - Case "is.na" - clsIsNAFunction.SetRCommand("is.na") - clsPreviewTextFunction = clsIsNAFunction.Clone - ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) - Case "!is.na" - clsIsNAFunction.SetRCommand("!is.na") - clsPreviewTextFunction = clsIsNAFunction.Clone - ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) - End Select - End If - ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) - ElseIf rdoNonNegative.Checked Then - UpdateConstantParameter() - clsDummyTransformFunction.AddParameter("check", "non-negative", iPosition:=0) - If rdoSquareRoot.Checked Then - clsPreviewTextFunction = clsSquarerootFunction.Clone - ucrBase.clsRsyntax.SetBaseRFunction(clsSquarerootFunction) - clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) - ElseIf rdoPower.Checked Then - clsPreviewTextFunction = clsPowerOperator.Clone - clsNonNegativeDummyFunction.AddParameter("check", "power", iPosition:=0) - ucrBase.clsRsyntax.SetBaseROperator(clsPowerOperator) - ElseIf rdoLogToBase10.Checked Then - clsPreviewTextFunction = clsLogBase10Function.Clone - clsNonNegativeDummyFunction.AddParameter("check", "log10", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsLogBase10Function) - ElseIf rdoNaturalLog.Checked Then - clsPreviewTextFunction = clsNaturalLogFunction.Clone - clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsNaturalLogFunction) - End If - ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) - ElseIf rdoScale.Checked Then - clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) - clsPreviewTextFunction = clsScaleAddOperator.Clone - ucrBase.clsRsyntax.SetBaseROperator(clsScaleAddOperator) - ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) + If rdoRank.Checked Then + clsPreviewTextFunction = clsRankFunction.Clone + clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsRankFunction) + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsRemoveLabelsFunction) + ElseIf rdoSort.Checked Then + clsPreviewTextFunction = clsSortFunction.Clone + clsDummyTransformFunction.AddParameter("check", "sort", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsSortFunction) + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsRemoveLabelsFunction) + ElseIf rdoNumeric.Checked Then + clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) + If rdoRoundOf.Checked Then + clsPreviewTextFunction = clsRoundFunction.Clone + clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsRoundFunction) + ElseIf rdoSignificantDigits.Checked Then + clsPreviewTextFunction = clsSignifFunction.Clone + clsNumericDummyFunction.AddParameter("check", "signif", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsSignifFunction) + ElseIf rdoLag.Checked Then + clsPreviewTextFunction = clsLagFunction.Clone + clsNumericDummyFunction.AddParameter("check", "lag", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsLagFunction) + ElseIf rdoLead.Checked Then + clsPreviewTextFunction = clsLeadFunction.Clone + clsNumericDummyFunction.AddParameter("check", "lead", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsLeadFunction) + ElseIf rdoDifference.Checked Then + clsPreviewTextFunction = clsConcDiffFunction.Clone + clsNumericDummyFunction.AddParameter("check", "diff", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsConcDiffFunction) + ElseIf rdoStandardize.Checked Then + clsPreviewTextFunction = clsDivisionOperator.Clone + clsNumericDummyFunction.AddParameter("check", "standardise", iPosition:=0) + ucrBase.clsRsyntax.SetBaseROperator(clsDivisionOperator) + ElseIf rdoLogical.Checked Then + clsNumericDummyFunction.AddParameter("check", "logical", iPosition:=0) + clsPreviewTextFunction = clsBooleanOperator.Clone + ucrBase.clsRsyntax.SetBaseROperator(clsBooleanOperator) + Select Case ucrInputLogicOperations.GetText + Case "==" + clsBooleanOperator.SetOperation("==") + Case "<" + clsBooleanOperator.SetOperation("<") + Case "<=" + clsBooleanOperator.SetOperation("<=") + Case ">" + clsBooleanOperator.SetOperation(">") + Case ">=" + clsBooleanOperator.SetOperation(">=") + Case "!=" + clsBooleanOperator.SetOperation("!=") + Case "%in%" + clsBooleanOperator.SetOperation("%in%") + Case "is.na" + clsIsNAFunction.SetRCommand("is.na") + clsPreviewTextFunction = clsIsNAFunction.Clone + ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) + Case "!is.na" + clsIsNAFunction.SetRCommand("!is.na") + clsPreviewTextFunction = clsIsNAFunction.Clone + ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) + End Select End If - 'End If - ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAssignOperator) - ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddColumnsFunction) - - 'clsDummyTransformFunction.AddParameter("checked", "single", iPosition:=1) - 'ucrReceiverRank.bUseFilteredData = False - 'ucrReceiverRank.SetParameterIsRFunction() - 'ucrSelectorForRank.SetItemType("column") - 'ucrReceiverRank.strSelectorHeading = "Numerics" - 'lblSelectColumns.Text = "Column:" - Else - LoopsParameters() + ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) + ElseIf rdoNonNegative.Checked Then + UpdateConstantParameter() + clsDummyTransformFunction.AddParameter("check", "non-negative", iPosition:=0) + If rdoSquareRoot.Checked Then + clsPreviewTextFunction = clsSquarerootFunction.Clone + ucrBase.clsRsyntax.SetBaseRFunction(clsSquarerootFunction) + clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) + ElseIf rdoPower.Checked Then + clsPreviewTextFunction = clsPowerOperator.Clone + clsNonNegativeDummyFunction.AddParameter("check", "power", iPosition:=0) + ucrBase.clsRsyntax.SetBaseROperator(clsPowerOperator) + ElseIf rdoLogToBase10.Checked Then + clsPreviewTextFunction = clsLogBase10Function.Clone + clsNonNegativeDummyFunction.AddParameter("check", "log10", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsLogBase10Function) + ElseIf rdoNaturalLog.Checked Then + clsPreviewTextFunction = clsNaturalLogFunction.Clone + clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsNaturalLogFunction) + End If + ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) + ElseIf rdoScale.Checked Then + clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) + clsPreviewTextFunction = clsScaleAddOperator.Clone + ucrBase.clsRsyntax.SetBaseROperator(clsScaleAddOperator) + ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) + End If + + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAssignOperator) + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddColumnsFunction) + Else + LoopsParameters() ucrBase.clsRsyntax.ClearCodes() ucrBase.clsRsyntax.SetAssignTo("col") ucrBase.clsRsyntax.AddToAfterCodes(clsPipeOperator, 0) ucrBase.clsRsyntax.AddToAfterCodes(clsAssignOperator, 1) ucrBase.clsRsyntax.AddToAfterCodes(clsAddColumnsFunction, 2) - 'clsDummyTransformFunction.AddParameter("checked", "multiple", iPosition:=1) - 'ucrSelectorForRank.SetItemType("column_selection") - 'ucrReceiverRank.strSelectorHeading = "Column selections" - 'lblSelectColumns.Text = "Select:" - End If + End If + 'End If SetPreviewText() UpdateNonNegativeParameters() NewDefaultName() @@ -936,50 +897,40 @@ Public Class dlgTransform End Sub Private Sub LoopsParameters() - 'ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) If rdoRank.Checked Then clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) clsPreviewTextFunction = clsRankColsFunction.Clone clsRankColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("right", clsRFunctionParameter:=clsRankColsFunction, iPosition:=1) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsRankColsFunction, bIncludeArgumentName:=False, iPosition:=1) ElseIf rdoSort.Checked Then clsDummyTransformFunction.AddParameter("check", "sort", iPosition:=0) clsPreviewTextFunction = clsSortColsFunction.Clone clsSortColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("left", clsRFunctionParameter:=clsSortColsFunction, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsSortColsFunction, bIncludeArgumentName:=False, iPosition:=1) ElseIf rdoNumeric.Checked Then clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) If rdoRoundOf.Checked Then clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) - clsRoundColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("round", clsRFunctionParameter:=clsRoundColsFunction, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsRoundColsFunction, bIncludeArgumentName:=False) ElseIf rdoSignificantDigits.Checked Then clsNumericDummyFunction.AddParameter("check", "signif", iPosition:=0) clsSignifColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsSignifColsFunction, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsSignifColsFunction, bIncludeArgumentName:=False) ElseIf rdoLag.Checked Then clsNumericDummyFunction.AddParameter("check", "lag", iPosition:=0) clsLagColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsLagColsFunction, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsLagColsFunction, bIncludeArgumentName:=False) ElseIf rdoLead.Checked Then clsNumericDummyFunction.AddParameter("check", "lead", iPosition:=0) clsLeadColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsLeadColsFunction, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsLeadColsFunction, bIncludeArgumentName:=False) ElseIf rdoDifference.Checked Then clsNumericDummyFunction.AddParameter("check", "diff", iPosition:=0) - clsConcDiffColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsConcDiffColsFunction, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsConcDiffColsFunction, bIncludeArgumentName:=False) ElseIf rdoStandardize.Checked Then clsNumericDummyFunction.AddParameter("check", "standardise", iPosition:=0) @@ -987,12 +938,10 @@ Public Class dlgTransform clsMeanColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) clsStandardDevColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("sig", clsROperatorParameter:=clsDivisionColsOperator, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsDivisionColsOperator, bIncludeArgumentName:=False) ElseIf rdoLogical.Checked Then clsNumericDummyFunction.AddParameter("check", "logical", iPosition:=0) clsBooleanColsOperator.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("sig", clsROperatorParameter:=clsBooleanColsOperator, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsBooleanColsOperator, bIncludeArgumentName:=False) Select Case ucrInputLogicOperations.GetText Case "==" @@ -1028,7 +977,6 @@ Public Class dlgTransform clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) clsSquarerootColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsSquarerootFunction, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsSquarerootColsFunction, bIncludeArgumentName:=False) ElseIf rdoPower.Checked Then clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) @@ -1036,27 +984,23 @@ Public Class dlgTransform clsNonNegativeDummyFunction.AddParameter("check", "power", iPosition:=0) clsPowerColsOperator.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("sig", clsROperatorParameter:=clsPowerOperator, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsPowerColsOperator, bIncludeArgumentName:=False) ElseIf rdoLogToBase10.Checked Then clsNonNegativeDummyFunction.AddParameter("check", "log10", iPosition:=0) clsLogBase10ColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsLogBase10Function, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsLogBase10ColsFunction, bIncludeArgumentName:=False) ElseIf rdoNaturalLog.Checked Then clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) clsNaturalLogColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("sig", clsRFunctionParameter:=clsNaturalLogFunction, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsNaturalLogColsFunction, bIncludeArgumentName:=False) End If ElseIf rdoScale.Checked Then clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) clsScaleAddColsOperator.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - 'clsTildaOperator.AddParameter("sig", clsROperatorParameter:=clsScaleAddOperator, iPosition:=1, bIncludeArgumentName:=False) clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsScaleAddColsOperator, bIncludeArgumentName:=False) End If @@ -1183,8 +1127,6 @@ Public Class dlgTransform lblSelectColumns.Text = "Select:" ElseIf rdoSingle.Checked Then clsDummyTransformFunction.AddParameter("col", "single", iPosition:=0) - 'ucrReceiverRank.bUseFilteredData = False - 'ucrReceiverRank.SetParameterIsRFunction() ucrSelectorForRank.SetItemType("column") ucrReceiverRank.strSelectorHeading = "Numerics" lblSelectColumns.Text = "Column:" From cc5517f04338cca5dc379eb391a427e1a00a6710 Mon Sep 17 00:00:00 2001 From: Stephen Lloyd Date: Tue, 19 Mar 2024 10:06:00 +0100 Subject: [PATCH 25/88] final refactoring changes to RSyntax --- instat/clsRSyntax.vb | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/instat/clsRSyntax.vb b/instat/clsRSyntax.vb index 38973426cfb..ec7020e541f 100644 --- a/instat/clsRSyntax.vb +++ b/instat/clsRSyntax.vb @@ -42,17 +42,6 @@ ''' '''-------------------------------------------------------------------------------------------- Public Class RSyntax - 'TODO Legacy - Adapt RSyntax to new style... - - ' An object of this class is associated with a base R code. This R code must be (only one of): - ' - An R function, - ' - An R operator - ' - A generic R command - ' - ' Use the 3 booleans below to set the type - ' 'TODO SJL It's not valid for an object of this class to be more than one of the 3 types above. - ' However the booleans potentially allow this. Replace with an enumeration? - ''' If true then don't include the output part in the script (i.e. the part of the ''' script to the left of the assignment operator '<-'). Public bExcludeAssignedFunctionOutput As Boolean = True @@ -63,6 +52,15 @@ Public Class RSyntax ''' TODO SJL 07/04/20 Is only ever Nothing (or in one rare case False). Remove? Public bShowWaitDialogOverride As Nullable(Of Boolean) = Nothing + ' An object of this class is associated with a base R code. This R code must be (only one of): + ' - An R function, + ' - An R operator + ' - A generic R command + ' + ' Use the 3 booleans below to set the type + ' 'TODO SJL It's not valid for an object of this class to be more than one of the 3 types above. + ' However the booleans potentially allow this. Replace with an enumeration? + ''' If true then use 'clsBaseFunction' as this object's base R code. Public bUseBaseFunction As Boolean = False @@ -72,6 +70,7 @@ Public Class RSyntax ''' If true then use 'clsBaseCommandString' as this object's base R code. Public bUseCommandString As Boolean = False + ''' An R command (of any type). Public clsBaseCommandString As New RCodeStructure 'TODO SJL 17/04/20 What's the connection between this and 'bUseCommandString' and 'strCommandString'? @@ -124,7 +123,6 @@ Public Class RSyntax '''-------------------------------------------------------------------------------------------- Public Sub AddParameter(strParameterName As String, Optional strParameterValue As String = "", Optional clsRFunctionParameter As RFunction = Nothing, Optional clsROperatorParameter As ROperator = Nothing, Optional clsRCodeStructureParameter As RCodeStructure = Nothing, Optional bIncludeArgumentName As Boolean = True, Optional iPosition As Integer = -1) 'TODO SJL 17/04/20 This function should only be used if this class encapsulates a function. But it doesn't check the booleans for this. - ' Also, 'clsBaseFunction' is public so 'AddParameter' can be called directly. Remove this function? clsBaseFunction.AddParameter(strParameterName, strParameterValue, clsRFunctionParameter, clsROperatorParameter, clsRCodeStructureParameter, bIncludeArgumentName, iPosition) End Sub @@ -139,7 +137,7 @@ Public Class RSyntax Public Sub AddToAfterCodes(clsNewRCode As RCodeStructure, Optional iPosition As Integer = -1) If Not lstAfterCodes.Contains(clsNewRCode) Then lstAfterCodes.Add(clsNewRCode) - clsNewRCode.iPosition = iPosition 'TODO SJL 06/04/20 remove this line and the 'Else' (same as function above)? + clsNewRCode.iPosition = iPosition 'TODO SJL 06/04/20 remove this line and the 'Else' (see AddToBeforeCodes)? Else lstAfterCodes.Find(Function(x) x.Equals(clsNewRCode)).iPosition = iPosition End If @@ -164,7 +162,6 @@ Public Class RSyntax ''' Resets all the data members to default values. '''-------------------------------------------------------------------------------------------- Public Sub ClearCodes() - 'TODO SJL Some data members are not reset by this function. Add them? lstBeforeCodes = New List(Of RCodeStructure) lstAfterCodes = New List(Of RCodeStructure) clsBaseFunction = New RFunction @@ -174,6 +171,8 @@ Public Class RSyntax bUseBaseFunction = False bUseBaseOperator = False bUseCommandString = False + 'TODO SJL 19/03/24 also reset iCallType? + 'iCallType = 0 End Sub '''-------------------------------------------------------------------------------------------- @@ -361,20 +360,20 @@ Public Class RSyntax End Sub '''-------------------------------------------------------------------------------------------- - ''' TODO SJL 06/04/20 This is a single line function on a public data member. - ''' I'm not sure what it adds. Remove?. + ''' Removes from the statements executed after the + ''' base statement. ''' - ''' The cls new r code. + ''' The R statement to remove. '''-------------------------------------------------------------------------------------------- Public Sub RemoveFromAfterCodes(clsNewRCode As RCodeStructure) lstAfterCodes.Remove(clsNewRCode) End Sub '''-------------------------------------------------------------------------------------------- - ''' TODO SJL 06/04/20 This is a single line function on a public data member. - ''' I'm not sure what it adds. Remove? + ''' Removes from the statements executed before the + ''' base statement. ''' - ''' The cls new r code. + ''' The R statement to remove. '''-------------------------------------------------------------------------------------------- Public Sub RemoveFromBeforeCodes(clsNewRCode As RCodeStructure) lstBeforeCodes.Remove(clsNewRCode) @@ -389,7 +388,6 @@ Public Class RSyntax '''-------------------------------------------------------------------------------------------- Public Sub RemoveParameter(strParameterName As String, Optional ByRef clsFunction As RFunction = Nothing) 'TODO SJL 17/04/20 This function should only be used if this class encapsulates a function. But it doesn't check the booleans for this. - ' Also, 'clsBaseFunction' is public so 'RemoveParameterByName' can be called directly. Remove this function? If clsFunction Is Nothing Then clsFunction = clsBaseFunction End If @@ -463,7 +461,6 @@ Public Class RSyntax ''' Name of the R command. '''-------------------------------------------------------------------------------------------- Public Sub SetFunction(strFunctionName As String) - 'TODO legacy - confusing name clsBaseFunction.SetRCommand(strFunctionName) bUseBaseFunction = True bUseBaseOperator = False From c9eac72364b668abe1cbbf7bf423cd3961adea80 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Tue, 19 Mar 2024 11:12:14 +0100 Subject: [PATCH 26/88] Code Changes --- instat/dlgTransform.vb | 57 +++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index d444cef62be..4d95a922d81 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -526,13 +526,13 @@ Public Class dlgTransform clsLeadColsFunction.SetPackageName("~dplyr") clsLeadColsFunction.SetRCommand("lead") - clsDiffColsFunction.SetRCommand("~diff") + clsDiffColsFunction.SetRCommand("diff") clsDiffColsFunction.AddParameter("lag", "1", iPosition:=1) - clsReplicateColsFunction.SetRCommand("~rep") + clsReplicateColsFunction.SetRCommand("rep") clsReplicateColsFunction.AddParameter("x", "NA", iPosition:=0) - clsConcDiffColsFunction.SetRCommand("c") + clsConcDiffColsFunction.SetRCommand("~c") clsConcDiffColsFunction.AddParameter("y", clsRFunctionParameter:=clsReplicateColsFunction, iPosition:=0, bIncludeArgumentName:=False) clsConcDiffColsFunction.AddParameter("x", clsRFunctionParameter:=clsDiffColsFunction, iPosition:=1, bIncludeArgumentName:=False) @@ -559,7 +559,6 @@ Public Class dlgTransform clsLogBase10ColsFunction.SetRCommand("~log10") clsPowerColsOperator.SetOperation("^") - clsPowerColsOperator.AddParameter("y", "1", iPosition:=1) clsPowerColsOperator.bSpaceAroundOperation = False clsScaleMeanColsFunction.SetRCommand("~mean") @@ -651,7 +650,7 @@ Public Class dlgTransform ucrReceiverRank.AddAdditionalCodeParameterPair(clsStandardDevFunction, New RParameter("x", 0), iAdditionalPairNo:=9) ucrNudDiffLag.AddAdditionalCodeParameterPair(clsReplicateFunction, New RParameter("times", 1), iAdditionalPairNo:=1) ucrNudDiffLag.AddAdditionalCodeParameterPair(clsReplicateColsFunction, New RParameter("times", 1), iAdditionalPairNo:=2) - ucrNudDiffLag.AddAdditionalCodeParameterPair(clsDiffColsFunction, New RParameter("times", 1), iAdditionalPairNo:=3) + ucrNudDiffLag.AddAdditionalCodeParameterPair(clsDiffColsFunction, New RParameter("lag", 1), iAdditionalPairNo:=3) ucrNudLagLeadPosition.AddAdditionalCodeParameterPair(clsLeadColsFunction, New RParameter("n", 1), iAdditionalPairNo:=1) ucrNudLagPosition.AddAdditionalCodeParameterPair(clsLagColsFunction, New RParameter("lag", 1), iAdditionalPairNo:=1) ucrNudSignifDigits.AddAdditionalCodeParameterPair(clsSignifColsFunction, New RParameter("digits", 1), iAdditionalPairNo:=1) @@ -693,6 +692,8 @@ Public Class dlgTransform ucrPnlMissingValues.AddAdditionalCodeParameterPair(clsRankColsFunction, New RParameter("na.last", 2), iAdditionalPairNo:=1) ucrChkMissingLast.AddAdditionalCodeParameterPair(clsSortColsFunction, New RParameter("na.last", 1), iAdditionalPairNo:=1) ucrChkDecreasing.AddAdditionalCodeParameterPair(clsSortColsFunction, New RParameter("decreasing", 2), iAdditionalPairNo:=1) + ucrInputLogicalValues.AddAdditionalCodeParameterPair(clsBooleanColsOperator, New RParameter("x", 1), iAdditionalPairNo:=1) + ucrSaveNew.AddAdditionalRCode(clsLeadFunction, iAdditionalPairNo:=1) ucrSaveNew.AddAdditionalRCode(clsLagFunction, iAdditionalPairNo:=2) ucrSaveNew.AddAdditionalRCode(clsSignifFunction, iAdditionalPairNo:=3) @@ -732,7 +733,7 @@ Public Class dlgTransform ucrPnlNonNegative.SetRCode(clsNonNegativeDummyFunction, bReset) ucrChkOmitNA.SetRCode(clsMeanFunction, bReset) ucrChkPreview.SetRCode(clsConstantDummyFunction, bReset) - + ucrInputLogicalValues.SetRCode(clsBooleanOperator, bReset) If bReset Then ucrReceiverRank.SetRCode(clsRankFunction, bReset) End If @@ -741,13 +742,21 @@ Public Class dlgTransform Private Sub TestOKEnabled() If rdoNumeric.Checked AndAlso rdoLogical.Checked Then - If Not ucrInputLogicOperations.GetText = "is.na" AndAlso Not ucrInputLogicOperations.GetText = "!is.na" Then - ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete AndAlso Not ucrInputLogicalValues.IsEmpty) + If rdoSingle.Checked Then + If Not ucrInputLogicOperations.GetText = "is.na" AndAlso Not ucrInputLogicOperations.GetText = "!is.na" Then + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete AndAlso Not ucrInputLogicalValues.IsEmpty) + Else + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete) + End If + ElseIf rdoMultiple.Checked Then + If Not ucrInputLogicOperations.GetText = "is.na" AndAlso Not ucrInputLogicOperations.GetText = "!is.na" Then + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso Not ucrInputLogicalValues.IsEmpty) + Else + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete) + End If Else - ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete) + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty()) End If - Else - ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty()) End If End Sub @@ -930,7 +939,7 @@ Public Class dlgTransform clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsLeadColsFunction, bIncludeArgumentName:=False) ElseIf rdoDifference.Checked Then clsNumericDummyFunction.AddParameter("check", "diff", iPosition:=0) - clsConcDiffColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + clsDiffColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsConcDiffColsFunction, bIncludeArgumentName:=False) ElseIf rdoStandardize.Checked Then clsNumericDummyFunction.AddParameter("check", "standardise", iPosition:=0) @@ -941,7 +950,7 @@ Public Class dlgTransform clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsDivisionColsOperator, bIncludeArgumentName:=False) ElseIf rdoLogical.Checked Then clsNumericDummyFunction.AddParameter("check", "logical", iPosition:=0) - clsBooleanColsOperator.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + clsBooleanColsOperator.AddParameter("x", "~.x", bIncludeArgumentName:=False, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsBooleanColsOperator, bIncludeArgumentName:=False) Select Case ucrInputLogicOperations.GetText Case "==" @@ -979,11 +988,11 @@ Public Class dlgTransform clsSquarerootColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsSquarerootColsFunction, bIncludeArgumentName:=False) ElseIf rdoPower.Checked Then - clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) clsNonNegativeDummyFunction.AddParameter("check", "power", iPosition:=0) + clsPowerColsOperator.AddParameter("y", ucrInputPower.GetText, iPosition:=1) - clsPowerColsOperator.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + clsPowerColsOperator.AddParameter("x", "~.", bIncludeArgumentName:=False, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsPowerColsOperator, bIncludeArgumentName:=False) ElseIf rdoLogToBase10.Checked Then clsNonNegativeDummyFunction.AddParameter("check", "log10", iPosition:=0) @@ -1087,11 +1096,19 @@ Public Class dlgTransform SetPreviewText() End Sub - Private Sub ucrInputLogicalValues_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputLogicalValues.ControlValueChanged - If Not ucrInputLogicalValues.IsEmpty Then - clsBooleanOperator.AddParameter("right", ucrInputLogicalValues.GetText, iPosition:=1) - Else - clsBooleanOperator.RemoveParameterByName("right") + Private Sub ucrInputLogicalValues_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputLogicalValues.ControlValueChanged, ucrInputLogicOperations.ControlValueChanged + If rdoSingle.Checked Then + If Not ucrInputLogicalValues.IsEmpty Then + clsBooleanOperator.AddParameter("right", ucrInputLogicalValues.GetText, iPosition:=1) + Else + clsBooleanOperator.RemoveParameterByName("right") + End If + ElseIf rdoMultiple.Checked Then + If Not ucrInputLogicalValues.IsEmpty Then + clsBooleanColsOperator.AddParameter("right", ucrInputLogicalValues.GetText, iPosition:=1) + Else + clsBooleanColsOperator.RemoveParameterByName("right") + End If End If End Sub From 5d2efdf4342e77662c6c13b07dab0a918a431d99 Mon Sep 17 00:00:00 2001 From: n-thony Date: Wed, 20 Mar 2024 09:46:38 +0300 Subject: [PATCH 27/88] Displaying mutliple table to the default browser --- instat/static/InstatObject/R/stand_alone_functions.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index 904794d2d2c..6e3384577d5 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2634,7 +2634,9 @@ view_object_data <- function(object, object_format = NULL) { file_name <- view_text_object(object) } else if (identical(object_format, "html")) { file_name <- view_html_object(object) - }else{ + } else if ("list" %in% class(object)) { # Check if object is a list + print(object) + } else{ print(object) } return(file_name) From 8e2abd8727c42a05422b83999891108c578517cc Mon Sep 17 00:00:00 2001 From: n-thony Date: Wed, 20 Mar 2024 10:07:30 +0300 Subject: [PATCH 28/88] minor code change --- instat/static/InstatObject/R/stand_alone_functions.R | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index 6e3384577d5..6703f58f574 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2635,7 +2635,13 @@ view_object_data <- function(object, object_format = NULL) { } else if (identical(object_format, "html")) { file_name <- view_html_object(object) } else if ("list" %in% class(object)) { # Check if object is a list - print(object) + # Convert list to HTML + html_content <- paste("
", capture.output(print(object)), "
", collapse="\n") + # Write HTML to a temporary file + temp_file <- tempfile(fileext=".html") + writeLines(html_content, temp_file) + # Open HTML file in default browser + browseURL(temp_file) } else{ print(object) } From a0592c356c42733f8b8d4c2dc660aea7ce570584 Mon Sep 17 00:00:00 2001 From: n-thony Date: Wed, 20 Mar 2024 10:19:50 +0300 Subject: [PATCH 29/88] added the package --- instat/static/InstatObject/R/stand_alone_functions.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index 6703f58f574..94ebb728ade 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2636,12 +2636,12 @@ view_object_data <- function(object, object_format = NULL) { file_name <- view_html_object(object) } else if ("list" %in% class(object)) { # Check if object is a list # Convert list to HTML - html_content <- paste("
", capture.output(print(object)), "
", collapse="\n") + html_content <- paste("
", utils::capture.output(print(object)), "
", collapse="\n") # Write HTML to a temporary file temp_file <- tempfile(fileext=".html") writeLines(html_content, temp_file) # Open HTML file in default browser - browseURL(temp_file) + utils::browseURL(temp_file) } else{ print(object) } From bbf332eb7122316a64920b5df2d7711080d60654 Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Wed, 20 Mar 2024 14:13:48 +0300 Subject: [PATCH 30/88] changes to the code --- instat/dlgTransform.vb | 97 ++++++++++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 31 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 4d95a922d81..baf11d2ff71 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -64,7 +64,9 @@ Public Class dlgTransform Private clsPowerOperator As New ROperator Private clsScaleSubtractOperator As New ROperator Private clsScaleMultiplyOperator As New ROperator + Private clsScaleMultiplyColsOperator As New ROperator Private clsScaleDivideOperator As New ROperator + Private clsScaleDivideColsOperator As New ROperator Private clsScaleAddOperator As New ROperator Private clsScaleMeanFunction As New RFunction Private clsScaleMinFunction As New RFunction @@ -375,6 +377,7 @@ Public Class dlgTransform clsScaleAddOperator = New ROperator clsScaleDivideOperator = New ROperator clsScaleMultiplyOperator = New ROperator + clsScaleMultiplyColsOperator = New ROperator clsScaleSubtractOperator = New ROperator clsPreviewOperator = New ROperator clsScaleMeanFunction = New RFunction @@ -536,18 +539,20 @@ Public Class dlgTransform clsConcDiffColsFunction.AddParameter("y", clsRFunctionParameter:=clsReplicateColsFunction, iPosition:=0, bIncludeArgumentName:=False) clsConcDiffColsFunction.AddParameter("x", clsRFunctionParameter:=clsDiffColsFunction, iPosition:=1, bIncludeArgumentName:=False) - clsMeanColsFunction.SetRCommand("~mean") + clsMeanColsFunction.SetRCommand("mean") clsMeanColsFunction.AddParameter("na.rm", "TRUE", iPosition:=1) - clsStandardDevColsFunction.SetRCommand("~sd") + clsStandardDevColsFunction.SetRCommand("sd") clsStandardDevColsFunction.AddParameter("na.rm", "TRUE", iPosition:=1) clsSubtractColsOperator.SetOperation("-") + clsSubtractColsOperator.AddParameter("left", "~.x", iPosition:=0) clsSubtractColsOperator.AddParameter("y", clsRFunctionParameter:=clsMeanColsFunction, iPosition:=1) clsDivisionColsOperator.SetOperation("/") clsDivisionColsOperator.AddParameter("x", clsROperatorParameter:=clsSubtractColsOperator, iPosition:=0) clsDivisionColsOperator.AddParameter("y", clsRFunctionParameter:=clsStandardDevColsFunction, iPosition:=1) + clsDivisionColsOperator.bBrackets = False clsSquarerootColsFunction.SetRCommand("~sqrt") @@ -567,20 +572,21 @@ Public Class dlgTransform clsScaleMinColsFunction.SetRCommand("~min") clsScaleMinColsFunction.AddParameter("na.rm", "TRUE", iPosition:=1) - clsScaleSubtractOperator.SetOperation("-") - clsScaleSubtractOperator.AddParameter("u", "0", iPosition:=1) + clsScaleSubtractColsOperator.SetOperation("-") + clsScaleSubtractColsOperator.AddParameter("u", "0", iPosition:=1) - clsScaleMultiplyOperator.SetOperation("*") - clsScaleMultiplyOperator.AddParameter("x", clsROperatorParameter:=clsScaleSubtractOperator, iPosition:=0) - clsScaleMultiplyOperator.AddParameter("y", "1", iPosition:=1) + clsScaleMultiplyColsOperator.SetOperation("*") + clsScaleMultiplyColsOperator.AddParameter("x", clsROperatorParameter:=clsScaleSubtractColsOperator, iPosition:=0) + clsScaleMultiplyColsOperator.AddParameter("y", "1", iPosition:=1) + clsScaleMultiplyColsOperator.bBrackets = False - clsScaleDivideOperator.SetOperation("/") - clsScaleDivideOperator.AddParameter("x", clsROperatorParameter:=clsScaleMultiplyOperator, iPosition:=0) - clsScaleDivideOperator.AddParameter("z", "1", iPosition:=1) - clsScaleDivideOperator.bBrackets = False + clsScaleDivideColsOperator.SetOperation("/") + clsScaleDivideColsOperator.AddParameter("x", clsROperatorParameter:=clsScaleMultiplyColsOperator, iPosition:=0) + clsScaleDivideColsOperator.AddParameter("z", "1", iPosition:=1) + clsScaleDivideColsOperator.bBrackets = False clsScaleAddColsOperator.SetOperation("+") - clsScaleAddColsOperator.AddParameter("x", clsROperatorParameter:=clsScaleDivideOperator, iPosition:=0) + clsScaleAddColsOperator.AddParameter("x", clsROperatorParameter:=clsScaleDivideColsOperator, iPosition:=0) clsScaleAddColsOperator.AddParameter("v", "0", iPosition:=1) clsScaleAddColsOperator.bBrackets = False @@ -671,16 +677,16 @@ Public Class dlgTransform ucrReceiverRank.AddAdditionalCodeParameterPair(clsLeadColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=22) ucrReceiverRank.AddAdditionalCodeParameterPair(clsDiffColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=23) ucrReceiverRank.AddAdditionalCodeParameterPair(clsMeanColsFunction, New RParameter("x", 0), iAdditionalPairNo:=24) - ucrReceiverRank.AddAdditionalCodeParameterPair(clsSubtractColsOperator, New RParameter("x", 0), iAdditionalPairNo:=25) - ucrReceiverRank.AddAdditionalCodeParameterPair(clsStandardDevColsFunction, New RParameter("x", 0), iAdditionalPairNo:=26) - ucrReceiverRank.AddAdditionalCodeParameterPair(clsRankColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=27) + 'ucrReceiverRank.AddAdditionalCodeParameterPair(clsSubtractColsOperator, New RParameter("x", 0), iAdditionalPairNo:=25) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsStandardDevColsFunction, New RParameter("x", 0), iAdditionalPairNo:=25) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsRankColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=26) - ucrReceiverRank.AddAdditionalCodeParameterPair(clsAddConstantColsOperator, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=28) - ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleSubtractColsOperator, New RParameter("x", 0), iAdditionalPairNo:=29) - ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleMeanColsFunction, New RParameter("x", 0), iAdditionalPairNo:=30) - ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleMinColsFunction, New RParameter("x", 0), iAdditionalPairNo:=31) - ucrReceiverRank.AddAdditionalCodeParameterPair(clsBooleanColsOperator, New RParameter("x", 0), iAdditionalPairNo:=32) - ucrReceiverRank.AddAdditionalCodeParameterPair(clsIsNAColsFunction, New RParameter("x", 0), iAdditionalPairNo:=33) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsAddConstantColsOperator, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=27) + 'ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleSubtractColsOperator, New RParameter("x", 0), iAdditionalPairNo:=28) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleMeanColsFunction, New RParameter("x", 0), iAdditionalPairNo:=28) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleMinColsFunction, New RParameter("x", 0), iAdditionalPairNo:=29) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsBooleanColsOperator, New RParameter("x", 0), iAdditionalPairNo:=30) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsIsNAColsFunction, New RParameter("x", 0), iAdditionalPairNo:=31) ucrChkOmitNA.AddAdditionalCodeParameterPair(clsStandardDevFunction, ucrChkOmitNA.GetParameter(), iAdditionalPairNo:=1) @@ -692,7 +698,12 @@ Public Class dlgTransform ucrPnlMissingValues.AddAdditionalCodeParameterPair(clsRankColsFunction, New RParameter("na.last", 2), iAdditionalPairNo:=1) ucrChkMissingLast.AddAdditionalCodeParameterPair(clsSortColsFunction, New RParameter("na.last", 1), iAdditionalPairNo:=1) ucrChkDecreasing.AddAdditionalCodeParameterPair(clsSortColsFunction, New RParameter("decreasing", 2), iAdditionalPairNo:=1) - ucrInputLogicalValues.AddAdditionalCodeParameterPair(clsBooleanColsOperator, New RParameter("x", 1), iAdditionalPairNo:=1) + 'ucrInputLogicalValues.AddAdditionalCodeParameterPair(clsBooleanColsOperator, New RParameter("x", 1), iAdditionalPairNo:=1) + ucrInputMultiply.AddAdditionalCodeParameterPair(clsScaleMultiplyColsOperator, New RParameter("y", 1), iAdditionalPairNo:=1) + ucrInputDivide.AddAdditionalCodeParameterPair(clsScaleDivideColsOperator, New RParameter("z", 1), iAdditionalPairNo:=1) + ucrInputAdd.AddAdditionalCodeParameterPair(clsScaleAddColsOperator, New RParameter("v", 1), iAdditionalPairNo:=1) + ucrInputSubtract.AddAdditionalCodeParameterPair(clsScaleSubtractColsOperator, New RParameter("u", 1), iAdditionalPairNo:=1) + ucrInputConstant.AddAdditionalCodeParameterPair(clsAddConstantColsOperator, New RParameter("c", 1), iAdditionalPairNo:=1) ucrSaveNew.AddAdditionalRCode(clsLeadFunction, iAdditionalPairNo:=1) ucrSaveNew.AddAdditionalRCode(clsLagFunction, iAdditionalPairNo:=2) @@ -733,7 +744,7 @@ Public Class dlgTransform ucrPnlNonNegative.SetRCode(clsNonNegativeDummyFunction, bReset) ucrChkOmitNA.SetRCode(clsMeanFunction, bReset) ucrChkPreview.SetRCode(clsConstantDummyFunction, bReset) - ucrInputLogicalValues.SetRCode(clsBooleanOperator, bReset) + 'ucrInputLogicalValues.SetRCode(clsBooleanOperator, bReset) If bReset Then ucrReceiverRank.SetRCode(clsRankFunction, bReset) End If @@ -752,7 +763,7 @@ Public Class dlgTransform If Not ucrInputLogicOperations.GetText = "is.na" AndAlso Not ucrInputLogicOperations.GetText = "!is.na" Then ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso Not ucrInputLogicalValues.IsEmpty) Else - ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete) + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty()) End If Else ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty()) @@ -890,11 +901,11 @@ Public Class dlgTransform ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddColumnsFunction) Else LoopsParameters() - ucrBase.clsRsyntax.ClearCodes() - ucrBase.clsRsyntax.SetAssignTo("col") - ucrBase.clsRsyntax.AddToAfterCodes(clsPipeOperator, 0) - ucrBase.clsRsyntax.AddToAfterCodes(clsAssignOperator, 1) - ucrBase.clsRsyntax.AddToAfterCodes(clsAddColumnsFunction, 2) + ucrBase.clsRsyntax.ClearCodes() + ucrBase.clsRsyntax.SetAssignTo("col") + ucrBase.clsRsyntax.AddToAfterCodes(clsPipeOperator, 0) + ucrBase.clsRsyntax.AddToAfterCodes(clsAssignOperator, 1) + ucrBase.clsRsyntax.AddToAfterCodes(clsAddColumnsFunction, 2) End If @@ -903,6 +914,7 @@ Public Class dlgTransform UpdateNonNegativeParameters() NewDefaultName() ResetPreview() + AddRemoveLogicalValues() End Sub Private Sub LoopsParameters() @@ -1009,7 +1021,7 @@ Public Class dlgTransform ElseIf rdoScale.Checked Then clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) - clsScaleAddColsOperator.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) + clsScaleSubtractColsOperator.AddParameter("left", "~.x", iPosition:=0) clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsScaleAddColsOperator, bIncludeArgumentName:=False) End If @@ -1094,21 +1106,43 @@ Public Class dlgTransform Private Sub ucrInputLogicalValues_TextChanged(sender As Object, e As EventArgs) Handles ucrInputLogicalValues.TextChanged SetPreviewText() + AddRemoveLogicalValues() + End Sub + + Private Sub ucrInputLogicalValues_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputLogicalValues.ControlValueChanged + 'If rdoSingle.Checked Then + ' If Not ucrInputLogicalValues.IsEmpty Then + ' clsBooleanOperator.AddParameter("right", ucrInputLogicalValues.GetText, iPosition:=1) + ' Else + ' clsBooleanOperator.RemoveParameterByName("right") + ' End If + 'ElseIf rdoMultiple.Checked Then + ' If Not ucrInputLogicalValues.IsEmpty Then + ' clsBooleanColsOperator.AddParameter("right", ucrInputLogicalValues.GetText, iPosition:=1) + ' Else + ' clsBooleanColsOperator.RemoveParameterByName("right") + ' End If + 'End If + AddRemoveLogicalValues() End Sub - Private Sub ucrInputLogicalValues_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputLogicalValues.ControlValueChanged, ucrInputLogicOperations.ControlValueChanged + Private Sub AddRemoveLogicalValues() If rdoSingle.Checked Then If Not ucrInputLogicalValues.IsEmpty Then clsBooleanOperator.AddParameter("right", ucrInputLogicalValues.GetText, iPosition:=1) Else clsBooleanOperator.RemoveParameterByName("right") End If + clsBooleanColsOperator.RemoveParameterByName("right") + ElseIf rdoMultiple.Checked Then If Not ucrInputLogicalValues.IsEmpty Then clsBooleanColsOperator.AddParameter("right", ucrInputLogicalValues.GetText, iPosition:=1) Else clsBooleanColsOperator.RemoveParameterByName("right") End If + clsBooleanOperator.RemoveParameterByName("right") + End If End Sub @@ -1148,5 +1182,6 @@ Public Class dlgTransform ucrReceiverRank.strSelectorHeading = "Numerics" lblSelectColumns.Text = "Column:" End If + AddRemoveLogicalValues() End Sub End Class \ No newline at end of file From d190ce3961359efc18e0bf7fd3a743c3c2aeb645 Mon Sep 17 00:00:00 2001 From: n-thony Date: Thu, 21 Mar 2024 11:47:06 +0300 Subject: [PATCH 31/88] undone the change in the R code --- instat/static/InstatObject/R/stand_alone_functions.R | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index 94ebb728ade..c31e081a1b9 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2634,15 +2634,7 @@ view_object_data <- function(object, object_format = NULL) { file_name <- view_text_object(object) } else if (identical(object_format, "html")) { file_name <- view_html_object(object) - } else if ("list" %in% class(object)) { # Check if object is a list - # Convert list to HTML - html_content <- paste("
", utils::capture.output(print(object)), "
", collapse="\n") - # Write HTML to a temporary file - temp_file <- tempfile(fileext=".html") - writeLines(html_content, temp_file) - # Open HTML file in default browser - utils::browseURL(temp_file) - } else{ + } else{ print(object) } return(file_name) From 14d1aa5a2c4cd217a134b593d6c1d4b7c7f03966 Mon Sep 17 00:00:00 2001 From: n-thony Date: Thu, 21 Mar 2024 16:05:20 +0300 Subject: [PATCH 32/88] Made code change for summaries R code --- instat/dlgDescribeTwoVariable.vb | 52 ++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/instat/dlgDescribeTwoVariable.vb b/instat/dlgDescribeTwoVariable.vb index 30e4f41a1c4..20471694866 100644 --- a/instat/dlgDescribeTwoVariable.vb +++ b/instat/dlgDescribeTwoVariable.vb @@ -38,10 +38,9 @@ Public Class dlgDescribeTwoVariable clsTabStyleCellTextFunction, clsTabStyleCellTitleFunction, clsTabStyleFunction, clsTabStylePxFunction, clsgtExtrasThemesFuction As New RFunction - Private clsGroupByPipeOperator, clsSummaryOperator As New ROperator + Private clsGroupByPipeOperator, clsSummaryOperator, clsTildOperator, clsTildPivotOperator, clsMapOperator As New ROperator - Private clsFrequencyTablesFunction, clsgtFunction, clsCombineFrequencyFactorParameterFunction, - clsSelectFunction, clsRenameCombineFunction As New RFunction + Private clsgtFunction, clsMapSummaryFunction, clsMapGtFunction, clsMapPivotFunction As New RFunction 'Frequency Parameters Private lstFrequencyParameters As New List(Of String)({"percentage_type", "margin_name", "perc_total_factors", "perc_decimal", @@ -198,9 +197,15 @@ Public Class dlgDescribeTwoVariable clsTabFootnoteOperator = New ROperator clsgtFunction = New RFunction clsSummaryOperator = New ROperator + clsMapOperator = New ROperator clsPivotWiderFunction = New RFunction clsgtExtrasThemesFuction = New RFunction clsMutableOperator = New ROperator + clsTildOperator = New ROperator + clsTildPivotOperator = New ROperator + clsMapSummaryFunction = New RFunction + clsMapPivotFunction = New RFunction + clsMapGtFunction = New RFunction ucrSelectorDescribeTwoVar.Reset() ucrReceiverFirstVars.SetMeAsReceiver() @@ -277,17 +282,43 @@ Public Class dlgDescribeTwoVariable clsSummaryTableFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$summary_table") clsSummaryTableFunction.AddParameter("treat_columns_as_factor", "FALSE", iPosition:=3) - clsSummaryTableFunction.SetAssignTo("summary_table") + 'clsSummaryTableFunction.SetAssignTo("summary_table") + + clsTildOperator.SetOperation("~") + clsTildOperator.AddParameter("right", clsRFunctionParameter:=clsSummaryTableFunction) + clsTildOperator.bBrackets = False + + clsTildPivotOperator.SetOperation("~") + clsTildPivotOperator.AddParameter("right", clsRFunctionParameter:=clsPivotWiderFunction) + clsTildPivotOperator.bBrackets = False + + clsMapSummaryFunction.SetPackageName("purrr") + clsMapSummaryFunction.SetRCommand("map") + clsMapSummaryFunction.AddParameter(".f", clsROperatorParameter:=clsTildOperator, iPosition:=1) + + clsMapPivotFunction.SetPackageName("purrr") + clsMapPivotFunction.SetRCommand("map") + clsMapPivotFunction.AddParameter("pivot", clsROperatorParameter:=clsTildPivotOperator) + + clsMapGtFunction.SetPackageName("purrr") + clsMapGtFunction.SetRCommand("map") + clsMapGtFunction.AddParameter("gttbl", clsRFunctionParameter:=clsgtFunction) clsgtFunction.SetPackageName("gt") clsgtFunction.SetRCommand("gt") clsSummaryOperator.SetOperation("%>%") - clsSummaryOperator.AddParameter("tableFun", clsRFunctionParameter:=clsSummaryTableFunction, iPosition:=0) - clsSummaryOperator.AddParameter("gttbl", clsRFunctionParameter:=clsgtFunction, iPosition:=1) + clsSummaryOperator.AddParameter("tableFun", clsRFunctionParameter:=clsMapSummaryFunction, iPosition:=0) + 'clsSummaryOperator.AddParameter("gttbl", clsRFunctionParameter:=clsgtFunction, iPosition:=1) + + clsMapOperator.SetOperation("%>%") + clsMapOperator.AddParameter("tableFun", clsRFunctionParameter:=clsMapSummaryFunction, iPosition:=1) + clsMapOperator.AddParameter("pivot", clsRFunctionParameter:=clsMapPivotFunction, iPosition:=2) + clsMapOperator.AddParameter("gt", clsRFunctionParameter:=clsMapGtFunction, iPosition:=3) + clsMapOperator.bBrackets = False clsJoiningPipeOperator.SetOperation("%>%") - clsJoiningPipeOperator.AddParameter("gtable", clsROperatorParameter:=clsSummaryOperator, iPosition:=0) + clsJoiningPipeOperator.AddParameter("gtable", clsROperatorParameter:=clsMapOperator, iPosition:=0) clsJoiningPipeOperator.bBrackets = False clsTableSourcenoteFunction.SetPackageName("gt") @@ -340,6 +371,7 @@ Public Class dlgDescribeTwoVariable ucrReceiverFirstVars.AddAdditionalCodeParameterPair(clsRAnovaFunction, New RParameter("x_col_names", 1), iAdditionalPairNo:=1) ucrReceiverFirstVars.AddAdditionalCodeParameterPair(clsRCorrelationFunction, New RParameter("x_col_names", 1), iAdditionalPairNo:=2) ucrReceiverFirstVars.AddAdditionalCodeParameterPair(clsSkimrFunction, New RParameter("col_names", 1, bNewIncludeArgumentName:=False), iAdditionalPairNo:=3) + ucrReceiverFirstVars.AddAdditionalCodeParameterPair(clsMapSummaryFunction, New RParameter(".x", 1), iAdditionalPairNo:=4) ucrSelectorDescribeTwoVar.AddAdditionalCodeParameterPair(clsRAnovaFunction, ucrSelectorDescribeTwoVar.GetParameter(), iAdditionalPairNo:=1) ucrSelectorDescribeTwoVar.AddAdditionalCodeParameterPair(clsSummaryTableFunction, ucrSelectorDescribeTwoVar.GetParameter(), iAdditionalPairNo:=2) @@ -615,9 +647,9 @@ Public Class dlgDescribeTwoVariable If rdoTwoVariable.Checked Then clsSummaryOperator.AddParameter("col_factor", clsRFunctionParameter:=clsPivotWiderFunction, iPosition:=1) If IsFactorByFactor() Then - clsSummaryTableFunction.AddParameter("factors", "c(" & Chr(34) & ucrReceiverFirstVars.lstSelectedVariables.Items(0).Text & Chr(34) & "," & ucrReceiverSecondTwoVariableFactor.GetVariableNames & ")") - clsSummaryTableFunction.AddParameter("columns_to_summarise", Chr(34) & ucrReceiverFirstVars.lstSelectedVariables.Items(0).Text & Chr(34)) - clsPivotWiderFunction.AddParameter("names_from", ucrReceiverFirstVars.lstSelectedVariables.Items(0).Text, iPosition:=0) + clsSummaryTableFunction.AddParameter("factors", "c(" & ucrReceiverSecondTwoVariableFactor.GetVariableNames & "," & ".x" & ")") + clsSummaryTableFunction.AddParameter("columns_to_summarise", ".x") + clsPivotWiderFunction.AddParameter("names_from", "{{.x}}", iPosition:=0) Else clsPivotWiderFunction.AddParameter("names_from", Chr(39) & "summary-variable" & Chr(39), iPosition:=0) clsSummaryTableFunction.AddParameter("columns_to_summarise", ucrReceiverFirstVars.GetVariableNames) From e7647712847abe7738a7d4a148d95762f634974b Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:01:56 +0100 Subject: [PATCH 33/88] Fixed the preview issue and scale operator issue --- instat/dlgTransform.Designer.vb | 12 ---- instat/dlgTransform.vb | 97 ++++++++++++++++++++------------- 2 files changed, 59 insertions(+), 50 deletions(-) diff --git a/instat/dlgTransform.Designer.vb b/instat/dlgTransform.Designer.vb index b0115e8bf16..0650f55b907 100644 --- a/instat/dlgTransform.Designer.vb +++ b/instat/dlgTransform.Designer.vb @@ -111,7 +111,6 @@ Partial Class dlgTransform Me.ucrPnlColumnSelectOptions = New instat.UcrPanel() Me.rdoSingle = New System.Windows.Forms.RadioButton() Me.rdoMultiple = New System.Windows.Forms.RadioButton() - Me.ucrNewColName = New instat.ucrSave() Me.grpTies.SuspendLayout() Me.grpMissingValues.SuspendLayout() Me.grpNumericOptions.SuspendLayout() @@ -963,22 +962,12 @@ Partial Class dlgTransform Me.rdoMultiple.Text = "Multiple" Me.rdoMultiple.UseVisualStyleBackColor = True ' - 'ucrNewColName - ' - Me.ucrNewColName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrNewColName.Location = New System.Drawing.Point(10, 368) - Me.ucrNewColName.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.ucrNewColName.Name = "ucrNewColName" - Me.ucrNewColName.Size = New System.Drawing.Size(331, 22) - Me.ucrNewColName.TabIndex = 69 - ' 'dlgTransform ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(440, 445) - Me.Controls.Add(Me.ucrNewColName) Me.Controls.Add(Me.rdoMultiple) Me.Controls.Add(Me.rdoSingle) Me.Controls.Add(Me.ucrPnlColumnSelectOptions) @@ -1102,5 +1091,4 @@ Partial Class dlgTransform Friend WithEvents rdoMultiple As RadioButton Friend WithEvents rdoSingle As RadioButton Friend WithEvents ucrPnlColumnSelectOptions As UcrPanel - Friend WithEvents ucrNewColName As ucrSave End Class diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index baf11d2ff71..8ccb377a1a5 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -195,7 +195,7 @@ Public Class dlgTransform ucrPnlNonNegative.AddParameterValuesCondition(rdoNaturalLog, "check", "log") ucrPnlNonNegative.AddParameterValuesCondition(rdoPower, "check", "power") - ucrPnlColumnSelectOptions.AddToLinkedControls(ucrSaveNew, {rdoSingle}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlColumnSelectOptions.AddToLinkedControls(ucrChkPreview, {rdoSingle}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudSignifDigits, {rdoSignificantDigits}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudRoundOfDigits, {rdoRoundOf}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudLagLeadPosition, {rdoLead}, bNewLinkedHideIfParameterMissing:=True) @@ -299,6 +299,8 @@ Public Class dlgTransform ucrInputSubtract.AddQuotesIfUnrecognised = False ucrChkSubtract.SetText("Subtract") + ucrChkSubtract.AddParameterValuesCondition(True, "subtract", "True") + ucrChkSubtract.AddParameterValuesCondition(False, "subtract", "False") ucrInputMultiply.SetParameter(New RParameter("y", 1)) dctMultiplyValues.Add("1", "1") @@ -312,6 +314,8 @@ Public Class dlgTransform ucrInputMultiply.AddQuotesIfUnrecognised = False ucrChkMultiply.SetText("Multiply") + ucrChkMultiply.AddParameterValuesCondition(True, "multiple", "True") + ucrChkMultiply.AddParameterValuesCondition(False, "multiple", "False") ucrInputDivide.SetParameter(New RParameter("z", 1)) dctDivideValues.Add("1", "1") @@ -324,6 +328,8 @@ Public Class dlgTransform ucrInputDivide.AddQuotesIfUnrecognised = False ucrChkDivide.SetText("Divide") + ucrChkDivide.AddParameterValuesCondition(True, "divide", "True") + ucrChkDivide.AddParameterValuesCondition(False, "divide", "False") ucrInputAdd.SetParameter(New RParameter("v", 1)) dctAddValues.Add("0", "0") @@ -333,18 +339,13 @@ Public Class dlgTransform ucrInputAdd.AddQuotesIfUnrecognised = False ucrChkAdd.SetText("Add") + ucrChkAdd.AddParameterValuesCondition(True, "add", "True") + ucrChkAdd.AddParameterValuesCondition(False, "add", "False") ucrChkPreview.SetText("Preview") ucrChkPreview.AddParameterValuesCondition(True, "preview", "FALSE") ucrChkPreview.AddParameterValuesCondition(False, "preview", "TRUE") - 'ucrNewColName - ucrNewColName.SetIsComboBox() - ucrNewColName.SetSaveTypeAsColumn() - ucrNewColName.SetDataFrameSelector(ucrSelectorForRank.ucrAvailableDataFrames) - ucrNewColName.SetLabelText("New Column:") - ucrNewColName.setLinkedReceiver(ucrReceiverRank) - ucrChkOmitNA.SetText("Omit NA") ucrChkOmitNA.SetParameter(New RParameter("na.rm", 1)) ucrChkOmitNA.SetValuesCheckedAndUnchecked("TRUE", "FALSE") @@ -417,11 +418,8 @@ Public Class dlgTransform ucrSelectorForRank.Reset() ucrReceiverRank.SetMeAsReceiver() ucrSaveNew.Reset() - ucrNewColName.Reset() ucrInputLogicOperations.SetText("==") rdoSingle.Checked = True - ucrNewColName.Visible = False - rdoMultiple.Checked = ucrNewColName.Visible clsConstantDummyFunction.AddParameter("checked", "FALSE", iPosition:=0) clsConstantDummyFunction.AddParameter("preview", "TRUE", iPosition:=1) @@ -593,7 +591,6 @@ Public Class dlgTransform clsBooleanColsOperator.SetOperation("==") clsIsNAColsFunction.SetRCommand("is.na") - clsGetDataFrameFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_data_frame") clsMutateFunction.SetPackageName("dplyr") @@ -621,6 +618,11 @@ Public Class dlgTransform clsDummyTransformFunction.AddParameter("col", "single", iPosition:=1) clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) + clsNumericDummyFunction.AddParameter("multiple", "False", iPosition:=1) + clsNumericDummyFunction.AddParameter("divide", "False", iPosition:=2) + clsNumericDummyFunction.AddParameter("add", "False", iPosition:=3) + clsNumericDummyFunction.AddParameter("subtract", "False", iPosition:=4) + clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) clsColumnsFunction.SetRCommand("colnames") @@ -638,8 +640,6 @@ Public Class dlgTransform clsAddColumnsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRank.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) clsAddColumnsFunction.AddParameter("before", "FALSE", iPosition:=2) - - 'ucrBase.clsRsyntax.SetBaseRFunction(clsRoundFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) @@ -677,18 +677,15 @@ Public Class dlgTransform ucrReceiverRank.AddAdditionalCodeParameterPair(clsLeadColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=22) ucrReceiverRank.AddAdditionalCodeParameterPair(clsDiffColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=23) ucrReceiverRank.AddAdditionalCodeParameterPair(clsMeanColsFunction, New RParameter("x", 0), iAdditionalPairNo:=24) - 'ucrReceiverRank.AddAdditionalCodeParameterPair(clsSubtractColsOperator, New RParameter("x", 0), iAdditionalPairNo:=25) ucrReceiverRank.AddAdditionalCodeParameterPair(clsStandardDevColsFunction, New RParameter("x", 0), iAdditionalPairNo:=25) ucrReceiverRank.AddAdditionalCodeParameterPair(clsRankColsFunction, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=26) ucrReceiverRank.AddAdditionalCodeParameterPair(clsAddConstantColsOperator, ucrReceiverRank.GetParameter(), iAdditionalPairNo:=27) - 'ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleSubtractColsOperator, New RParameter("x", 0), iAdditionalPairNo:=28) ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleMeanColsFunction, New RParameter("x", 0), iAdditionalPairNo:=28) ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleMinColsFunction, New RParameter("x", 0), iAdditionalPairNo:=29) ucrReceiverRank.AddAdditionalCodeParameterPair(clsBooleanColsOperator, New RParameter("x", 0), iAdditionalPairNo:=30) ucrReceiverRank.AddAdditionalCodeParameterPair(clsIsNAColsFunction, New RParameter("x", 0), iAdditionalPairNo:=31) - ucrChkOmitNA.AddAdditionalCodeParameterPair(clsStandardDevFunction, ucrChkOmitNA.GetParameter(), iAdditionalPairNo:=1) ucrSelectorForRank.AddAdditionalCodeParameterPair(clsGetColSelectionNamesFunction, ucrSelectorForRank.GetParameter, iAdditionalPairNo:=1) ucrNudRoundOfDigits.AddAdditionalCodeParameterPair(clsRoundColsFunction, New RParameter("digits", 1), iAdditionalPairNo:=1) @@ -698,7 +695,6 @@ Public Class dlgTransform ucrPnlMissingValues.AddAdditionalCodeParameterPair(clsRankColsFunction, New RParameter("na.last", 2), iAdditionalPairNo:=1) ucrChkMissingLast.AddAdditionalCodeParameterPair(clsSortColsFunction, New RParameter("na.last", 1), iAdditionalPairNo:=1) ucrChkDecreasing.AddAdditionalCodeParameterPair(clsSortColsFunction, New RParameter("decreasing", 2), iAdditionalPairNo:=1) - 'ucrInputLogicalValues.AddAdditionalCodeParameterPair(clsBooleanColsOperator, New RParameter("x", 1), iAdditionalPairNo:=1) ucrInputMultiply.AddAdditionalCodeParameterPair(clsScaleMultiplyColsOperator, New RParameter("y", 1), iAdditionalPairNo:=1) ucrInputDivide.AddAdditionalCodeParameterPair(clsScaleDivideColsOperator, New RParameter("z", 1), iAdditionalPairNo:=1) ucrInputAdd.AddAdditionalCodeParameterPair(clsScaleAddColsOperator, New RParameter("v", 1), iAdditionalPairNo:=1) @@ -744,9 +740,13 @@ Public Class dlgTransform ucrPnlNonNegative.SetRCode(clsNonNegativeDummyFunction, bReset) ucrChkOmitNA.SetRCode(clsMeanFunction, bReset) ucrChkPreview.SetRCode(clsConstantDummyFunction, bReset) - 'ucrInputLogicalValues.SetRCode(clsBooleanOperator, bReset) + If bReset Then ucrReceiverRank.SetRCode(clsRankFunction, bReset) + ucrChkDivide.SetRCode(clsNumericDummyFunction, bReset) + ucrChkAdd.SetRCode(clsNumericDummyFunction, bReset) + ucrChkMultiply.SetRCode(clsNumericDummyFunction, bReset) + ucrChkSubtract.SetRCode(clsNumericDummyFunction, bReset) End If bResetRCode = True End Sub @@ -777,8 +777,10 @@ Public Class dlgTransform ucrSaveNew.SetPrefix(ucrReceiverRank.GetVariableNames(bWithQuotes:=False)) End If ElseIf rdoMultiple.Checked Then - If Not ucrReceiverRank.IsEmpty Then - clsPasteFunction.AddParameter("col_data", Chr(34) & "_" & "transformed" & Chr(34), iPosition:=1, bIncludeArgumentName:=False) + If Not ucrReceiverRank.IsEmpty AndAlso (Not ucrSaveNew.bUserTyped) Then + Dim strDataframeName As String = ucrReceiverRank.GetVariableNames(bWithQuotes:=False) + ucrSaveNew.SetPrefix(ucrReceiverRank.GetVariableNames(bWithQuotes:=False)) + clsPasteFunction.AddParameter("col_data", Chr(34) & "_" & strDataframeName & Chr(34), iPosition:=1, bIncludeArgumentName:=False) clsAddColumnsFunction.AddParameter("col_data", "col", iPosition:=1) End If @@ -799,8 +801,6 @@ Public Class dlgTransform ucrChkMissingLast.ControlValueChanged, ucrChkDecreasing.ControlValueChanged, ucrChkDivide.ControlValueChanged, ucrChkAdd.ControlValueChanged, ucrChkMultiply.ControlValueChanged, ucrChkSubtract.ControlValueChanged ucrBase.clsRsyntax.ClearCodes() - 'If bResetRCode Then - If rdoSingle.Checked Then If rdoRank.Checked Then @@ -909,7 +909,6 @@ Public Class dlgTransform End If - 'End If SetPreviewText() UpdateNonNegativeParameters() NewDefaultName() @@ -1110,19 +1109,6 @@ Public Class dlgTransform End Sub Private Sub ucrInputLogicalValues_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputLogicalValues.ControlValueChanged - 'If rdoSingle.Checked Then - ' If Not ucrInputLogicalValues.IsEmpty Then - ' clsBooleanOperator.AddParameter("right", ucrInputLogicalValues.GetText, iPosition:=1) - ' Else - ' clsBooleanOperator.RemoveParameterByName("right") - ' End If - 'ElseIf rdoMultiple.Checked Then - ' If Not ucrInputLogicalValues.IsEmpty Then - ' clsBooleanColsOperator.AddParameter("right", ucrInputLogicalValues.GetText, iPosition:=1) - ' Else - ' clsBooleanColsOperator.RemoveParameterByName("right") - ' End If - 'End If AddRemoveLogicalValues() End Sub @@ -1164,7 +1150,6 @@ Public Class dlgTransform End Sub Private Sub ucrPnlColumnSelectOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlColumnSelectOptions.ControlValueChanged, ucrReceiverRank.ControlValueChanged, ucrSelectorForRank.ControlValueChanged - clsGetDataFrameFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRank.strCurrentDataFrame & Chr(34), iPosition:=0, bIncludeArgumentName:=False) clsGetDataFrameFunction.AddParameter("column_selection_name ", ucrReceiverRank.GetVariableNames, iPosition:=1) clsGetDataFrameFunction.SetAssignTo(ucrSelectorForRank.ucrAvailableDataFrames.cboAvailableDataFrames.Text) @@ -1184,4 +1169,40 @@ Public Class dlgTransform End If AddRemoveLogicalValues() End Sub + + Private Sub ucrChkMultiply_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkMultiply.ControlValueChanged, ucrInputMultiply.ControlValueChanged + If ucrChkMultiply.Checked AndAlso Not ucrInputMultiply.IsEmpty Then + clsScaleMultiplyColsOperator.AddParameter("y", ucrInputMultiply.GetText, iPosition:=1) + + Else + clsScaleMultiplyColsOperator.RemoveParameterByName("y") + End If + End Sub + + Private Sub ucrChkAdd_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAdd.ControlValueChanged, ucrInputAdd.ControlValueChanged + If ucrChkAdd.Checked AndAlso Not ucrInputAdd.IsEmpty Then + clsScaleAddColsOperator.AddParameter("v", ucrInputAdd.GetText, iPosition:=1) + + Else + clsScaleAddColsOperator.RemoveParameterByName("v") + End If + End Sub + + Private Sub ucrChkSubtract_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkSubtract.ControlValueChanged, ucrInputSubtract.ControlValueChanged + If ucrChkSubtract.Checked AndAlso Not ucrInputSubtract.IsEmpty Then + clsScaleSubtractColsOperator.AddParameter("u", ucrInputSubtract.GetText, iPosition:=1) + + Else + clsScaleSubtractColsOperator.RemoveParameterByName("u") + End If + End Sub + + Private Sub ucrChkDivide_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDivide.ControlValueChanged, ucrInputDivide.ControlValueChanged + If ucrChkDivide.Checked AndAlso Not ucrInputDivide.IsEmpty Then + clsScaleDivideColsOperator.AddParameter("z", ucrInputDivide.GetText, iPosition:=1) + + Else + clsScaleDivideColsOperator.RemoveParameterByName("z") + End If + End Sub End Class \ No newline at end of file From 31a723770ebd8ea6c5f24ecc3ab6ebb457cf6602 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:08:34 +0100 Subject: [PATCH 34/88] Changing the label text for ucrSave when switch between single and multiple recevier --- instat/dlgTransform.vb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 8ccb377a1a5..ad07416567b 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -773,10 +773,12 @@ Public Class dlgTransform Private Sub NewDefaultName() If rdoSingle.Checked Then + ucrSaveNew.SetLabelText("New Column Name:") If (Not ucrSaveNew.bUserTyped) AndAlso Not ucrReceiverRank.IsEmpty Then ucrSaveNew.SetPrefix(ucrReceiverRank.GetVariableNames(bWithQuotes:=False)) End If ElseIf rdoMultiple.Checked Then + ucrSaveNew.SetLabelText("Suffix Name:") If Not ucrReceiverRank.IsEmpty AndAlso (Not ucrSaveNew.bUserTyped) Then Dim strDataframeName As String = ucrReceiverRank.GetVariableNames(bWithQuotes:=False) ucrSaveNew.SetPrefix(ucrReceiverRank.GetVariableNames(bWithQuotes:=False)) From fa5d013c70d68ffc277f3801c572ff0806be1378 Mon Sep 17 00:00:00 2001 From: n-thony Date: Thu, 21 Mar 2024 17:36:13 +0300 Subject: [PATCH 35/88] minor code change --- instat/dlgDescribeTwoVariable.vb | 46 +++++++++++++++++--------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/instat/dlgDescribeTwoVariable.vb b/instat/dlgDescribeTwoVariable.vb index 20471694866..6ce371115ba 100644 --- a/instat/dlgDescribeTwoVariable.vb +++ b/instat/dlgDescribeTwoVariable.vb @@ -38,7 +38,7 @@ Public Class dlgDescribeTwoVariable clsTabStyleCellTextFunction, clsTabStyleCellTitleFunction, clsTabStyleFunction, clsTabStylePxFunction, clsgtExtrasThemesFuction As New RFunction - Private clsGroupByPipeOperator, clsSummaryOperator, clsTildOperator, clsTildPivotOperator, clsMapOperator As New ROperator + Private clsGroupByPipeOperator, clsSummaryOperator, clsTildOperator, clsTildPivotOperator, clsMapOperator, clsPivotOperator As New ROperator Private clsgtFunction, clsMapSummaryFunction, clsMapGtFunction, clsMapPivotFunction As New RFunction 'Frequency Parameters @@ -206,6 +206,7 @@ Public Class dlgDescribeTwoVariable clsMapSummaryFunction = New RFunction clsMapPivotFunction = New RFunction clsMapGtFunction = New RFunction + clsPivotOperator = New ROperator ucrSelectorDescribeTwoVar.Reset() ucrReceiverFirstVars.SetMeAsReceiver() @@ -223,7 +224,7 @@ Public Class dlgDescribeTwoVariable clsDummyFunction.AddParameter("row_sum", "False", iPosition:=3) clsPivotWiderFunction.SetRCommand("pivot_wider") - clsPivotWiderFunction.AddParameter("values_from", "value", iPosition:=1) + clsPivotWiderFunction.AddParameter("values_from", "value", iPosition:=2) clsFootnoteCellBodyFunction.SetPackageName("gt") clsFootnoteCellBodyFunction.SetRCommand("cells_body") @@ -287,38 +288,39 @@ Public Class dlgDescribeTwoVariable clsTildOperator.SetOperation("~") clsTildOperator.AddParameter("right", clsRFunctionParameter:=clsSummaryTableFunction) clsTildOperator.bBrackets = False - - clsTildPivotOperator.SetOperation("~") - clsTildPivotOperator.AddParameter("right", clsRFunctionParameter:=clsPivotWiderFunction) - clsTildPivotOperator.bBrackets = False + clsTildOperator.bForceIncludeOperation = True + clsTildOperator.bSpaceAroundOperation = False clsMapSummaryFunction.SetPackageName("purrr") clsMapSummaryFunction.SetRCommand("map") - clsMapSummaryFunction.AddParameter(".f", clsROperatorParameter:=clsTildOperator, iPosition:=1) - - clsMapPivotFunction.SetPackageName("purrr") - clsMapPivotFunction.SetRCommand("map") - clsMapPivotFunction.AddParameter("pivot", clsROperatorParameter:=clsTildPivotOperator) + clsMapSummaryFunction.AddParameter(".f", clsROperatorParameter:=clsMapOperator, iPosition:=1) clsMapGtFunction.SetPackageName("purrr") clsMapGtFunction.SetRCommand("map") - clsMapGtFunction.AddParameter("gttbl", clsRFunctionParameter:=clsgtFunction) + clsMapGtFunction.AddParameter("gttbl", clsRFunctionParameter:=clsgtFunction, bIncludeArgumentName:=False) clsgtFunction.SetPackageName("gt") clsgtFunction.SetRCommand("gt") clsSummaryOperator.SetOperation("%>%") - clsSummaryOperator.AddParameter("tableFun", clsRFunctionParameter:=clsMapSummaryFunction, iPosition:=0) + clsSummaryOperator.AddParameter("data", clsRFunctionParameter:=ucrSelectorDescribeTwoVar.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) + clsSummaryOperator.AddParameter("tableFun", clsRFunctionParameter:=clsMapSummaryFunction, iPosition:=1) 'clsSummaryOperator.AddParameter("gttbl", clsRFunctionParameter:=clsgtFunction, iPosition:=1) + clsPivotOperator.SetOperation("%>%") + clsPivotOperator.AddParameter("left", clsRFunctionParameter:=clsPivotWiderFunction) + clsPivotOperator.AddParameter("right", clsRFunctionParameter:=clsgtFunction) + clsPivotOperator.bBrackets = False + clsMapOperator.SetOperation("%>%") - clsMapOperator.AddParameter("tableFun", clsRFunctionParameter:=clsMapSummaryFunction, iPosition:=1) - clsMapOperator.AddParameter("pivot", clsRFunctionParameter:=clsMapPivotFunction, iPosition:=2) - clsMapOperator.AddParameter("gt", clsRFunctionParameter:=clsMapGtFunction, iPosition:=3) + clsMapOperator.AddParameter("left", clsROperatorParameter:=clsTildOperator) + 'clsMapOperator.AddParameter("data", clsRFunctionParameter:=ucrSelectorDescribeTwoVar.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) + 'clsMapOperator.AddParameter("tableFun", clsRFunctionParameter:=clsMapSummaryFunction, iPosition:=1) + clsMapOperator.AddParameter("right", clsROperatorParameter:=clsPivotOperator) clsMapOperator.bBrackets = False clsJoiningPipeOperator.SetOperation("%>%") - clsJoiningPipeOperator.AddParameter("gtable", clsROperatorParameter:=clsMapOperator, iPosition:=0) + clsJoiningPipeOperator.AddParameter("gtable", clsROperatorParameter:=clsSummaryOperator, iPosition:=0) clsJoiningPipeOperator.bBrackets = False clsTableSourcenoteFunction.SetPackageName("gt") @@ -645,13 +647,13 @@ Public Class dlgDescribeTwoVariable Private Sub FactorColumns() If rdoTwoVariable.Checked Then - clsSummaryOperator.AddParameter("col_factor", clsRFunctionParameter:=clsPivotWiderFunction, iPosition:=1) + 'clsSummaryOperator.AddParameter("col_factor", clsRFunctionParameter:=clsPivotWiderFunction, iPosition:=1) If IsFactorByFactor() Then clsSummaryTableFunction.AddParameter("factors", "c(" & ucrReceiverSecondTwoVariableFactor.GetVariableNames & "," & ".x" & ")") clsSummaryTableFunction.AddParameter("columns_to_summarise", ".x") - clsPivotWiderFunction.AddParameter("names_from", "{{.x}}", iPosition:=0) + clsPivotWiderFunction.AddParameter("names_from", "{{ .x }}", iPosition:=1) Else - clsPivotWiderFunction.AddParameter("names_from", Chr(39) & "summary-variable" & Chr(39), iPosition:=0) + clsPivotWiderFunction.AddParameter("names_from", Chr(39) & "summary-variable" & Chr(39), iPosition:=1) clsSummaryTableFunction.AddParameter("columns_to_summarise", ucrReceiverFirstVars.GetVariableNames) SummariesInRowsOrCols() End If @@ -801,10 +803,10 @@ Public Class dlgDescribeTwoVariable Private Sub SummariesInRowsOrCols() If ucrChkSummariesRowCol.Checked Then - clsPivotWiderFunction.AddParameter("names_from", ucrReceiverSecondTwoVariableFactor.GetVariableNames(False), iPosition:=0) + clsPivotWiderFunction.AddParameter("names_from", ucrReceiverSecondTwoVariableFactor.GetVariableNames(False), iPosition:=1) clsDummyFunction.AddParameter("row_sum", "True", iPosition:=3) Else - clsPivotWiderFunction.AddParameter("names_from", Chr(39) & "summary-variable" & Chr(39), iPosition:=0) + clsPivotWiderFunction.AddParameter("names_from", Chr(39) & "summary-variable" & Chr(39), iPosition:=1) clsDummyFunction.AddParameter("row_sum", "False", iPosition:=3) End If ManageControlsVisibility() From edb1f2d883cb5419792d97e296b7eeaaf18f9b2d Mon Sep 17 00:00:00 2001 From: n-thony Date: Thu, 21 Mar 2024 23:43:14 +0300 Subject: [PATCH 36/88] improve the display of multiple html --- instat/clsRLink.vb | 13 ++++++++----- .../static/InstatObject/R/instat_object_R6.R | 18 ++++++++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index 91b7e41a18d..8a449f468c1 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -996,9 +996,12 @@ Public Class RLink End If End If + Dim lines() As String = strOutput.Split({vbCrLf, Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) + For Each line In lines + 'log script and output + clsOutputLogger.AddOutput(strScriptWithComment, line, bAsFile, bDisplayOutputInExternalViewer) + Next - 'log script and output - clsOutputLogger.AddOutput(strScriptWithComment, strOutput, bAsFile, bDisplayOutputInExternalViewer) Catch e As Exception MsgBox(e.Message & Environment.NewLine & "The error occurred in attempting to run the following R command(s):" & Environment.NewLine & strScript, MsgBoxStyle.Critical, "Error running R command(s)") @@ -1032,9 +1035,9 @@ Public Class RLink 'get the file path name, check if it exists and whether it has contents 'if not, just return empty file path strFilePath = String.Join(Environment.NewLine, expTemp.AsCharacter()) - If Not File.Exists(strFilePath) OrElse New FileInfo(strFilePath).Length = 0 Then - strFilePath = "" - End If + Dim lines() As String = strFilePath.Split({vbCrLf, Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) + lines = lines.Where(Function(line) File.Exists(line) OrElse New FileInfo(line).Length = 0).ToArray() + strFilePath = If(lines.Length = 0, "", String.Join(Environment.NewLine, lines)) End If Return strFilePath End Function diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index fd19d0d0f00..b69e3acf599 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -643,16 +643,22 @@ DataBook$set("public", "get_object", function(data_name = NULL, object_name) { DataBook$set("public", "get_object_data", function(data_name = NULL, object_name, as_file = FALSE) { out <- self$get_object(data_name = data_name, object_name = object_name) - if(is.null(out)){ + result_list <- list() + + if (is.null(out)) { return(NULL) - }else if(as_file){ - out <- view_object_data(object = out$object, object_format = out$object_format) - }else{ + } else if (as_file) { + for (i in seq_along(out$object)) { + result_list[[i]] <- view_object_data(object = out$object[[i]], object_format = out$object_format) + } + out <- result_list + } else { out <- out$object } + return(out) -} -) +}) + #returns object data from the object_names character vector DataBook$set("public", "get_objects_data", function(data_name = NULL, object_names = NULL, as_files = FALSE) { From 1659b94a746b3feb1a09d8d80a1f0082665ddc62 Mon Sep 17 00:00:00 2001 From: n-thony Date: Fri, 22 Mar 2024 00:25:16 +0300 Subject: [PATCH 37/88] code changes --- instat/clsRLink.vb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index 8a449f468c1..9cb6a94b1d7 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -997,11 +997,14 @@ Public Class RLink End If Dim lines() As String = strOutput.Split({vbCrLf, Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) - For Each line In lines - 'log script and output - clsOutputLogger.AddOutput(strScriptWithComment, line, bAsFile, bDisplayOutputInExternalViewer) - Next - + If Not String.IsNullOrEmpty(strOutput) AndAlso lines.All(Function(line) File.Exists(line) AndAlso New FileInfo(line).Length > 0 AndAlso + Path.GetExtension(line).Equals(".html", StringComparison.OrdinalIgnoreCase)) Then + For Each line In lines + clsOutputLogger.AddOutput(strScriptWithComment, line, bAsFile, bDisplayOutputInExternalViewer) + Next + Else + clsOutputLogger.AddOutput(strScriptWithComment, strOutput, bAsFile, bDisplayOutputInExternalViewer) + End If Catch e As Exception MsgBox(e.Message & Environment.NewLine & "The error occurred in attempting to run the following R command(s):" & Environment.NewLine & strScript, MsgBoxStyle.Critical, "Error running R command(s)") @@ -1036,7 +1039,7 @@ Public Class RLink 'if not, just return empty file path strFilePath = String.Join(Environment.NewLine, expTemp.AsCharacter()) Dim lines() As String = strFilePath.Split({vbCrLf, Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) - lines = lines.Where(Function(line) File.Exists(line) OrElse New FileInfo(line).Length = 0).ToArray() + lines = lines.Where(Function(line) File.Exists(line) OrElse New FileInfo(line).Length > 0).ToArray() strFilePath = If(lines.Length = 0, "", String.Join(Environment.NewLine, lines)) End If Return strFilePath From 5ed314602742a06f59315195e4723ee86d69aba5 Mon Sep 17 00:00:00 2001 From: n-thony Date: Fri, 22 Mar 2024 00:41:00 +0300 Subject: [PATCH 38/88] minor correction --- instat/static/InstatObject/R/instat_object_R6.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index b69e3acf599..27aedf9a4f5 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -648,10 +648,13 @@ DataBook$set("public", "get_object_data", function(data_name = NULL, object_name if (is.null(out)) { return(NULL) } else if (as_file) { + if("html" %in% out$object_format){ for (i in seq_along(out$object)) { result_list[[i]] <- view_object_data(object = out$object[[i]], object_format = out$object_format) } out <- result_list + } else{ out <- view_object_data(object = out$object, object_format = out$object_format) +} } else { out <- out$object } From 303f5c8ad9f6923bb559bd5578d528b578b30277 Mon Sep 17 00:00:00 2001 From: n-thony Date: Fri, 22 Mar 2024 09:42:21 +0300 Subject: [PATCH 39/88] code cleaning --- instat/dlgDescribeTwoVariable.vb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/instat/dlgDescribeTwoVariable.vb b/instat/dlgDescribeTwoVariable.vb index 6ce371115ba..f3c9791ff6d 100644 --- a/instat/dlgDescribeTwoVariable.vb +++ b/instat/dlgDescribeTwoVariable.vb @@ -38,9 +38,9 @@ Public Class dlgDescribeTwoVariable clsTabStyleCellTextFunction, clsTabStyleCellTitleFunction, clsTabStyleFunction, clsTabStylePxFunction, clsgtExtrasThemesFuction As New RFunction - Private clsGroupByPipeOperator, clsSummaryOperator, clsTildOperator, clsTildPivotOperator, clsMapOperator, clsPivotOperator As New ROperator + Private clsGroupByPipeOperator, clsSummaryOperator, clsTildOperator, clsMapOperator, clsPivotOperator As New ROperator - Private clsgtFunction, clsMapSummaryFunction, clsMapGtFunction, clsMapPivotFunction As New RFunction + Private clsgtFunction, clsMapSummaryFunction, clsMapGtFunction As New RFunction 'Frequency Parameters Private lstFrequencyParameters As New List(Of String)({"percentage_type", "margin_name", "perc_total_factors", "perc_decimal", @@ -202,9 +202,7 @@ Public Class dlgDescribeTwoVariable clsgtExtrasThemesFuction = New RFunction clsMutableOperator = New ROperator clsTildOperator = New ROperator - clsTildPivotOperator = New ROperator clsMapSummaryFunction = New RFunction - clsMapPivotFunction = New RFunction clsMapGtFunction = New RFunction clsPivotOperator = New ROperator @@ -380,8 +378,8 @@ Public Class dlgDescribeTwoVariable ucrSaveTable.AddAdditionalRCode(clsJoiningPipeOperator, iAdditionalPairNo:=1) ucrChkOmitMissing.SetRCode(clsSummaryTableFunction, bReset) - ucrReceiverFirstVars.SetRCode(clsSummaryTableFunction, bReset) - ucrReceiverSecondTwoVariableFactor.SetRCode(clsSummaryTableFunction, bReset) + ucrReceiverFirstVars.SetRCode(clsDummyFunction, bReset) + ucrReceiverSecondTwoVariableFactor.SetRCode(clsDummyFunction, bReset) ucrSelectorDescribeTwoVar.SetRCode(clsRCorrelationFunction, bReset) ucrReceiverSkimrGroupByFactor.SetRCode(clsGroupByFunction, bReset) ucrReceiverSecondSkimrGroupByFactor.SetRCode(clsGroupByFunction, bReset) @@ -647,12 +645,12 @@ Public Class dlgDescribeTwoVariable Private Sub FactorColumns() If rdoTwoVariable.Checked Then - 'clsSummaryOperator.AddParameter("col_factor", clsRFunctionParameter:=clsPivotWiderFunction, iPosition:=1) If IsFactorByFactor() Then clsSummaryTableFunction.AddParameter("factors", "c(" & ucrReceiverSecondTwoVariableFactor.GetVariableNames & "," & ".x" & ")") clsSummaryTableFunction.AddParameter("columns_to_summarise", ".x") clsPivotWiderFunction.AddParameter("names_from", "{{ .x }}", iPosition:=1) Else + clsSummaryTableFunction.AddParameter("factors", ucrReceiverSecondTwoVariableFactor.GetVariableNames) clsPivotWiderFunction.AddParameter("names_from", Chr(39) & "summary-variable" & Chr(39), iPosition:=1) clsSummaryTableFunction.AddParameter("columns_to_summarise", ucrReceiverFirstVars.GetVariableNames) SummariesInRowsOrCols() From d7a321d5aada79569eac61378d179fae07a6e7de Mon Sep 17 00:00:00 2001 From: n-thony Date: Fri, 22 Mar 2024 10:14:08 +0300 Subject: [PATCH 40/88] minor addition --- instat/clsRLink.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index 9cb6a94b1d7..20d428591dc 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -1039,7 +1039,7 @@ Public Class RLink 'if not, just return empty file path strFilePath = String.Join(Environment.NewLine, expTemp.AsCharacter()) Dim lines() As String = strFilePath.Split({vbCrLf, Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) - lines = lines.Where(Function(line) File.Exists(line) OrElse New FileInfo(line).Length > 0).ToArray() + lines = lines.Where(Function(line) File.Exists(line) AndAlso New FileInfo(line).Length > 0).ToArray() strFilePath = If(lines.Length = 0, "", String.Join(Environment.NewLine, lines)) End If Return strFilePath From 605fb480a1b75e2af9cdc8a23c2d2681f0231e2f Mon Sep 17 00:00:00 2001 From: n-thony Date: Fri, 22 Mar 2024 12:09:43 +0300 Subject: [PATCH 41/88] R code adjustment for Tables --- .../static/InstatObject/R/instat_object_R6.R | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index 27aedf9a4f5..1a6df18107f 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -641,24 +641,40 @@ DataBook$set("public", "get_object", function(data_name = NULL, object_name) { } ) -DataBook$set("public", "get_object_data", function(data_name = NULL, object_name, as_file = FALSE) { - out <- self$get_object(data_name = data_name, object_name = object_name) +DataBook$set("public", "get_object_data", function(data_name = NULL, + object_name, + as_file = FALSE) { + out <- + self$get_object(data_name = data_name, object_name = object_name) result_list <- list() if (is.null(out)) { return(NULL) - } else if (as_file) { - if("html" %in% out$object_format){ - for (i in seq_along(out$object)) { - result_list[[i]] <- view_object_data(object = out$object[[i]], object_format = out$object_format) + } else if(as_file) { + if ("html" %in% out$object_format) { + if ("gt_tbl" %in% sapply(out$object, class)) { + result_list <- lapply(out$object, function(obj) { + if ("gt_tbl" %in% class(obj)) { + view_object_data(object = obj, + object_format = out$object_format) + } else { + obj + } + }) + out <- result_list + } else { + out <- + view_object_data(object = out$object, + object_format = out$object_format) } - out <- result_list - } else{ out <- view_object_data(object = out$object, object_format = out$object_format) -} + } else { + out <- + view_object_data(object = out$object, + object_format = out$object_format) + } } else { out <- out$object } - return(out) }) From 6f7c27d07eb1fb5f8a236446b194235e80ddb54f Mon Sep 17 00:00:00 2001 From: n-thony Date: Sun, 24 Mar 2024 17:04:25 +0300 Subject: [PATCH 42/88] added comments, code improvement --- instat/clsRLink.vb | 19 ++++-- .../static/InstatObject/R/instat_object_R6.R | 40 +++--------- .../InstatObject/R/stand_alone_functions.R | 65 +++++++++++-------- 3 files changed, 60 insertions(+), 64 deletions(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index 20d428591dc..cb984ee7d89 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -996,16 +996,27 @@ Public Class RLink End If End If - Dim lines() As String = strOutput.Split({vbCrLf, Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) - If Not String.IsNullOrEmpty(strOutput) AndAlso lines.All(Function(line) File.Exists(line) AndAlso New FileInfo(line).Length > 0 AndAlso + ' Split the strOutput into an array of lines, removing empty entries + Dim arrFilesPaths() As String = strOutput.Split({vbCrLf, Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) + + ' Check if strOutput is not empty and all lines correspond to existing HTML files with content + If Not String.IsNullOrEmpty(strOutput) AndAlso arrFilesPaths.All(Function(line) File.Exists(line) AndAlso New FileInfo(line).Length > 0 AndAlso Path.GetExtension(line).Equals(".html", StringComparison.OrdinalIgnoreCase)) Then - For Each line In lines - clsOutputLogger.AddOutput(strScriptWithComment, line, bAsFile, bDisplayOutputInExternalViewer) + ' Iterate through each HTML files + For Each file In arrFilesPaths + ' Add each HTML file as an output to clsOutputLogger + ' strScriptWithComment: the script with associated comments + ' line: the path to the HTML file + ' bAsFile: a boolean indicating whether the output should be treated as a file + ' bDisplayOutputInExternalViewer: a boolean indicating whether to display the output in an external viewer + clsOutputLogger.AddOutput(strScriptWithComment, file, bAsFile, bDisplayOutputInExternalViewer) Next Else + ' If strOutput is empty or does not contain valid HTML files, add strOutput itself as an output clsOutputLogger.AddOutput(strScriptWithComment, strOutput, bAsFile, bDisplayOutputInExternalViewer) End If + Catch e As Exception MsgBox(e.Message & Environment.NewLine & "The error occurred in attempting to run the following R command(s):" & Environment.NewLine & strScript, MsgBoxStyle.Critical, "Error running R command(s)") End Try diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index 1a6df18107f..91d4a1dfd04 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -641,42 +641,18 @@ DataBook$set("public", "get_object", function(data_name = NULL, object_name) { } ) -DataBook$set("public", "get_object_data", function(data_name = NULL, - object_name, - as_file = FALSE) { - out <- - self$get_object(data_name = data_name, object_name = object_name) - result_list <- list() - - if (is.null(out)) { +DataBook$set("public", "get_object_data", function(data_name = NULL, object_name, as_file = FALSE) { + out <- self$get_object(data_name = data_name, object_name = object_name) + if(is.null(out)){ return(NULL) - } else if(as_file) { - if ("html" %in% out$object_format) { - if ("gt_tbl" %in% sapply(out$object, class)) { - result_list <- lapply(out$object, function(obj) { - if ("gt_tbl" %in% class(obj)) { - view_object_data(object = obj, - object_format = out$object_format) - } else { - obj - } - }) - out <- result_list - } else { - out <- - view_object_data(object = out$object, - object_format = out$object_format) - } - } else { - out <- - view_object_data(object = out$object, - object_format = out$object_format) - } - } else { + }else if(as_file){ + out <- view_object_data(object = out$object, object_format = out$object_format) + }else{ out <- out$object } return(out) -}) +} +) #returns object data from the object_names character vector diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index c31e081a1b9..b6a442b0409 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2734,7 +2734,7 @@ view_text_object <- function(text_object){ #if the viewer is not available then #it saves the object as a file in the temporary folder #and returns the file path. -view_html_object <- function(html_object){ +view_html_object <- function(html_objects) { #if there is a viewer, like in the case of RStudio then just print the object #this check is primarily meant to make this function work in a similar manner when run outside R-Instat r_viewer <- base::getOption("viewer") @@ -2742,38 +2742,47 @@ view_html_object <- function(html_object){ #When print command is called in R-Studio, a temp file is #automatically created. TODO. Investigate how that can be done in R-Instat. #as of 07/09/2022 just return the object. Important for RStudio to display the object - return(html_object) + return(html_objects) } + # Initialize a vector to store file names + file_names <- vector("list", length(html_objects)) - file_name <- "" - #get a vector of available class names - object_class_names <- class(html_object) - #get a unique temporary file name from the tempdir path - file_name <- tempfile(pattern = "viewhtml", fileext = ".html") - - #save the object as a html file depending on the object type - if ("htmlwidget" %in% object_class_names) { - #Note. When selfcontained is set to True - #a "Saving a widget with selfcontained = TRUE requires pandoc" error is thrown in R-Instat - #when saving an rpivotTable - #TODO. Investigate how to solve it then. - htmlwidgets::saveWidget(html_object, file = file_name, selfcontained = FALSE) - } else if ("sjTable" %in% object_class_names) { - #"sjTable" objects are not compatible with "htmlwidgets" package. So they have to be saved differently - #"sjplot" package produces "sjTable" objects - html_object$file = file_name - #TODO. Is there any other function that can save an sjTable to a html file? - print(html_object) - } else if ("gt_tbl" %in% object_class_names) { - #"gt table" objects are not compatible with "htmlwidgets" package. So they have to be saved differently. - #"mmtable2" package produces "gt_tbl" objects - gt::gtsave(html_object,filename = file_name) + for (i in seq_along(html_objects)) { + # Get the current HTML object + html_object <- html_objects[[i]] + + object_class_names <- class(html_object) + + # Generate a unique temporary file name + file_name <- tempfile(pattern = paste0("viewhtml_", i, "_"), fileext = ".html") + + if ("htmlwidget" %in% object_class_names) { + # Note: When selfcontained is set to True + # a "Saving a widget with selfcontained = TRUE requires pandoc" error is thrown in R-Instat + # when saving an rpivotTable + # TODO: Investigate how to solve it then. + htmlwidgets::saveWidget(html_object, file = file_name, selfcontained = FALSE) + } else if ("sjTable" %in% object_class_names) { + # "sjTable" objects are not compatible with "htmlwidgets" package. So they have to be saved differently + # "sjplot" package produces "sjTable" objects + html_object$file = file_name + # TODO: Is there any other function that can save an sjTable to a html file? + print(html_object) + } else if ("gt_tbl" %in% object_class_names) { + # "gt table" objects are not compatible with "htmlwidgets" package. So they have to be saved differently. + # "mmtable2" package produces "gt_tbl" objects + gt::gtsave(html_object, filename = file_name) + } + + # Store the file name in the vector + file_names[[i]] <- file_name } - message("R viewer not detected. File saved in location ", file_name) - return(file_name) -} + message("R viewer not detected. Files saved in locations: ", paste(file_names, collapse = ", ")) + return(file_names) +} + #tries to recordPlot if graph_object = NULL, then returns graph object of class "recordedplot". #applicable to base graphs only From b94d9fe15a5628940893dac4a7ace518981055f6 Mon Sep 17 00:00:00 2001 From: n-thony Date: Sun, 24 Mar 2024 17:16:05 +0300 Subject: [PATCH 43/88] added more comments --- instat/clsRLink.vb | 32 +++++++++++-------- .../static/InstatObject/R/instat_object_R6.R | 1 - 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index cb984ee7d89..af567e11f75 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -999,17 +999,17 @@ Public Class RLink ' Split the strOutput into an array of lines, removing empty entries Dim arrFilesPaths() As String = strOutput.Split({vbCrLf, Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) - ' Check if strOutput is not empty and all lines correspond to existing HTML files with content - If Not String.IsNullOrEmpty(strOutput) AndAlso arrFilesPaths.All(Function(line) File.Exists(line) AndAlso New FileInfo(line).Length > 0 AndAlso - Path.GetExtension(line).Equals(".html", StringComparison.OrdinalIgnoreCase)) Then + ' Check if strOutput is not empty and all files correspond to existing HTML files with content + If Not String.IsNullOrEmpty(strOutput) AndAlso arrFilesPaths.All(Function(_path) File.Exists(_path) AndAlso New FileInfo(_path).Length > 0 AndAlso + Path.GetExtension(_path).Equals(".html", StringComparison.OrdinalIgnoreCase)) Then ' Iterate through each HTML files - For Each file In arrFilesPaths + For Each _path In arrFilesPaths ' Add each HTML file as an output to clsOutputLogger ' strScriptWithComment: the script with associated comments ' line: the path to the HTML file ' bAsFile: a boolean indicating whether the output should be treated as a file ' bDisplayOutputInExternalViewer: a boolean indicating whether to display the output in an external viewer - clsOutputLogger.AddOutput(strScriptWithComment, file, bAsFile, bDisplayOutputInExternalViewer) + clsOutputLogger.AddOutput(strScriptWithComment, _path, bAsFile, bDisplayOutputInExternalViewer) Next Else ' If strOutput is empty or does not contain valid HTML files, add strOutput itself as an output @@ -1037,7 +1037,7 @@ Public Class RLink ''' ''' file path name if file is avaialble and has contents else empty string Private Function GetFileOutput(strScript As String, bSilent As Boolean, bSeparateThread As Boolean, bShowWaitDialogOverride As Nullable(Of Boolean)) As String - Dim strFilePath As String = "" + Dim strFilesPath As String = "" Dim strTempAssignTo As String = ".temp_val" Dim expTemp As RDotNet.SymbolicExpression Dim strNewAssignedToScript As String = ConstructAssignTo(strTempAssignTo, strScript) @@ -1046,14 +1046,20 @@ Public Class RLink expTemp = GetSymbol(strTempAssignTo, bSilent:=True) Evaluate("rm(" & strTempAssignTo & ")", bSilent:=True) If expTemp IsNot Nothing Then - 'get the file path name, check if it exists and whether it has contents - 'if not, just return empty file path - strFilePath = String.Join(Environment.NewLine, expTemp.AsCharacter()) - Dim lines() As String = strFilePath.Split({vbCrLf, Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) - lines = lines.Where(Function(line) File.Exists(line) AndAlso New FileInfo(line).Length > 0).ToArray() - strFilePath = If(lines.Length = 0, "", String.Join(Environment.NewLine, lines)) + ' If expTemp is not null + ' Extract the file path names from the expTemp and join into a single string + ' Split the string into an array of file path names, removing empty entries + ' Check if each file path name corresponds to an existing file with content + ' If so, filter out invalid file paths + ' Combine the valid file paths into a single string separated by newline characters + ' If no valid file paths remain, set strFilesPath to an empty string + strFilesPath = String.Join(Environment.NewLine, expTemp.AsCharacter()) + Dim arrFilesPath() As String = strFilesPath.Split({vbCrLf, Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) + arrFilesPath = arrFilesPath.Where(Function(path) File.Exists(path) AndAlso New FileInfo(path).Length > 0).ToArray() + strFilesPath = If(arrFilesPath.Length = 0, "", String.Join(Environment.NewLine, arrFilesPath)) End If - Return strFilePath + + Return strFilesPath End Function '''-------------------------------------------------------------------------------------------- diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index 91d4a1dfd04..a8110495aad 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -654,7 +654,6 @@ DataBook$set("public", "get_object_data", function(data_name = NULL, object_name } ) - #returns object data from the object_names character vector DataBook$set("public", "get_objects_data", function(data_name = NULL, object_names = NULL, as_files = FALSE) { out <- list() From f0aa616e2c96430342a2a2bc4a5ad4060e8d3618 Mon Sep 17 00:00:00 2001 From: n-thony Date: Mon, 25 Mar 2024 08:43:14 +0300 Subject: [PATCH 44/88] minor typo fix --- instat/clsRLink.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index af567e11f75..1ad69497b49 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -1006,7 +1006,7 @@ Public Class RLink For Each _path In arrFilesPaths ' Add each HTML file as an output to clsOutputLogger ' strScriptWithComment: the script with associated comments - ' line: the path to the HTML file + ' _path: the path to the HTML file ' bAsFile: a boolean indicating whether the output should be treated as a file ' bDisplayOutputInExternalViewer: a boolean indicating whether to display the output in an external viewer clsOutputLogger.AddOutput(strScriptWithComment, _path, bAsFile, bDisplayOutputInExternalViewer) From 0f4084e39796275cb97a6e565ee92b04a4826168 Mon Sep 17 00:00:00 2001 From: n-thony Date: Mon, 25 Mar 2024 09:30:45 +0300 Subject: [PATCH 45/88] fix issue with the tables --- instat/static/InstatObject/R/stand_alone_functions.R | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index b6a442b0409..48e38e2530b 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2779,6 +2779,15 @@ view_html_object <- function(html_objects) { file_names[[i]] <- file_name } + # Save unrecognized HTML objects as generic HTML + unrecognized_objects <- html_objects[!sapply(html_objects, function(x) any(class(x) %in% c("htmlwidget", "sjTable", "gt_tbl")))] + if (length(unrecognized_objects) > 0) { + file_names <- NULL # Clear file_names + file_name <- tempfile(pattern = "viewhtml_unrecognized_", fileext = ".html") + gt::gtsave(html_objects, filename = file_name) + file_names <- file_name + } + message("R viewer not detected. Files saved in locations: ", paste(file_names, collapse = ", ")) return(file_names) } From b03f5ed0bf399c399f4acd2b570b110114e6101d Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:06:17 +0100 Subject: [PATCH 46/88] Code Changes --- instat/dlgTransform.vb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index ad07416567b..79e1ad6fe20 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -721,7 +721,7 @@ Public Class dlgTransform ucrPnlColumnSelectOptions.SetRCode(clsDummyTransformFunction, bReset) ucrChkDecreasing.SetRCode(clsSortFunction, bReset) ucrChkMissingLast.SetRCode(clsSortFunction, bReset) - ucrSaveNew.SetRCode(clsRoundFunction, bReset) + ucrPnlTies.SetRCode(clsRankFunction, bReset) ucrPnlMissingValues.SetRCode(clsRankFunction, bReset) ucrNudRoundOfDigits.SetRCode(clsRoundFunction, bReset) @@ -747,6 +747,7 @@ Public Class dlgTransform ucrChkAdd.SetRCode(clsNumericDummyFunction, bReset) ucrChkMultiply.SetRCode(clsNumericDummyFunction, bReset) ucrChkSubtract.SetRCode(clsNumericDummyFunction, bReset) + ucrSaveNew.SetRCode(clsRoundFunction, bReset) End If bResetRCode = True End Sub @@ -779,11 +780,9 @@ Public Class dlgTransform End If ElseIf rdoMultiple.Checked Then ucrSaveNew.SetLabelText("Suffix Name:") + ucrSaveNew.btnColumnPosition.Visible = False If Not ucrReceiverRank.IsEmpty AndAlso (Not ucrSaveNew.bUserTyped) Then - Dim strDataframeName As String = ucrReceiverRank.GetVariableNames(bWithQuotes:=False) ucrSaveNew.SetPrefix(ucrReceiverRank.GetVariableNames(bWithQuotes:=False)) - clsPasteFunction.AddParameter("col_data", Chr(34) & "_" & strDataframeName & Chr(34), iPosition:=1, bIncludeArgumentName:=False) - clsAddColumnsFunction.AddParameter("col_data", "col", iPosition:=1) End If End If @@ -1141,6 +1140,8 @@ Public Class dlgTransform Private Sub ucrSaveNew_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSaveNew.ControlValueChanged If ucrSaveNew.GetText <> "" AndAlso ucrSaveNew.IsComplete() Then clsRemoveLabelsFunction.AddParameter("col_names", Chr(34) & ucrSaveNew.GetText & Chr(34), iPosition:=1) + clsPasteFunction.AddParameter("col_data", Chr(34) & "_" & ucrSaveNew.GetText & Chr(34), iPosition:=1, bIncludeArgumentName:=False) + End If End Sub From 56427fd8013b93a409b6e80bc3d25cc7f0b22879 Mon Sep 17 00:00:00 2001 From: JUMA Date: Mon, 25 Mar 2024 13:12:22 +0300 Subject: [PATCH 47/88] chng --- instat/ucrCalculator.Designer.vb | 116 +++++----- instat/ucrCalculator.resx | 2 +- instat/ucrCalculator.vb | 358 +++++++++++++++++-------------- 3 files changed, 259 insertions(+), 217 deletions(-) diff --git a/instat/ucrCalculator.Designer.vb b/instat/ucrCalculator.Designer.vb index 9bca27aa0ba..f5246755495 100644 --- a/instat/ucrCalculator.Designer.vb +++ b/instat/ucrCalculator.Designer.vb @@ -217,7 +217,7 @@ Partial Class ucrCalculator Me.cmdGpa = New System.Windows.Forms.Button() Me.cmdEla = New System.Windows.Forms.Button() Me.cmdMath = New System.Windows.Forms.Button() - Me.cmdLevel = New System.Windows.Forms.Button() + Me.cmdWakefieldLower = New System.Windows.Forms.Button() Me.cmdLanguage = New System.Windows.Forms.Button() Me.cmdIq = New System.Windows.Forms.Button() Me.cmdInternet_Browser = New System.Windows.Forms.Button() @@ -231,7 +231,7 @@ Partial Class ucrCalculator Me.cmdDice = New System.Windows.Forms.Button() Me.cmdDied = New System.Windows.Forms.Button() Me.cmdDeath = New System.Windows.Forms.Button() - Me.cmdDate_Stamp = New System.Windows.Forms.Button() + Me.cmdWakefieldDates = New System.Windows.Forms.Button() Me.cmdPrimary = New System.Windows.Forms.Button() Me.cmdColor = New System.Windows.Forms.Button() Me.cmdCoin = New System.Windows.Forms.Button() @@ -2341,7 +2341,7 @@ Partial Class ucrCalculator Me.grpWakefield.Controls.Add(Me.cmdGpa) Me.grpWakefield.Controls.Add(Me.cmdEla) Me.grpWakefield.Controls.Add(Me.cmdMath) - Me.grpWakefield.Controls.Add(Me.cmdLevel) + Me.grpWakefield.Controls.Add(Me.cmdWakefieldLower) Me.grpWakefield.Controls.Add(Me.cmdLanguage) Me.grpWakefield.Controls.Add(Me.cmdIq) Me.grpWakefield.Controls.Add(Me.cmdInternet_Browser) @@ -2355,7 +2355,7 @@ Partial Class ucrCalculator Me.grpWakefield.Controls.Add(Me.cmdDice) Me.grpWakefield.Controls.Add(Me.cmdDied) Me.grpWakefield.Controls.Add(Me.cmdDeath) - Me.grpWakefield.Controls.Add(Me.cmdDate_Stamp) + Me.grpWakefield.Controls.Add(Me.cmdWakefieldDates) Me.grpWakefield.Controls.Add(Me.cmdPrimary) Me.grpWakefield.Controls.Add(Me.cmdColor) Me.grpWakefield.Controls.Add(Me.cmdCoin) @@ -2385,7 +2385,7 @@ Partial Class ucrCalculator Me.cmdLinkert7.Name = "cmdLinkert7" Me.cmdLinkert7.Size = New System.Drawing.Size(107, 38) Me.cmdLinkert7.TabIndex = 54 - Me.cmdLinkert7.Text = "linkert7 (o.f)" + Me.cmdLinkert7.Text = "linkert7 (O.F)" Me.cmdLinkert7.UseVisualStyleBackColor = True ' 'cmdWakefield_Year @@ -2418,7 +2418,7 @@ Partial Class ucrCalculator Me.cmdWakefield_Upper.Name = "cmdWakefield_Upper" Me.cmdWakefield_Upper.Size = New System.Drawing.Size(107, 38) Me.cmdWakefield_Upper.TabIndex = 51 - Me.cmdWakefield_Upper.Text = "upper (c)" + Me.cmdWakefield_Upper.Text = "upper (C)" Me.cmdWakefield_Upper.UseVisualStyleBackColor = True ' 'cmdString @@ -2429,7 +2429,7 @@ Partial Class ucrCalculator Me.cmdString.Name = "cmdString" Me.cmdString.Size = New System.Drawing.Size(107, 38) Me.cmdString.TabIndex = 50 - Me.cmdString.Text = "string (c)" + Me.cmdString.Text = "string (C)" Me.cmdString.UseVisualStyleBackColor = True ' 'cmdState @@ -2440,7 +2440,7 @@ Partial Class ucrCalculator Me.cmdState.Name = "cmdState" Me.cmdState.Size = New System.Drawing.Size(107, 38) Me.cmdState.TabIndex = 49 - Me.cmdState.Text = "state (f)" + Me.cmdState.Text = "state (F)" Me.cmdState.UseVisualStyleBackColor = True ' 'cmdSpeed @@ -2473,7 +2473,7 @@ Partial Class ucrCalculator Me.cmdSex.Name = "cmdSex" Me.cmdSex.Size = New System.Drawing.Size(107, 38) Me.cmdSex.TabIndex = 46 - Me.cmdSex.Text = "sex (f)" + Me.cmdSex.Text = "sex (F)" Me.cmdSex.UseVisualStyleBackColor = True ' 'cmdSex_Inclusive @@ -2484,7 +2484,7 @@ Partial Class ucrCalculator Me.cmdSex_Inclusive.Name = "cmdSex_Inclusive" Me.cmdSex_Inclusive.Size = New System.Drawing.Size(107, 38) Me.cmdSex_Inclusive.TabIndex = 45 - Me.cmdSex_Inclusive.Text = "sex_inclusive (f)" + Me.cmdSex_Inclusive.Text = "sex_inclusive (F)" Me.cmdSex_Inclusive.UseVisualStyleBackColor = True ' 'cmdGender @@ -2495,7 +2495,7 @@ Partial Class ucrCalculator Me.cmdGender.Name = "cmdGender" Me.cmdGender.Size = New System.Drawing.Size(107, 38) Me.cmdGender.TabIndex = 44 - Me.cmdGender.Text = "gender (f)" + Me.cmdGender.Text = "gender (F)" Me.cmdGender.UseVisualStyleBackColor = True ' 'cmdSentence @@ -2506,7 +2506,7 @@ Partial Class ucrCalculator Me.cmdSentence.Name = "cmdSentence" Me.cmdSentence.Size = New System.Drawing.Size(107, 38) Me.cmdSentence.TabIndex = 43 - Me.cmdSentence.Text = "sentence (c)" + Me.cmdSentence.Text = "sentence (C)" Me.cmdSentence.UseVisualStyleBackColor = True ' 'cmdSat @@ -2528,7 +2528,7 @@ Partial Class ucrCalculator Me.cmdReligion.Name = "cmdReligion" Me.cmdReligion.Size = New System.Drawing.Size(107, 38) Me.cmdReligion.TabIndex = 41 - Me.cmdReligion.Text = "religion (f)" + Me.cmdReligion.Text = "religion (F)" Me.cmdReligion.UseVisualStyleBackColor = True ' 'cmdRace @@ -2539,7 +2539,7 @@ Partial Class ucrCalculator Me.cmdRace.Name = "cmdRace" Me.cmdRace.Size = New System.Drawing.Size(107, 38) Me.cmdRace.TabIndex = 40 - Me.cmdRace.Text = "race (f)" + Me.cmdRace.Text = "race (F)" Me.cmdRace.UseVisualStyleBackColor = True ' 'cmdPolitical @@ -2550,7 +2550,7 @@ Partial Class ucrCalculator Me.cmdPolitical.Name = "cmdPolitical" Me.cmdPolitical.Size = New System.Drawing.Size(107, 38) Me.cmdPolitical.TabIndex = 39 - Me.cmdPolitical.Text = "political (f)" + Me.cmdPolitical.Text = "political (F)" Me.cmdPolitical.UseVisualStyleBackColor = True ' 'cmdNormal @@ -2572,7 +2572,7 @@ Partial Class ucrCalculator Me.cmdName.Name = "cmdName" Me.cmdName.Size = New System.Drawing.Size(107, 38) Me.cmdName.TabIndex = 37 - Me.cmdName.Text = "name (c)" + Me.cmdName.Text = "name (C)" Me.cmdName.UseVisualStyleBackColor = True ' 'cmdWakefield_Month @@ -2583,7 +2583,7 @@ Partial Class ucrCalculator Me.cmdWakefield_Month.Name = "cmdWakefield_Month" Me.cmdWakefield_Month.Size = New System.Drawing.Size(107, 38) Me.cmdWakefield_Month.TabIndex = 36 - Me.cmdWakefield_Month.Text = "month (f)" + Me.cmdWakefield_Month.Text = "month (F)" Me.cmdWakefield_Month.UseVisualStyleBackColor = True ' 'cmdMilitary @@ -2594,7 +2594,7 @@ Partial Class ucrCalculator Me.cmdMilitary.Name = "cmdMilitary" Me.cmdMilitary.Size = New System.Drawing.Size(107, 38) Me.cmdMilitary.TabIndex = 35 - Me.cmdMilitary.Text = "military (f)" + Me.cmdMilitary.Text = "military (F)" Me.cmdMilitary.UseVisualStyleBackColor = True ' 'cmdMarital @@ -2605,7 +2605,7 @@ Partial Class ucrCalculator Me.cmdMarital.Name = "cmdMarital" Me.cmdMarital.Size = New System.Drawing.Size(107, 38) Me.cmdMarital.TabIndex = 34 - Me.cmdMarital.Text = "marital (f)" + Me.cmdMarital.Text = "marital (F)" Me.cmdMarital.UseVisualStyleBackColor = True ' 'cmdLorem_ipsum @@ -2616,7 +2616,7 @@ Partial Class ucrCalculator Me.cmdLorem_ipsum.Name = "cmdLorem_ipsum" Me.cmdLorem_ipsum.Size = New System.Drawing.Size(107, 38) Me.cmdLorem_ipsum.TabIndex = 33 - Me.cmdLorem_ipsum.Text = "lorem_ipsum (c)" + Me.cmdLorem_ipsum.Text = "lorem_ipsum (C)" Me.cmdLorem_ipsum.UseVisualStyleBackColor = True ' 'cmdLikert @@ -2627,7 +2627,7 @@ Partial Class ucrCalculator Me.cmdLikert.Name = "cmdLikert" Me.cmdLikert.Size = New System.Drawing.Size(107, 38) Me.cmdLikert.TabIndex = 32 - Me.cmdLikert.Text = "likert (o.f)" + Me.cmdLikert.Text = "likert (O.F)" Me.cmdLikert.UseVisualStyleBackColor = True ' 'cmdGpa @@ -2663,16 +2663,16 @@ Partial Class ucrCalculator Me.cmdMath.Text = "math" Me.cmdMath.UseVisualStyleBackColor = True ' - 'cmdLevel + 'cmdWakefieldLower ' - Me.cmdLevel.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) - Me.cmdLevel.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdLevel.Location = New System.Drawing.Point(322, 200) - Me.cmdLevel.Name = "cmdLevel" - Me.cmdLevel.Size = New System.Drawing.Size(107, 38) - Me.cmdLevel.TabIndex = 28 - Me.cmdLevel.Text = "level" - Me.cmdLevel.UseVisualStyleBackColor = True + Me.cmdWakefieldLower.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) + Me.cmdWakefieldLower.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdWakefieldLower.Location = New System.Drawing.Point(322, 200) + Me.cmdWakefieldLower.Name = "cmdWakefieldLower" + Me.cmdWakefieldLower.Size = New System.Drawing.Size(107, 38) + Me.cmdWakefieldLower.TabIndex = 28 + Me.cmdWakefieldLower.Text = "lower(F)" + Me.cmdWakefieldLower.UseVisualStyleBackColor = True ' 'cmdLanguage ' @@ -2682,7 +2682,7 @@ Partial Class ucrCalculator Me.cmdLanguage.Name = "cmdLanguage" Me.cmdLanguage.Size = New System.Drawing.Size(107, 38) Me.cmdLanguage.TabIndex = 27 - Me.cmdLanguage.Text = "language (f)" + Me.cmdLanguage.Text = "language (F)" Me.cmdLanguage.UseVisualStyleBackColor = True ' 'cmdIq @@ -2704,7 +2704,7 @@ Partial Class ucrCalculator Me.cmdInternet_Browser.Name = "cmdInternet_Browser" Me.cmdInternet_Browser.Size = New System.Drawing.Size(107, 38) Me.cmdInternet_Browser.TabIndex = 25 - Me.cmdInternet_Browser.Text = "browser (f)" + Me.cmdInternet_Browser.Text = "browser (F)" Me.cmdInternet_Browser.UseVisualStyleBackColor = True ' 'cmdGrade_Level @@ -2715,7 +2715,7 @@ Partial Class ucrCalculator Me.cmdGrade_Level.Name = "cmdGrade_Level" Me.cmdGrade_Level.Size = New System.Drawing.Size(107, 38) Me.cmdGrade_Level.TabIndex = 19 - Me.cmdGrade_Level.Text = "grade_level (f)" + Me.cmdGrade_Level.Text = "grade_level (F)" Me.cmdGrade_Level.UseVisualStyleBackColor = True ' 'cmdEye @@ -2726,7 +2726,7 @@ Partial Class ucrCalculator Me.cmdEye.Name = "cmdEye" Me.cmdEye.Size = New System.Drawing.Size(107, 38) Me.cmdEye.TabIndex = 18 - Me.cmdEye.Text = "eye (f)" + Me.cmdEye.Text = "eye (F)" Me.cmdEye.UseVisualStyleBackColor = True ' 'cmdEmployment @@ -2737,7 +2737,7 @@ Partial Class ucrCalculator Me.cmdEmployment.Name = "cmdEmployment" Me.cmdEmployment.Size = New System.Drawing.Size(107, 38) Me.cmdEmployment.TabIndex = 17 - Me.cmdEmployment.Text = "employment (f)" + Me.cmdEmployment.Text = "employment (F)" Me.cmdEmployment.UseVisualStyleBackColor = True ' 'cmdEducation @@ -2748,7 +2748,7 @@ Partial Class ucrCalculator Me.cmdEducation.Name = "cmdEducation" Me.cmdEducation.Size = New System.Drawing.Size(107, 38) Me.cmdEducation.TabIndex = 16 - Me.cmdEducation.Text = "education (f)" + Me.cmdEducation.Text = "education (F)" Me.cmdEducation.UseVisualStyleBackColor = True ' 'cmdDummy @@ -2781,7 +2781,7 @@ Partial Class ucrCalculator Me.cmdDna.Name = "cmdDna" Me.cmdDna.Size = New System.Drawing.Size(107, 38) Me.cmdDna.TabIndex = 13 - Me.cmdDna.Text = "dna (f)" + Me.cmdDna.Text = "dna (F)" Me.cmdDna.UseVisualStyleBackColor = True ' 'cmdDice @@ -2817,16 +2817,16 @@ Partial Class ucrCalculator Me.cmdDeath.Text = "death (L)" Me.cmdDeath.UseVisualStyleBackColor = True ' - 'cmdDate_Stamp + 'cmdWakefieldDates ' - Me.cmdDate_Stamp.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) - Me.cmdDate_Stamp.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdDate_Stamp.Location = New System.Drawing.Point(427, 53) - Me.cmdDate_Stamp.Name = "cmdDate_Stamp" - Me.cmdDate_Stamp.Size = New System.Drawing.Size(107, 38) - Me.cmdDate_Stamp.TabIndex = 9 - Me.cmdDate_Stamp.Text = "date_stamp" - Me.cmdDate_Stamp.UseVisualStyleBackColor = True + Me.cmdWakefieldDates.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) + Me.cmdWakefieldDates.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdWakefieldDates.Location = New System.Drawing.Point(427, 53) + Me.cmdWakefieldDates.Name = "cmdWakefieldDates" + Me.cmdWakefieldDates.Size = New System.Drawing.Size(107, 38) + Me.cmdWakefieldDates.TabIndex = 9 + Me.cmdWakefieldDates.Text = "dates (D)" + Me.cmdWakefieldDates.UseVisualStyleBackColor = True ' 'cmdPrimary ' @@ -2836,7 +2836,7 @@ Partial Class ucrCalculator Me.cmdPrimary.Name = "cmdPrimary" Me.cmdPrimary.Size = New System.Drawing.Size(107, 38) Me.cmdPrimary.TabIndex = 8 - Me.cmdPrimary.Text = "primary (f)" + Me.cmdPrimary.Text = "primary (F)" Me.cmdPrimary.UseVisualStyleBackColor = True ' 'cmdColor @@ -2847,7 +2847,7 @@ Partial Class ucrCalculator Me.cmdColor.Name = "cmdColor" Me.cmdColor.Size = New System.Drawing.Size(107, 38) Me.cmdColor.TabIndex = 7 - Me.cmdColor.Text = "color (f)" + Me.cmdColor.Text = "color (F)" Me.cmdColor.UseVisualStyleBackColor = True ' 'cmdCoin @@ -2858,7 +2858,7 @@ Partial Class ucrCalculator Me.cmdCoin.Name = "cmdCoin" Me.cmdCoin.Size = New System.Drawing.Size(107, 38) Me.cmdCoin.TabIndex = 6 - Me.cmdCoin.Text = "coin (f)" + Me.cmdCoin.Text = "coin (F)" Me.cmdCoin.UseVisualStyleBackColor = True ' 'cmdChildren @@ -2880,7 +2880,7 @@ Partial Class ucrCalculator Me.cmdCar.Name = "cmdCar" Me.cmdCar.Size = New System.Drawing.Size(107, 38) Me.cmdCar.TabIndex = 4 - Me.cmdCar.Text = "car (f)" + Me.cmdCar.Text = "car (F)" Me.cmdCar.UseVisualStyleBackColor = True ' 'cmdAnswer @@ -2891,7 +2891,7 @@ Partial Class ucrCalculator Me.cmdAnswer.Name = "cmdAnswer" Me.cmdAnswer.Size = New System.Drawing.Size(107, 38) Me.cmdAnswer.TabIndex = 3 - Me.cmdAnswer.Text = "answer (f)" + Me.cmdAnswer.Text = "answer (F)" Me.cmdAnswer.UseVisualStyleBackColor = True ' 'cmdPet @@ -2902,7 +2902,7 @@ Partial Class ucrCalculator Me.cmdPet.Name = "cmdPet" Me.cmdPet.Size = New System.Drawing.Size(107, 38) Me.cmdPet.TabIndex = 2 - Me.cmdPet.Text = "pet (f)" + Me.cmdPet.Text = "pet (F)" Me.cmdPet.UseVisualStyleBackColor = True ' 'cmdAnimal @@ -2913,7 +2913,7 @@ Partial Class ucrCalculator Me.cmdAnimal.Name = "cmdAnimal" Me.cmdAnimal.Size = New System.Drawing.Size(107, 38) Me.cmdAnimal.TabIndex = 1 - Me.cmdAnimal.Text = "animal (f)" + Me.cmdAnimal.Text = "animal (F)" Me.cmdAnimal.UseVisualStyleBackColor = True ' 'cmdAge @@ -2957,7 +2957,7 @@ Partial Class ucrCalculator Me.cmdHair.Name = "cmdHair" Me.cmdHair.Size = New System.Drawing.Size(107, 38) Me.cmdHair.TabIndex = 22 - Me.cmdHair.Text = "hair (f)" + Me.cmdHair.Text = "hair (F)" Me.cmdHair.UseVisualStyleBackColor = True ' 'cmdGroup @@ -2968,7 +2968,7 @@ Partial Class ucrCalculator Me.cmdGroup.Name = "cmdGroup" Me.cmdGroup.Size = New System.Drawing.Size(107, 38) Me.cmdGroup.TabIndex = 21 - Me.cmdGroup.Text = "group (f)" + Me.cmdGroup.Text = "group (F)" Me.cmdGroup.UseVisualStyleBackColor = True ' 'cmdGrade @@ -7362,6 +7362,7 @@ Partial Class ucrCalculator Me.AutoScaleDimensions = New System.Drawing.SizeF(120.0!, 120.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True + Me.Controls.Add(Me.grpWakefield) Me.Controls.Add(Me.grpList) Me.Controls.Add(Me.cmdRhelpList) Me.Controls.Add(Me.cmdWakefieldHelp) @@ -7383,7 +7384,6 @@ Partial Class ucrCalculator Me.Controls.Add(Me.grpModifier) Me.Controls.Add(Me.grpComplex) Me.Controls.Add(Me.grpSummary) - Me.Controls.Add(Me.grpWakefield) Me.Controls.Add(Me.grpTransform) Me.Controls.Add(Me.grpLogical) Me.Controls.Add(Me.grpDates) @@ -7636,7 +7636,7 @@ Partial Class ucrCalculator Friend WithEvents cmdGpa As Button Friend WithEvents cmdEla As Button Friend WithEvents cmdMath As Button - Friend WithEvents cmdLevel As Button + Friend WithEvents cmdWakefieldLower As Button Friend WithEvents cmdLanguage As Button Friend WithEvents cmdIq As Button Friend WithEvents cmdInternet_Browser As Button @@ -7650,7 +7650,7 @@ Partial Class ucrCalculator Friend WithEvents cmdDice As Button Friend WithEvents cmdDied As Button Friend WithEvents cmdDeath As Button - Friend WithEvents cmdDate_Stamp As Button + Friend WithEvents cmdWakefieldDates As Button Friend WithEvents cmdPrimary As Button Friend WithEvents cmdColor As Button Friend WithEvents cmdCoin As Button diff --git a/instat/ucrCalculator.resx b/instat/ucrCalculator.resx index 88d8710e379..b436018d56a 100644 --- a/instat/ucrCalculator.resx +++ b/instat/ucrCalculator.resx @@ -163,6 +163,6 @@ 759, 103 - 182 + 99 \ No newline at end of file diff --git a/instat/ucrCalculator.vb b/instat/ucrCalculator.vb index ff43b949970..62cb555c4f2 100644 --- a/instat/ucrCalculator.vb +++ b/instat/ucrCalculator.vb @@ -1,4 +1,4 @@ -' R- Instat +'R- Instat ' Copyright (C) 2015-2017 ' ' This program is free software: you can redistribute it and/or modify @@ -73,38 +73,39 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdRound, "round(x) to round to whole numbers, round(x,2) to round to 2 decimal places, round(x,-2) to round to the nearest 100") ttCalculator.SetToolTip(cmdSiginf, "signif(x,3) to round to 3 significant figures") - ttCalculator.SetToolTip(cmdSortF, "Sorts a vector into ascending or descending order. For example sort(c(5,7,4,4,3)) = (3,4,4,5,7)") - ttCalculator.SetToolTip(cmdScale, "Centre and scale the data - usually by producing (x - xbar)/s") - ttCalculator.SetToolTip(cmdMASSFractions, "Changes decimal data into a character variable with fractions. So 1.5 becomes 3/2, 0.25 becomes 1/4 etc.") - ttCalculator.SetToolTip(cmdDecimals, "The inverse of the fractions key. So 3/2 becomes 1.5, 1/4 becomes 0.25 etc.") - ttCalculator.SetToolTip(cmdLag, "Shift a variable down. For example lag(1:5) = (NA,1,2,3,4); lag(1:5,3) = (NA,NA,NA, 1,2)") - ttCalculator.SetToolTip(cmdLead, "Shift a variable up. For example lead(1:5) = (2,3,4,5,NA); lead(1:5;3) = (4,5, NA,NA,NA)") - ttCalculator.SetToolTip(cmdDiff, "Difference between successive elements. For example diff(c(1,4,3,7)) = (NA 3,-1,4)") - ttCalculator.SetToolTip(cmdRev, "Reverse a variable. For example rev(c(1,2,3,4,5)) =(5,4,3,2,1)") - ttCalculator.SetToolTip(cmdPMax, " Maximum of a set of variables. For examples pmax(c(1,3,5),c(6,4,2)) = (6,4,5)") - ttCalculator.SetToolTip(cmdPMin, "Minimum of a set of variables. For examples pmin(c(1,3,5),c(6,4,2)) = (1,3,2)") - ttCalculator.SetToolTip(cmdCumMax, "Cumulative maxima. For example cummax(c(3,2,1,4,0)) = (3,3,3,4,4)") - ttCalculator.SetToolTip(cmdMovMax, "Moving (or rolling) maxima. For example rollmax(x=c(3,2,1,4,0) ,3,fill=NA, align=""right"") = (NA,NA, 3,4,4)") - ttCalculator.SetToolTip(cmdCumSum, "Cumulative sums. For example cumsum(c(3,2,1,4,0)) = (3,5,6,10,10)") - ttCalculator.SetToolTip(cmdCumProd, "Cumulative products. For example cumprod(c(2,3,5,7)) = (2,6,30,210)") - ttCalculator.SetToolTip(cmdMovProd, "Moving products Fror example rollapply(c(2,3,5,7,11),width=3,fill=NA, FUN=prod) = (NA,30,105,385,NA)") - ttCalculator.SetToolTip(cmdCumMean, "Cumulative means. For example cummean(c(3,2,1,4,0)) = (3,2.5,2,2.5,2)") - ttCalculator.SetToolTip(cmdCumMin, "Cumulative minima. For example cummin(c(3,2,1,4,0)) = (3,2.,1,1,0)") - ttCalculator.SetToolTip(cmdMovSum, "Moving (or rolling) totals. For example rollsum(c(3,2,1,4,0) ,3,fill=NA, align=""left"") = (6,7,5,NA,NA)") - ttCalculator.SetToolTip(cmdMovMean, "Moving (or rolling) mean. For example rollmean(c(3,2,1,6,2) ,3,fill=NA) = (NA,2,3,3,NA)") - ttCalculator.SetToolTip(cmMovMed, "Moving (or rolling) medians. For example rollmedian(c(3,2,1,6,2) ,3,fill=NA) = (NA,2,2,2,NA)") - ttCalculator.SetToolTip(cmdMovmin, "Moving (or rolling) minima. For example rollapply(c(3,2,1,6,2),width=3,fill=NA, FUN=min) = (NA,1,1,1,NA)") - ttCalculator.SetToolTip(cmdNtile, " Use ranks to divide into (almost) equal sized groups. For example ntile(c(15,11,13,12,NA,12),2) = (2,1,2,1,NA,1)") - ttCalculator.SetToolTip(cmdCumdist, "Proportion of values less than or equal to the current rank. For example cume_dist(c(2,4,6,8,3)) = (0.2, 0.6, 0.8, 1.0, 0.4)") - ttCalculator.SetToolTip(cmdRowRank, "Row numbers as ranks. For example :row_number(c(15,11,13,12,NA,12)) = (5,1,3,2,NA,3)") - ttCalculator.SetToolTip(cmdPercentRank, "Rescale of minimum ranks to [0,1]. For example percent_rank(c(15,11,13,12,NA,12)) = (1,0,0.75,0.25,NA,0.25)") - ttCalculator.SetToolTip(cmdDRank, "Dense ranks. For example d_rank(c(15,11,13,12,NA,12)) = (4,1,3,2,NA,2)") - ttCalculator.SetToolTip(cmdMRank, " Minimum ranks. For example m_rank(c(15,11,13,12,NA,12)) = (5,1,4,2,NA,2)") - ttCalculator.SetToolTip(cmdNafill, "Fills missing values at the start, middle and end. For example na.fill(c(NA,2,NA,4,5,NA),fill=""extend"") = (2,2,3,4,5,5); while fill=c(15,""extend"",NA) = (15,2,3,4,5,NA)") - ttCalculator.SetToolTip(cmdNaapprox, "Linear interpolation of missing values. For example na.approx(c(5,NA,NA,2,2,NA,4,7,NA),maxgap=1,na.rm=FALSE) = (5,NA,NA,2,2,3,4,7,NA)") + ttCalculator.SetToolTip(cmdSortF, "sorts a vector into ascending or descending order. For example sort(c(5,7,4,4,3)) = (3,4,4,5,7)") + ttCalculator.SetToolTip(cmdScale, "centre and scale the data - usually by producing (x - xbar)/s") + ttCalculator.SetToolTip(cmdMASSFractions, "changes decimal data into a character variable with fractions. So 1.5 becomes 3/2, 0.25 becomes 1/4 etc.") + ttCalculator.SetToolTip(cmdDecimals, "the inverse of the fractions key. So 3/2 becomes 1.5, 1/4 becomes 0.25 etc.") + ttCalculator.SetToolTip(cmdLag, "shift a variable down. For example lag(1:5) = (NA,1,2,3,4); lag(1:5,3) = (NA,NA,NA, 1,2)") + ttCalculator.SetToolTip(cmdLead, "shift a variable up. For example lead(1:5) = (2,3,4,5,NA); lead(1:5;3) = (4,5, NA,NA,NA)") + ttCalculator.SetToolTip(cmdDiff, "difference between successive elements. For example diff(c(1,4,3,7)) = (NA 3,-1,4)") + ttCalculator.SetToolTip(cmdRev, "reverse a variable. For example rev(c(1,2,3,4,5)) =(5,4,3,2,1)") + ttCalculator.SetToolTip(cmdPMax, " maximum of a set of variables. For examples pmax(c(1,3,5),c(6,4,2)) = (6,4,5)") + ttCalculator.SetToolTip(cmdPMin, "minimum of a set of variables. For examples pmin(c(1,3,5),c(6,4,2)) = (1,3,2)") + ttCalculator.SetToolTip(cmdCumMax, "cumulative maxima. For example cummax(c(3,2,1,4,0)) = (3,3,3,4,4)") + ttCalculator.SetToolTip(cmdMovMax, "moving (or rolling) maxima. For example rollmax(x=c(3,2,1,4,0) ,3,fill=NA, align=""right"") = (NA,NA, 3,4,4)") + ttCalculator.SetToolTip(cmdCumSum, "cumulative sums. For example cumsum(c(3,2,1,4,0)) = (3,5,6,10,10)") + ttCalculator.SetToolTip(cmdCumProd, "cumulative products. For example cumprod(c(2,3,5,7)) = (2,6,30,210)") + ttCalculator.SetToolTip(cmdMovProd, "moving products Fror example rollapply(c(2,3,5,7,11),width=3,fill=NA, FUN=prod) = (NA,30,105,385,NA)") + ttCalculator.SetToolTip(cmdCumMean, "cumulative means. For example cummean(c(3,2,1,4,0)) = (3,2.5,2,2.5,2)") + ttCalculator.SetToolTip(cmdCumMin, "cumulative minima. For example cummin(c(3,2,1,4,0)) = (3,2.,1,1,0)") + ttCalculator.SetToolTip(cmdMovSum, "moving (or rolling) totals. For example rollsum(c(3,2,1,4,0) ,3,fill=NA, align=""left"") = (6,7,5,NA,NA)") + ttCalculator.SetToolTip(cmdMovMean, "moving (or rolling) mean. For example rollmean(c(3,2,1,6,2) ,3,fill=NA) = (NA,2,3,3,NA)") + ttCalculator.SetToolTip(cmMovMed, "moving (or rolling) medians. For example rollmedian(c(3,2,1,6,2) ,3,fill=NA) = (NA,2,2,2,NA)") + ttCalculator.SetToolTip(cmdMovmin, "moving (or rolling) minima. For example rollapply(c(3,2,1,6,2),width=3,fill=NA, FUN=min) = (NA,1,1,1,NA)") + ttCalculator.SetToolTip(cmdNtile, " use ranks to divide into (almost) equal sized groups. For example ntile(c(15,11,13,12,NA,12),2) = (2,1,2,1,NA,1)") + ttCalculator.SetToolTip(cmdCumdist, "proportion of values less than or equal to the current rank. For example cume_dist(c(2,4,6,8,3)) = (0.2, 0.6, 0.8, 1.0, 0.4)") + ttCalculator.SetToolTip(cmdRowRank, "row numbers as ranks. For example :row_number(c(15,11,13,12,NA,12)) = (5,1,3,2,NA,3)") + ttCalculator.SetToolTip(cmdPercentRank, "rescale of minimum ranks to [0,1]. For example percent_rank(c(15,11,13,12,NA,12)) = (1,0,0.75,0.25,NA,0.25)") + ttCalculator.SetToolTip(cmdDRank, "dense ranks. For example d_rank(c(15,11,13,12,NA,12)) = (4,1,3,2,NA,2)") + ttCalculator.SetToolTip(cmdMRank, " minimum ranks. For example m_rank(c(15,11,13,12,NA,12)) = (5,1,4,2,NA,2)") + ttCalculator.SetToolTip(cmdNafill, "fills missing values at the start, middle and end. For example na.fill(c(NA,2,NA,4,5,NA),fill=""extend"") = (2,2,3,4,5,5); while fill=c(15,""extend"",NA) = (15,2,3,4,5,NA)") + ttCalculator.SetToolTip(cmdNaapprox, "linear interpolation of missing values. For example na.approx(c(5,NA,NA,2,2,NA,4,7,NA),maxgap=1,na.rm=FALSE) = (5,NA,NA,2,2,3,4,7,NA)") ttCalculator.SetToolTip(cmdNasplin, "Spline interpolation of missing values. For example na.spline(c(NA,NA,NA,2,2,NA,4,7,NA),maxgap=2,na.rm=FALSE) = (NA,NA,NA,2,2,2.5,4,7,12)") ttCalculator.SetToolTip(cmdNaest, "Missing values as the mean (usually) overall or with a factor. For example na.aggregate(c(NA,NA,NA,2,2,NA,4,7,NA),maxgap=2,na.rm=FALSE) = (NA,NA,NA,2,2,3.75,4,7,3.75)") + ttCalculator.SetToolTip(cmdPower, "power(^)or exponent and can also be given as **. For example 2^3 = 8") ttCalculator.SetToolTip(cmdLesser, "less than(<). For example (2 < 3) is TRUE. (2 < 2) is FALSE, (2 < 1) is FALSE") ttCalculator.SetToolTip(cmdLesserOrEqualsTo, "less than or equals(<=). For example (2 <= 3) is TRUE, (2 <=2) is TRUE, (2 <= 1) is FALSE") @@ -135,14 +136,14 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdPf, "F probabilities. For example pf(2,1,10) = 0.8123; pf(2,50,50) = 0.9921") ttCalculator.SetToolTip(cmdQnorm, "qnormal quantiles. For example qnorm(0.05) = -1.6449; qnorm(0.9772, 100,15) = 130") - ttCalculator.SetToolTip(cmdPbirth, "Simultaneous birthday probabilities. For example pbirthday(10) = 0.1169 ; pbirthday(50) = 0.97") - ttCalculator.SetToolTip(cmdQbirth, "Simultaneous birthday quantiles. For example qbirthday(0.5) = 23, qbirthday(0.99) = 57") - ttCalculator.SetToolTip(cmdPbinom, "Binomial probabilities. For example pbinom(3,5,0.4) = 0.0.913") - ttCalculator.SetToolTip(cmdQbinom, " Binomial quantiles. For example qbinom(0.9,5,0.4) = 3") + ttCalculator.SetToolTip(cmdPbirth, "simultaneous birthday probabilities. For example pbirthday(10) = 0.1169 ; pbirthday(50) = 0.97") + ttCalculator.SetToolTip(cmdQbirth, "simultaneous birthday quantiles. For example qbirthday(0.5) = 23, qbirthday(0.99) = 57") + ttCalculator.SetToolTip(cmdPbinom, "binomial probabilities. For example pbinom(3,5,0.4) = 0.0.913") + ttCalculator.SetToolTip(cmdQbinom, " binomial quantiles. For example qbinom(0.9,5,0.4) = 3") ttCalculator.SetToolTip(cmdPpois, "Poisson probabilities. For example ppois(8, 5) = 0.93") ttCalculator.SetToolTip(cmdQpois, "Poisson quantiles. For example qpois(0.9, 5) = 8") - ttCalculator.SetToolTip(cmdPnbin, "Negative binomial probabilities. For example pnbinom(4,1,0.4) = 0.922 (geometric); pnbinom(13,5,0.4) = 0.9058") - ttCalculator.SetToolTip(cmdQnbin, "Negative binomial quantiles. For example qnbinom(0.9,1,0.4) = 4 (geometric); qnbinom(0.9, 5,0.4) = 13") + ttCalculator.SetToolTip(cmdPnbin, "negative binomial probabilities. For example pnbinom(4,1,0.4) = 0.922 (geometric); pnbinom(13,5,0.4) = 0.9058") + ttCalculator.SetToolTip(cmdQnbin, "negative binomial quantiles. For example qnbinom(0.9,1,0.4) = 4 (geometric); qnbinom(0.9, 5,0.4) = 13") ttCalculator.SetToolTip(cmdFact, "factorial. For example factorial(4) = 4*3*2*1 = 24; factorial(3.5) = gamma(4.5) = 11.63") ttCalculator.SetToolTip(cmdLfact, "log factorial. For example lfactorial(400) = 2001") ttCalculator.SetToolTip(cmdChoose, "binomial coefficient. For example choose(7,4) = 7!/(4!*3!) = 35") @@ -178,11 +179,12 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdSin, "sine of angle in radians. For example sin(pi/2) = sin(rad(90)) = 1.") ttCalculator.SetToolTip(cmdAsin, "angle corresponding to a given sine (in the range (0 to pi). For example asin(1) = 1.57 = pi/2.") ttCalculator.SetToolTip(cmdFloor, "integer below the given value. For example floor(3.5)=3; floor(-3.5) = -4.") - ttCalculator.SetToolTip(cmdRad, "Change from degrees to radians. For example rad(90) = 2*pi * 90/360 = 1.57 ( = pi/2)") + ttCalculator.SetToolTip(cmdRad, "change from degrees to radians. For example rad(90) = 2*pi * 90/360 = 1.57 ( = pi/2)") ttCalculator.SetToolTip(cmdLogTen, "logarithm to base 10. For example log10(1000) =3 (=10^3)") ttCalculator.SetToolTip(cmdTan, " tangent of angle in radians. For example tan(pi/4) = sin(pi/4)/cos(pi/4) = tan(rad(45)) = 1") ttCalculator.SetToolTip(cmdAtan, "angle corresponding to a given tangent (in the range 0 to pi). For example atan(1) = 0.7854 (= pi/4); deg(atan(1)) = 45.") ttCalculator.SetToolTip(cmdTrunc, "truncates the values towards 0. So trunc(3.5) = 3, trunc(-3.5)= -3") + '---------------------------------------------------------------------------------------------------- ttCalculator.SetToolTip(cmdUpper, "Change to upper case. For example str_to_upper(""Dr. Foster"") gives ""DR. FOSTER""") ttCalculator.SetToolTip(cmdLower, "Change to lower case. For example str_to_lower(""Dr. Foster"") gives ""dr. foster""") @@ -298,42 +300,79 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdCp, "coefficent of persistence between sim and obs") ttCalculator.SetToolTip(cmdD, "Index of agreement between sim and obs") ttCalculator.SetToolTip(cmdKGE, "Kling-Gupta efficiency between sim and obs") - ttCalculator.SetToolTip(cmdMae, "Mean absolute error between sim and obs") - ttCalculator.SetToolTip(cmdMd, "Modified index of agreement between sim and obsmNSE") - ttCalculator.SetToolTip(cmdMe, "Mean error between sim and obs") - ttCalculator.SetToolTip(cmdmNSE, "Modified Nash-Sutcliffe efficiency between sim and obs") - ttCalculator.SetToolTip(cmdMse, "Mean squared error between sim and obs") - ttCalculator.SetToolTip(cmdNrmse, "Normalized root mean square error between sim and obs") + ttCalculator.SetToolTip(cmdMae, "mean absolute error between sim and obs") + ttCalculator.SetToolTip(cmdMd, "modified index of agreement between sim and obsmNSE") + ttCalculator.SetToolTip(cmdMe, "mean error between sim and obs") + ttCalculator.SetToolTip(cmdmNSE, "modified Nash-Sutcliffe efficiency between sim and obs") + ttCalculator.SetToolTip(cmdMse, "mean squared error between sim and obs") + ttCalculator.SetToolTip(cmdNrmse, "normalized root mean square error between sim and obs") ttCalculator.SetToolTip(cmdNSE, "Nash-Sutcliffe efficiency between sim and obs") - ttCalculator.SetToolTip(cmdPbias, "Percent bias between sim and obs") - ttCalculator.SetToolTip(cmdPbiasfdc, "Percent bias in the slope of the midsegment of the flow duration curve") - ttCalculator.SetToolTip(cmdRd, "Relative index of agreement (d) between sim and obs. (Value is between 0 and 1)") - ttCalculator.SetToolTip(cmdRmse, "Root mean square error between sim and obs, so the standard deviation of the model prediction error") - ttCalculator.SetToolTip(cmdRNSE, "Relative Nash-Sutcliffe efficiency between sim and obs") - ttCalculator.SetToolTip(cmdRPearson, "Correlation between sim and obs") - ttCalculator.SetToolTip(cmdRSD, "Ratio of standard deviations between sim and obs") - ttCalculator.SetToolTip(cmdRsr, "Ratio of the root mean square error between sim and obs to the standard deviation of obs") - ttCalculator.SetToolTip(cmdSsq, "Sum of squared residuals between sim and obs") - ttCalculator.SetToolTip(cmdVE, " Volumetric efficiency between sim and obs (Value is between 0 and 1)") - - ' circular keyboard tooltips - ttCalculator.SetToolTip(cmdCircular, "Define a variable as circular. Specify whether the data are in radians (default), degrees, or hours.") - ttCalculator.SetToolTip(cmdCircMean, "The circular mean. For example with 1, 2, 3, 6, mean(circular(c(1,2,3,6)) gives 1.51.") - ttCalculator.SetToolTip(cmdCircSd, "The circular standard deviation. This is not the sqrt(circular.var). It is reasonably close to the ordinary sd for data in radians.") - ttCalculator.SetToolTip(cmdCircRho, "The mean resultant length is between 0 and 1. Small values imply large (circular) variation. For 1,2,3,6 rho is 0.4036. With 1,2,3,4,5,6 it is 0.049.") - ttCalculator.SetToolTip(cmdCircRange, "Circular range is the shortest arc containing the data. For example with 1,2,3,6 gives 3.28 (6 is also -0.28 on circle from 0 to 2*pi)") - ttCalculator.SetToolTip(cmdCircVar, "The circular variance is (1 - rho), so between 0 and 1, with small values implying low (circular) variation. For 1,2,3,6 var is 0.5964. With 1,2,3,4,5,6 var is 0.951.") - ttCalculator.SetToolTip(cmdCircQuantiles, "Defined quantiles round the circle. With 0.5 it is the (circular) median, so is 1.5 for 1,2,3,6.") - ttCalculator.SetToolTip(cmdCircMax, "Largest value round the circle. For example, for 1,2,3,6 max is 3.") - ttCalculator.SetToolTip(cmdCircMin, " Smallest value round the circle. For 1,2,3,6 min is 6. (values are from 6 (almost 2 * pi to 3)") - ttCalculator.SetToolTip(cmdCircQ1, "Lower quartile round the circle. For 1,2,3,6, q1 is 0.68") - ttCalculator.SetToolTip(cmdCircQ3, "Upper quartile round the circle. For 1,2,3,6 q3 is 2.25.") - ttCalculator.SetToolTip(cmdMedianHL, " Median using Hodges-Lehmann estimate. For example with 1,2,3,6, medianHL (and median) give 1.5.") - ttCalculator.SetToolTip(cmdCircMedian, "Circular median. For example with 23 and 2 representing hours, median(circular(c(23,2), units=""hours"")) gives 0,5.") - ttCalculator.SetToolTip(cmdAngVar, "The angular variance is twice the circular variance, so between 0 and 2.") - ttCalculator.SetToolTip(cmdA1, "Ratio of Bessel functions for values of kappa parameter. Used in the von Mises (circular normal) distribution kappa = 0.9 gives A1 same as rho value for 1,2,3,6 data.") - ttCalculator.SetToolTip(cmdAngDev, "The angular deviation is square root of the angular variance, so between 0 and sqrt(2).") - + ttCalculator.SetToolTip(cmdPbias, "percent bias between sim and obs") + ttCalculator.SetToolTip(cmdPbiasfdc, "percent bias in the slope of the midsegment of the flow duration curve") + ttCalculator.SetToolTip(cmdRd, "relative index of agreement (d) between sim and obs. (Value is between 0 and 1)") + ttCalculator.SetToolTip(cmdRmse, "root mean square error between sim and obs, so the standard deviation of the model prediction error") + ttCalculator.SetToolTip(cmdRNSE, "relative Nash-Sutcliffe efficiency between sim and obs") + ttCalculator.SetToolTip(cmdRPearson, "correlation between sim and obs") + ttCalculator.SetToolTip(cmdRSD, "ratio of standard deviations between sim and obs") + ttCalculator.SetToolTip(cmdRsr, "ratio of the root mean square error between sim and obs to the standard deviation of obs") + ttCalculator.SetToolTip(cmdSsq, "sum of squared residuals between sim and obs") + ttCalculator.SetToolTip(cmdVE, " volumetric efficiency between sim and obs (Value is between 0 and 1)") + + 'Wakefield Tooltips + ttCalculator.SetToolTip(cmdAge, "Sample of ages, with default from 20 to 35") + ttCalculator.SetToolTip(cmdAnimal, "Sample of animals, with default of 10 from a list of 591 animals!") + ttCalculator.SetToolTip(cmdPet, "Sample of pets. Default is dog, cat, none, bird, horse, with given probabilities") + ttCalculator.SetToolTip(cmdAnswer, " Sample of No or Yes, with defaults of equal probability") + ttCalculator.SetToolTip(cmdCar, "Sample of cars, with datasets mtcars makes as default") + ttCalculator.SetToolTip(cmdChildren, "Sample of number of children, with default 0 to 10 and defined probabilities") + ttCalculator.SetToolTip(cmdCoin, "Sample giving heads or tails with default of equal probability") + ttCalculator.SetToolTip(cmdColor, "Sample by default from the 657 colours in the grDevices package") + ttCalculator.SetToolTip(cmdPrimary, "Sample by default from the colours, red, green, blue, yellow, black, and white. Are those your primary colours?") + ttCalculator.SetToolTip(cmdWakefieldDates, " Sample of dates with default being dates in order, by month, for the past year") + ttCalculator.SetToolTip(cmdDeath, "Sample giving FALSE/TRUE with default being equally likely") + ttCalculator.SetToolTip(cmdDice, "Sample with default being equally likely from a 6 sided dice") + ttCalculator.SetToolTip(cmdDna, "Sample with default being equally likely from Guanine, Adenine, Thymine, Cytosine") + ttCalculator.SetToolTip(cmdDob, "Sample of dates, with default being for 2 years, starting 15 years ago") + ttCalculator.SetToolTip(cmdDummy, "Sample of 0 and 1, with default equally likely") + ttCalculator.SetToolTip(cmdEducation, "Sample of 12 education levels from No education to doctorate with defined probabilities") + ttCalculator.SetToolTip(cmdEmployment, "Sample of 5 employment levels, namely: full-time, part-time, unemployed, retired, student") + ttCalculator.SetToolTip(cmdEye, "Sample of 5 eye colours, namely: brown, blue green, hazel, grey") + ttCalculator.SetToolTip(cmdGrade_Level, "Sample of grade levels from 1 to 12") + ttCalculator.SetToolTip(cmdGrade, "Sample from normal disribution with default mean 88 and sd 4. See also grade_letter and gpa") + ttCalculator.SetToolTip(cmdGrade_Letter, "Sample from normal distribution with default mean 88 snd sd 4, with fixed translation into A+ to F") + ttCalculator.SetToolTip(cmdGpa, "Sample from normal distribution with default mean 88 and sd 4, with fixed translation into gpa of 4 to 0") + ttCalculator.SetToolTip(cmdGroup, "Sample generating 2 groups, with default of random assignment to Control and Treatment, with equal probabilities") + ttCalculator.SetToolTip(cmdHair, "Sample with default of 4 hair colours, brown, black, blonde, red, and defined probabilities") + ttCalculator.SetToolTip(cmdHeight, "Sample from normal distribution with default mean 69, and sd 3.75, min 1, and no specified max, rounded to no decimals") + ttCalculator.SetToolTip(cmdIncome, "Sample from a gamma distribution with mean 40,000 and shape 2. (Multiply the result to change the mean)") + ttCalculator.SetToolTip(cmdInternet_Browser, "Sample from ""Which browser do you use?"" with Chrome, IE, Firefox, Safari, Opera, Android, being the options") + ttCalculator.SetToolTip(cmdIq, "Sample from normal distribution with default of mean 100 and sd 15 - not 10 as provided by the package") + ttCalculator.SetToolTip(cmdLanguage, "Sample of world's languages with default being list of 99 languages, provided, together with their proportions") + ttCalculator.SetToolTip(cmdWakefield_lower_factor, "Sample of single letters, with default being one of a,b,c,d,e") + ttCalculator.SetToolTip(cmdMath, "Sample of integers with default of 1 to 4, and probabilities based on New York grading in maths for Grades 3 to 8 children. (Called level instead if equally likely)") + ttCalculator.SetToolTip(cmdWakefieldMinute, "Sample of minutes as H:M:S time elements. (Tweak command to hours or seconds if needed)") + ttCalculator.SetToolTip(cmdLikert, "Sample from 5-point scale, ranging from strongly agree to strongly disagree, with default of equal probabilities") + ttCalculator.SetToolTip(cmdLorem_ipsum, "Provides random gibberish text, based on Latin") + ttCalculator.SetToolTip(cmdMarital, "Sample with default of 5 categories, Married, Divorced, Widowed, Separated, Never Married, equally likely") + ttCalculator.SetToolTip(cmdMilitary, "Sample with default of 5 categories, Army, etc, and proportions to match US military") + ttCalculator.SetToolTip(cmdWakefield_Month, "Sample of months with default using full names for all months and equal proportions") + ttCalculator.SetToolTip(cmdName, "Sample of names, with default from provided list of 95,025 different gender-neutral names, (so sampled without replacement)") + ttCalculator.SetToolTip(cmdNormal, "Sample from normal distribution, with default being standard normal, (mean 0, sd 1) and no min or max values specified") + ttCalculator.SetToolTip(cmdPolitical, "Sample of political parties with default being 5 categories based on US registered voters") + ttCalculator.SetToolTip(cmdRace, "Sample with default of 8 races (white, to Hawaiaan) and US proportions") + ttCalculator.SetToolTip(cmdReligion, "Sample with default of 8 religions and world ratios of numbers in each") + ttCalculator.SetToolTip(cmdSat, "Sample of SAT scores. Normal distribution and default changed from package values to give mean of 1000 and maximum of 1600") + ttCalculator.SetToolTip(cmdSentence, "Sample of sentences with default supplied list from 2012 presidential debate") + ttCalculator.SetToolTip(cmdGender, "Sample of male, female with default proportions matching gender makeup") + ttCalculator.SetToolTip(cmdSex_Inclusive, "Sample of male, female, intersex, with default proportion of transgender from 2011 report") + ttCalculator.SetToolTip(cmdWakefieldTimes, "Sample of times of day as H:M:S time elements") + ttCalculator.SetToolTip(cmdSmokes, "Logical (TRUE/FALSE) sample with default of 18% smokers") + ttCalculator.SetToolTip(cmdSpeed, "Sample from normal distribution, with default mean 55 and sd 10") + ttCalculator.SetToolTip(cmdState, "Sample with default from the 50 US states in proportion to their 2010 populations") + ttCalculator.SetToolTip(cmdString, "Sample with default of 10 random alphanumeric characters") + ttCalculator.SetToolTip(cmdWakefield_Upper_factor, "Sample of single capital letter, with default being one of A, B, C, D, E") + ttCalculator.SetToolTip(cmdValid, "Logical (TRUE/FALSE) sample with default being equal probability") + ttCalculator.SetToolTip(cmdWakefield_Year, "Sample of years with default from 1996 to current year, with equal probability") Const strTooltipCmdLength = "number of observations: For example length(c(1,2,3,4,NA)) = 5 " ttCalculator.SetToolTip(cmdLength, strTooltipCmdLength) @@ -2206,7 +2245,7 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldPrimaryFunction.ToScript, 0) End Sub - Private Sub cmdDate_Stamp_Click(sender As Object, e As EventArgs) Handles cmdDate_Stamp.Click + Private Sub cmdWakefieldDates_Click(sender As Object, e As EventArgs) Handles cmdWakefieldDates.Click Dim clsWakefieldDateStampFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction Dim clsStartDateFunction As New RFunction @@ -2246,20 +2285,21 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldDeathFunction.ToScript, 0) End Sub - Private Sub cmdDied_Click(sender As Object, e As EventArgs) Handles cmdDied.Click - Dim clsWakefieldDiedFunction As New RFunction + Private Sub cmdGrade_Letter_Click(sender As Object, e As EventArgs) Handles cmdGrade_letter.Click + Dim clsWakefieldgrade_letterFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsWakefieldDiedFunction.SetPackageName("wakefield") - clsWakefieldDiedFunction.SetRCommand("died") - clsWakefieldDiedFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldDiedFunction.AddParameter("prob", "NULL", iPosition:=1) - clsWakefieldDiedFunction.AddParameter("name", Chr(34) & "Died" & Chr(34), iPosition:=2) + clsWakefieldgrade_letterFunction.SetPackageName("wakefield") + clsWakefieldgrade_letterFunction.SetRCommand("grade_letter") + clsWakefieldgrade_letterFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldgrade_letterFunction.AddParameter("mean", "88", iPosition:=1) + clsWakefieldgrade_letterFunction.AddParameter("sd", "4", iPosition:=2) + clsWakefieldgrade_letterFunction.AddParameter("name", Chr(34) & "Grade_letter" & Chr(34), iPosition:=3) - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldDiedFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldgrade_letterFunction.ToScript, 0) End Sub Private Sub cmdDice_Click(sender As Object, e As EventArgs) Handles cmdDice.Click @@ -2650,7 +2690,7 @@ Public Class ucrCalculator clsWakefieldIQFunction.SetRCommand("iq") clsWakefieldIQFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) clsWakefieldIQFunction.AddParameter("mean", "100", iPosition:=1) - clsWakefieldIQFunction.AddParameter("sd", "10", iPosition:=2) + clsWakefieldIQFunction.AddParameter("sd", "15", iPosition:=2) clsWakefieldIQFunction.AddParameter("min", "0", iPosition:=3) clsWakefieldIQFunction.AddParameter("max", "NULL", iPosition:=4) clsWakefieldIQFunction.AddParameter("digits", "0", iPosition:=5) @@ -2677,21 +2717,22 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLanguageFunction.ToScript, 0) End Sub - Private Sub cmdLevel_Click(sender As Object, e As EventArgs) Handles cmdLevel.Click - Dim clsWakefieldLevelFunction As New RFunction + Private Sub cmdWakefieldLower_Click(sender As Object, e As EventArgs) + Dim clsWakefieldLowerFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsWakefieldLevelFunction.SetPackageName("wakefield") - clsWakefieldLevelFunction.SetRCommand("level") - clsWakefieldLevelFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldLevelFunction.AddParameter("x", "1:4", iPosition:=1) - clsWakefieldLevelFunction.AddParameter("prob", "NULL", iPosition:=2) - clsWakefieldLevelFunction.AddParameter("name", Chr(34) & "Level" & Chr(34), iPosition:=3) + clsWakefieldLowerFunction.SetPackageName("wakefield") + clsWakefieldLowerFunction.SetRCommand("lower") + clsWakefieldLowerFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldLowerFunction.AddParameter("k", "5", iPosition:=1) + clsWakefieldLowerFunction.AddParameter("x", "LETTERS", iPosition:=2) + clsWakefieldLowerFunction.AddParameter("prob", "NULL", iPosition:=3) + clsWakefieldLowerFunction.AddParameter("name", Chr(34) & "Lower" & Chr(34), iPosition:=4) - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLevelFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLowerFunction.ToScript, 0) End Sub Private Sub cmdMath_Click(sender As Object, e As EventArgs) Handles cmdMath.Click Dim clsWakefieldMathFunction As New RFunction @@ -2717,28 +2758,19 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldMathFunction.ToScript, 0) End Sub - Private Sub cmdEla_Click(sender As Object, e As EventArgs) Handles cmdEla.Click - Dim clsWakefieldElaFunction As New RFunction + Private Sub cmdWakefieldMinute_Click(sender As Object, e As EventArgs) Handles cmdWakefieldMinute.Click '"""""" + Dim clsWakefieldMinuteFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction - Dim clsELAProbFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsELAProbFunction.SetRCommand("c") - clsELAProbFunction.AddParameter("0.3161", "0.29829", iPosition:=0, bIncludeArgumentName:=False) - clsELAProbFunction.AddParameter("0.37257", "0.37257", iPosition:=1, bIncludeArgumentName:=False) - clsELAProbFunction.AddParameter("0.2233", "0.2233", iPosition:=2, bIncludeArgumentName:=False) - clsELAProbFunction.AddParameter("0.08803", "0.08803", iPosition:=3, bIncludeArgumentName:=False) + clsWakefieldMinuteFunction.SetPackageName("wakefield") + clsWakefieldMinuteFunction.SetRCommand("minute") + clsWakefieldMinuteFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldMinuteFunction.AddParameter("name", Chr(34) & "Minute" & Chr(34), iPosition:=3) - clsWakefieldElaFunction.SetPackageName("wakefield") - clsWakefieldElaFunction.SetRCommand("ela") - clsWakefieldElaFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldElaFunction.AddParameter("x", "1:4", iPosition:=1) - clsWakefieldElaFunction.AddParameter("prob", clsRFunctionParameter:=clsELAProbFunction, iPosition:=2) - clsWakefieldElaFunction.AddParameter("name", Chr(34) & "ELA" & Chr(34), iPosition:=3) - - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldElaFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldMinuteFunction.ToScript, 0) End Sub Private Sub cmdGpa_Click(sender As Object, e As EventArgs) Handles cmdGpa.Click @@ -3031,10 +3063,10 @@ Public Class ucrCalculator clsWakefieldSatFunction.SetPackageName("wakefield") clsWakefieldSatFunction.SetRCommand("sat") clsWakefieldSatFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldSatFunction.AddParameter("mean", "1500", iPosition:=1) - clsWakefieldSatFunction.AddParameter("sd", "100", iPosition:=2) - clsWakefieldSatFunction.AddParameter("min", "0", iPosition:=3) - clsWakefieldSatFunction.AddParameter("max", "2400", iPosition:=4) + clsWakefieldSatFunction.AddParameter("mean", "1000", iPosition:=1) + clsWakefieldSatFunction.AddParameter("sd", "150", iPosition:=2) + clsWakefieldSatFunction.AddParameter("min", "400", iPosition:=3) + clsWakefieldSatFunction.AddParameter("max", "1600", iPosition:=4) clsWakefieldSatFunction.AddParameter("digits", "0", iPosition:=5) clsWakefieldSatFunction.AddParameter("name", Chr(34) & "SAT" & Chr(34), iPosition:=6) @@ -3108,31 +3140,19 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldSexInclusiveFunction.ToScript, 0) End Sub - Private Sub cmdSex_Click(sender As Object, e As EventArgs) Handles cmdSex.Click - Dim clsWakefieldSexFunction As New RFunction + Private Sub cmdWakefieldTimes_Click(sender As Object, e As EventArgs) Handles cmdWakefieldTimes.Click + Dim clsWakefieldtime_stampFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction - Dim clsSexListFunction As New RFunction - Dim clsSexProbFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsSexListFunction.SetRCommand("c") - clsSexListFunction.AddParameter("male", Chr(34) & "Male" & Chr(34), iPosition:=0, bIncludeArgumentName:=False) - clsSexListFunction.AddParameter("female", Chr(34) & "Female" & Chr(34), iPosition:=1, bIncludeArgumentName:=False) - - clsSexProbFunction.SetRCommand("c") - clsSexProbFunction.AddParameter("0.51219512195122", "0.51219512195122", iPosition:=0, bIncludeArgumentName:=False) - clsSexProbFunction.AddParameter("0.48780487804878", "0.48780487804878", iPosition:=1, bIncludeArgumentName:=False) + clsWakefieldtime_stampFunction.SetPackageName("wakefield") + clsWakefieldtime_stampFunction.SetRCommand("time_stamp") + clsWakefieldtime_stampFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldtime_stampFunction.AddParameter("name", Chr(34) & "Time_stamp" & Chr(34), iPosition:=3) - clsWakefieldSexFunction.SetPackageName("wakefield") - clsWakefieldSexFunction.SetRCommand("sex") - clsWakefieldSexFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldSexFunction.AddParameter("x", clsRFunctionParameter:=clsSexListFunction, iPosition:=1) - clsWakefieldSexFunction.AddParameter("prob", clsRFunctionParameter:=clsSexProbFunction, iPosition:=2) - clsWakefieldSexFunction.AddParameter("name", Chr(34) & "Sex" & Chr(34), iPosition:=3) - - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldSexFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldtime_stampFunction.ToScript, 0) End Sub Private Sub cmdSmokes_Click(sender As Object, e As EventArgs) Handles cmdSmokes.Click @@ -3210,22 +3230,40 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldStringFunction.ToScript, 0) End Sub - Private Sub cmdWakefield_Upper_Click(sender As Object, e As EventArgs) Handles cmdWakefield_Upper.Click - Dim clsWakefieldUpperFunction As New RFunction + Private Sub cmdWakefield_Upper_Click(sender As Object, e As EventArgs) Handles cmdWakefieldUpper.Click + Dim clsWakefieldUpper_factorFunction As New RFunction + Dim clsWakefieldNrowFunction As New RFunction + + clsWakefieldNrowFunction.SetRCommand("nrow") + clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) + + clsWakefieldUpper_factorFunction.SetPackageName("wakefield") + clsWakefieldUpper_factorFunction.SetRCommand("upper_factor") + clsWakefieldUpper_factorFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldUpper_factorFunction.AddParameter("k", "5", iPosition:=1) + clsWakefieldUpper_factorFunction.AddParameter("x", "LETTERS", iPosition:=2) + clsWakefieldUpper_factorFunction.AddParameter("prob", "NULL", iPosition:=3) + clsWakefieldUpper_factorFunction.AddParameter("name", Chr(34) & "Upper_factor" & Chr(34), iPosition:=4) + + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldUpper_factorFunction.ToScript, 0) + End Sub + + Private Sub cmdWakefield_lower_factor_click(sender As Object, e As EventArgs) Handles cmdWakefieldLower.Click + Dim clsWakefieldLower_FactorFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsWakefieldUpperFunction.SetPackageName("wakefield") - clsWakefieldUpperFunction.SetRCommand("upper") - clsWakefieldUpperFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldUpperFunction.AddParameter("k", "5", iPosition:=1) - clsWakefieldUpperFunction.AddParameter("x", "LETTERS", iPosition:=2) - clsWakefieldUpperFunction.AddParameter("prob", "NULL", iPosition:=3) - clsWakefieldUpperFunction.AddParameter("name", Chr(34) & "Upper" & Chr(34), iPosition:=4) + clsWakefieldLower_FactorFunction.SetPackageName("wakefield") + clsWakefieldLower_FactorFunction.SetRCommand("lower_factor") + clsWakefieldLower_FactorFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldLower_FactorFunction.AddParameter("k", "5", iPosition:=1) + clsWakefieldLower_FactorFunction.AddParameter("x", "letters", iPosition:=2) + clsWakefieldLower_FactorFunction.AddParameter("prob", "NULL", iPosition:=3) + clsWakefieldLower_FactorFunction.AddParameter("name", Chr(34) & "Lower_factor" & Chr(34), iPosition:=4) - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldUpperFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLower_FactorFunction.ToScript, 0) End Sub Private Sub cmdValid_Click(sender As Object, e As EventArgs) Handles cmdValid.Click @@ -3263,7 +3301,7 @@ Public Class ucrCalculator Private Sub cmdCircMean_Click(sender As Object, e As EventArgs) Handles cmdCircMean.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular:: mean.circular(x = , na.rm = TRUE, control.circular = list())", 43) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular:: mean.circular(x = , na.rm = FALSE, control.circular = list())", 44) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::mean.circular()", 1) End If @@ -3271,7 +3309,7 @@ Public Class ucrCalculator Private Sub cmdCircMedian_Click(sender As Object, e As EventArgs) Handles cmdCircMedian.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::median.circular(x = , na.rm = TRUE)", 16) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::median.circular(x = , na.rm = FALSE)", 17) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::median.circular()", 1) End If @@ -3279,7 +3317,7 @@ Public Class ucrCalculator Private Sub cmdMedianHL_Click(sender As Object, e As EventArgs) Handles cmdMedianHL.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular(x = , na.rm = TRUE, method = c(""HL1"",""HL2"",""HL3""), prop = NULL)", 60) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular(x = , na.rm = FALSE, method = c(HL1,HL2,HL3), prop = NULL)", 55) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular()", 1) End If @@ -3287,7 +3325,7 @@ Public Class ucrCalculator Private Sub cmdCircRange_Click(sender As Object, e As EventArgs) Handles cmdCircRange.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::range.circular(x = , test = FALSE, na.rm = TRUE, finite = FALSE, control.circular = list(), )", 75) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::range.circular(x = , test = FALSE, na.rm = FALSE, finite = FALSE, control.circular = list(), )", 76) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::range.circular()", 1) End If @@ -3295,7 +3333,7 @@ Public Class ucrCalculator Private Sub cmdCircSd_Click(sender As Object, e As EventArgs) Handles cmdCircSd.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::sd.circular(x = , na.rm = TRUE)", 17) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::sd.circular(x = , na.rm = FALSE)", 18) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::sd.circular()", 1) End If @@ -3303,7 +3341,7 @@ Public Class ucrCalculator Private Sub cmdCircVar_Click(sender As Object, e As EventArgs) Handles cmdCircVar.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::var.circular(x = , na.rm = TRUE)", 17) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::var.circular(x = , na.rm = FALSE)", 18) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::var.circular()", 1) End If @@ -3313,13 +3351,13 @@ Public Class ucrCalculator If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::A1(kappa = )", 2) Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::A1()", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::besselI()", 1) End If End Sub Private Sub cmdAngVar_Click(sender As Object, e As EventArgs) Handles cmdAngVar.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.variance(x = , na.rm = TRUE)", 16) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.variance(x = , na.rm = FALSE)", 17) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.variance()", 1) End If @@ -3327,7 +3365,7 @@ Public Class ucrCalculator Private Sub cmdAngDev_Click(sender As Object, e As EventArgs) Handles cmdAngDev.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.deviation(x = , na.rm = TRUE)", 16) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.deviation(x = , na.rm = FALSE)", 17) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.deviation()", 1) End If @@ -3335,7 +3373,7 @@ Public Class ucrCalculator Private Sub cmdCircQ1_Click(sender As Object, e As EventArgs) Handles cmdCircQ1.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.25, na.rm = TRUE, names = TRUE, type = 7)", 54) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.25, na.rm = FALSE, names = TRUE, type = 7)", 55) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.25)", 16) End If @@ -3343,7 +3381,7 @@ Public Class ucrCalculator Private Sub cmdCircMin_Click(sender As Object, e As EventArgs) Handles cmdCircMin.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0, na.rm = TRUE, names = TRUE, type = 7)", 51) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0, na.rm = FALSE, names = TRUE, type = 7)", 52) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0)", 13) End If @@ -3351,7 +3389,7 @@ Public Class ucrCalculator Private Sub cmdCircMax_Click(sender As Object, e As EventArgs) Handles cmdCircMax.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 1, na.rm = TRUE, names = TRUE, type = 7)", 51) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 1, na.rm = FALSE, names = TRUE, type = 7)", 52) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 1)", 13) End If @@ -3359,7 +3397,7 @@ Public Class ucrCalculator Private Sub cmdCircQ3_Click(sender As Object, e As EventArgs) Handles cmdCircQ3.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.75, na.rm = TRUE, names = TRUE, type = 7)", 54) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.75, na.rm = FALSE, names = TRUE, type = 7)", 55) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.75)", 16) End If @@ -3367,15 +3405,15 @@ Public Class ucrCalculator Private Sub cmdCircQuantiles_Click_1(sender As Object, e As EventArgs) Handles cmdCircQuantiles.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25), na.rm = TRUE, names = TRUE, type = 7)", 65) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25), na.rm = FALSE, names = TRUE, type = 7)", 66) Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25))", 27) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25))", 28) End If End Sub Private Sub cmdCircRho_Click_1(sender As Object, e As EventArgs) Handles cmdCircRho.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::rho.circular(x = , na.rm = TRUE)", 16) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::rho.circular(x = , na.rm = FALSE)", 17) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::rho.circular()", 1) End If @@ -3689,7 +3727,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdLinkert7_Click(sender As Object, e As EventArgs) Handles cmdLinkert7.Click + Private Sub cmdLikert7_Click(sender As Object, e As EventArgs) Handles cmdLinkert7.Click '"""""""" Dim clsWakefieldLikert7Function As New RFunction Dim clsWakefieldNrowFunction As New RFunction Dim clsLikert7ListFunction As New RFunction @@ -3711,7 +3749,7 @@ Public Class ucrCalculator clsWakefieldLikert7Function.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) clsWakefieldLikert7Function.AddParameter("x", clsRFunctionParameter:=clsLikert7ListFunction, iPosition:=1) clsWakefieldLikert7Function.AddParameter("prob", "NULL", iPosition:=2) - clsWakefieldLikert7Function.AddParameter("name", Chr(34) & "Likert" & Chr(34), iPosition:=3) + clsWakefieldLikert7Function.AddParameter("name", Chr(34) & "Likert7" & Chr(34), iPosition:=3) ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLikert7Function.ToScript, 0) End Sub @@ -5509,4 +5547,8 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition("as.complex( )", 1) End If End Sub + + Private Sub cmdWakefieldLower_Click_1(sender As Object, e As EventArgs) Handles cmdWakefieldLower.Click + + End Sub End Class From e9ca3f6f8200f02efba62832f58223087a3e4e74 Mon Sep 17 00:00:00 2001 From: n-thony Date: Mon, 25 Mar 2024 13:15:30 +0300 Subject: [PATCH 48/88] Solving comments --- instat/clsRLink.vb | 23 ++++++++----------- .../InstatObject/R/stand_alone_functions.R | 10 ++++---- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index 1ad69497b49..b17773cf6d4 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -997,11 +997,9 @@ Public Class RLink End If ' Split the strOutput into an array of lines, removing empty entries - Dim arrFilesPaths() As String = strOutput.Split({vbCrLf, Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) + Dim arrFilesPaths() As String = strOutput.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) - ' Check if strOutput is not empty and all files correspond to existing HTML files with content - If Not String.IsNullOrEmpty(strOutput) AndAlso arrFilesPaths.All(Function(_path) File.Exists(_path) AndAlso New FileInfo(_path).Length > 0 AndAlso - Path.GetExtension(_path).Equals(".html", StringComparison.OrdinalIgnoreCase)) Then + If bAsFile Then ' Iterate through each HTML files For Each _path In arrFilesPaths ' Add each HTML file as an output to clsOutputLogger @@ -1046,17 +1044,14 @@ Public Class RLink expTemp = GetSymbol(strTempAssignTo, bSilent:=True) Evaluate("rm(" & strTempAssignTo & ")", bSilent:=True) If expTemp IsNot Nothing Then - ' If expTemp is not null - ' Extract the file path names from the expTemp and join into a single string - ' Split the string into an array of file path names, removing empty entries - ' Check if each file path name corresponds to an existing file with content - ' If so, filter out invalid file paths - ' Combine the valid file paths into a single string separated by newline characters - ' If no valid file paths remain, set strFilesPath to an empty string - strFilesPath = String.Join(Environment.NewLine, expTemp.AsCharacter()) - Dim arrFilesPath() As String = strFilesPath.Split({vbCrLf, Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) + ' Convert CharacterVector to String() array + Dim arrFilesPath As String() = expTemp.AsCharacter().Select(Function(x) x.ToString()).ToArray() + + ' Filter out invalid file paths arrFilesPath = arrFilesPath.Where(Function(path) File.Exists(path) AndAlso New FileInfo(path).Length > 0).ToArray() - strFilesPath = If(arrFilesPath.Length = 0, "", String.Join(Environment.NewLine, arrFilesPath)) + + ' Join the valid file paths with newline characters + strFilesPath = String.Join(Environment.NewLine, arrFilesPath) End If Return strFilesPath diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index 48e38e2530b..6058528b1ac 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2755,7 +2755,7 @@ view_html_object <- function(html_objects) { object_class_names <- class(html_object) # Generate a unique temporary file name - file_name <- tempfile(pattern = paste0("viewhtml_", i, "_"), fileext = ".html") + file_name <- tempfile(pattern = "viewhtml_", fileext = ".html") if ("htmlwidget" %in% object_class_names) { # Note: When selfcontained is set to True @@ -2781,11 +2781,11 @@ view_html_object <- function(html_objects) { # Save unrecognized HTML objects as generic HTML unrecognized_objects <- html_objects[!sapply(html_objects, function(x) any(class(x) %in% c("htmlwidget", "sjTable", "gt_tbl")))] + + # Check if there are any unrecognized objects if (length(unrecognized_objects) > 0) { - file_names <- NULL # Clear file_names - file_name <- tempfile(pattern = "viewhtml_unrecognized_", fileext = ".html") - gt::gtsave(html_objects, filename = file_name) - file_names <- file_name + # Print the unrecognized objects + print(unrecognized_objects) } message("R viewer not detected. Files saved in locations: ", paste(file_names, collapse = ", ")) From f2142bc60a691b2c2f1c5322c41d707dfedc4fa2 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:16:07 +0100 Subject: [PATCH 49/88] code Changes --- instat/dlgTransform.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 79e1ad6fe20..30c868bd016 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -782,7 +782,7 @@ Public Class dlgTransform ucrSaveNew.SetLabelText("Suffix Name:") ucrSaveNew.btnColumnPosition.Visible = False If Not ucrReceiverRank.IsEmpty AndAlso (Not ucrSaveNew.bUserTyped) Then - ucrSaveNew.SetPrefix(ucrReceiverRank.GetVariableNames(bWithQuotes:=False)) + clsAddColumnsFunction.AddParameter("col_data", "col", iPosition:=1) End If End If From d8f1010b4c674f3d7c8ac35d880ad68d4ef85784 Mon Sep 17 00:00:00 2001 From: n-thony Date: Mon, 25 Mar 2024 16:29:17 +0300 Subject: [PATCH 50/88] bug fixes on tables --- .../InstatObject/R/stand_alone_functions.R | 85 +++++++++---------- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index 6058528b1ac..ba7e3339831 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2734,7 +2734,19 @@ view_text_object <- function(text_object){ #if the viewer is not available then #it saves the object as a file in the temporary folder #and returns the file path. -view_html_object <- function(html_objects) { +view_html_object <- function(html_object){ + # Check if html_object is a list and has more than one element + if (is.list(html_object) && length(html_object) > 1 && all(sapply(html_object, class) == class(html_object[[1]]))) { + # If html_object is a list with multiple elements of the same class, + # recursively call view_html_object on each element + file_names <- vector("list", length(html_object)) + for (i in seq_along(html_object)) { + file_names[[i]] <- view_html_object(html_object[[i]]) + } + return(file_names) + } + + #if there is a viewer, like in the case of RStudio then just print the object #this check is primarily meant to make this function work in a similar manner when run outside R-Instat r_viewer <- base::getOption("viewer") @@ -2742,54 +2754,37 @@ view_html_object <- function(html_objects) { #When print command is called in R-Studio, a temp file is #automatically created. TODO. Investigate how that can be done in R-Instat. #as of 07/09/2022 just return the object. Important for RStudio to display the object - return(html_objects) + return(html_object) } - # Initialize a vector to store file names - file_names <- vector("list", length(html_objects)) - - for (i in seq_along(html_objects)) { - # Get the current HTML object - html_object <- html_objects[[i]] - - object_class_names <- class(html_object) - - # Generate a unique temporary file name - file_name <- tempfile(pattern = "viewhtml_", fileext = ".html") - - if ("htmlwidget" %in% object_class_names) { - # Note: When selfcontained is set to True - # a "Saving a widget with selfcontained = TRUE requires pandoc" error is thrown in R-Instat - # when saving an rpivotTable - # TODO: Investigate how to solve it then. - htmlwidgets::saveWidget(html_object, file = file_name, selfcontained = FALSE) - } else if ("sjTable" %in% object_class_names) { - # "sjTable" objects are not compatible with "htmlwidgets" package. So they have to be saved differently - # "sjplot" package produces "sjTable" objects - html_object$file = file_name - # TODO: Is there any other function that can save an sjTable to a html file? - print(html_object) - } else if ("gt_tbl" %in% object_class_names) { - # "gt table" objects are not compatible with "htmlwidgets" package. So they have to be saved differently. - # "mmtable2" package produces "gt_tbl" objects - gt::gtsave(html_object, filename = file_name) - } - - # Store the file name in the vector - file_names[[i]] <- file_name - } - - # Save unrecognized HTML objects as generic HTML - unrecognized_objects <- html_objects[!sapply(html_objects, function(x) any(class(x) %in% c("htmlwidget", "sjTable", "gt_tbl")))] - - # Check if there are any unrecognized objects - if (length(unrecognized_objects) > 0) { - # Print the unrecognized objects - print(unrecognized_objects) + file_names <- list() # Initialize as an empty list + + #get a unique temporary file name from the tempdir path + file_name <- tempfile(pattern = "viewhtml", fileext = ".html") + + #get a vector of available class names + object_class_names <- class(html_object) + #save the object as a html file depending on the object type + if ("htmlwidget" %in% object_class_names) { + #Note. When selfcontained is set to True + #a "Saving a widget with selfcontained = TRUE requires pandoc" error is thrown in R-Instat + #when saving an rpivotTable + #TODO. Investigate how to solve it then. + htmlwidgets::saveWidget(html_object, file = file_name, selfcontained = FALSE) + } else if ("sjTable" %in% object_class_names) { + #"sjTable" objects are not compatible with "htmlwidgets" package. So they have to be saved differently + #"sjplot" package produces "sjTable" objects + html_object$file = file_name + #TODO. Is there any other function that can save an sjTable to a html file? + print(html_object) + } else if ("gt_tbl" %in% object_class_names) { + #"gt table" objects are not compatible with "htmlwidgets" package. So they have to be saved differently. + #"mmtable2" package produces "gt_tbl" objects + gt::gtsave(html_object,filename = file_name) } - message("R viewer not detected. Files saved in locations: ", paste(file_names, collapse = ", ")) - return(file_names) + message("R viewer not detected. File saved in location ", file_name) + return(file_name) } From 767e1ffc40f75f8fc636e06c57954d4f8b485d94 Mon Sep 17 00:00:00 2001 From: n-thony Date: Mon, 25 Mar 2024 16:40:58 +0300 Subject: [PATCH 51/88] minor bug fix --- instat/static/InstatObject/R/stand_alone_functions.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index ba7e3339831..f0a596af271 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2736,7 +2736,7 @@ view_text_object <- function(text_object){ #and returns the file path. view_html_object <- function(html_object){ # Check if html_object is a list and has more than one element - if (is.list(html_object) && length(html_object) > 1 && all(sapply(html_object, class) == class(html_object[[1]]))) { + if (is.list(html_object) && all(sapply(html_object, class) == class(html_object[[1]]))) { # If html_object is a list with multiple elements of the same class, # recursively call view_html_object on each element file_names <- vector("list", length(html_object)) From 81dbbef7cfc61b94b3a7eb356f15b0c8d9abcc2f Mon Sep 17 00:00:00 2001 From: n-thony Date: Mon, 25 Mar 2024 20:22:37 +0300 Subject: [PATCH 52/88] code improvement --- instat/clsRLink.vb | 5 +-- .../InstatObject/R/stand_alone_functions.R | 43 ++++++++----------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index b17773cf6d4..71c6b2fc6f8 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -996,10 +996,9 @@ Public Class RLink End If End If - ' Split the strOutput into an array of lines, removing empty entries - Dim arrFilesPaths() As String = strOutput.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) - If bAsFile Then + ' Split the strOutput into an array of lines, removing empty entries + Dim arrFilesPaths() As String = strOutput.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) ' Iterate through each HTML files For Each _path In arrFilesPaths ' Add each HTML file as an output to clsOutputLogger diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index f0a596af271..ab83c4d72ad 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2734,53 +2734,45 @@ view_text_object <- function(text_object){ #if the viewer is not available then #it saves the object as a file in the temporary folder #and returns the file path. -view_html_object <- function(html_object){ +view_html_object <- function(html_object) { # Check if html_object is a list and has more than one element if (is.list(html_object) && all(sapply(html_object, class) == class(html_object[[1]]))) { - # If html_object is a list with multiple elements of the same class, - # recursively call view_html_object on each element file_names <- vector("list", length(html_object)) for (i in seq_along(html_object)) { - file_names[[i]] <- view_html_object(html_object[[i]]) + # If html_object is a list with multiple elements of the same class, + # use a for loop to process each element + file_names[[i]] <- process_html_object(html_object[[i]]) } return(file_names) } - - #if there is a viewer, like in the case of RStudio then just print the object - #this check is primarily meant to make this function work in a similar manner when run outside R-Instat + # Process the html_object + return(process_html_object(html_object)) +} + +# Function to process individual HTML object +process_html_object <- function(html_object) { + # Check if R viewer is available r_viewer <- base::getOption("viewer") if (!is.null(r_viewer)) { - #When print command is called in R-Studio, a temp file is - #automatically created. TODO. Investigate how that can be done in R-Instat. - #as of 07/09/2022 just return the object. Important for RStudio to display the object + # If R viewer is available, return the object return(html_object) } - file_names <- list() # Initialize as an empty list - - #get a unique temporary file name from the tempdir path + # Get a unique temporary file name from the tempdir path file_name <- tempfile(pattern = "viewhtml", fileext = ".html") - #get a vector of available class names + # Get a vector of available class names object_class_names <- class(html_object) - #save the object as a html file depending on the object type + + # Save the object as an HTML file depending on the object type if ("htmlwidget" %in% object_class_names) { - #Note. When selfcontained is set to True - #a "Saving a widget with selfcontained = TRUE requires pandoc" error is thrown in R-Instat - #when saving an rpivotTable - #TODO. Investigate how to solve it then. htmlwidgets::saveWidget(html_object, file = file_name, selfcontained = FALSE) } else if ("sjTable" %in% object_class_names) { - #"sjTable" objects are not compatible with "htmlwidgets" package. So they have to be saved differently - #"sjplot" package produces "sjTable" objects html_object$file = file_name - #TODO. Is there any other function that can save an sjTable to a html file? print(html_object) } else if ("gt_tbl" %in% object_class_names) { - #"gt table" objects are not compatible with "htmlwidgets" package. So they have to be saved differently. - #"mmtable2" package produces "gt_tbl" objects - gt::gtsave(html_object,filename = file_name) + gt::gtsave(html_object, filename = file_name) } message("R viewer not detected. File saved in location ", file_name) @@ -2788,6 +2780,7 @@ view_html_object <- function(html_object){ } + #tries to recordPlot if graph_object = NULL, then returns graph object of class "recordedplot". #applicable to base graphs only check_graph <- function(graph_object){ From 59591f49dcbe4b8ff7cdf863614f6e52c32b8066 Mon Sep 17 00:00:00 2001 From: n-thony Date: Tue, 26 Mar 2024 09:01:30 +0300 Subject: [PATCH 53/88] Added comments!!!! --- .../InstatObject/R/stand_alone_functions.R | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index ab83c4d72ad..6b56e32cffa 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2730,10 +2730,6 @@ view_text_object <- function(text_object){ } -#displays the html object in the set R "viewer". -#if the viewer is not available then -#it saves the object as a file in the temporary folder -#and returns the file path. view_html_object <- function(html_object) { # Check if html_object is a list and has more than one element if (is.list(html_object) && all(sapply(html_object, class) == class(html_object[[1]]))) { @@ -2750,12 +2746,19 @@ view_html_object <- function(html_object) { return(process_html_object(html_object)) } -# Function to process individual HTML object +#Function to process individual HTML object +#displays the html object in the set R "viewer". +#if the viewer is not available then +#it saves the object as a file in the temporary folder +#and returns the file path. process_html_object <- function(html_object) { - # Check if R viewer is available + #if there is a viewer, like in the case of RStudio then just print the object + #this check is primarily meant to make this function work in a similar manner when run outside R-Instat r_viewer <- base::getOption("viewer") if (!is.null(r_viewer)) { - # If R viewer is available, return the object + #When print command is called in R-Studio, a temp file is + #automatically created. TODO. Investigate how that can be done in R-Instat. + #as of 07/09/2022 just return the object. Important for RStudio to display the object return(html_object) } @@ -2767,11 +2770,20 @@ process_html_object <- function(html_object) { # Save the object as an HTML file depending on the object type if ("htmlwidget" %in% object_class_names) { + #Note. When selfcontained is set to True + #a "Saving a widget with selfcontained = TRUE requires pandoc" error is thrown in R-Instat + #when saving an rpivotTable + #TODO. Investigate how to solve it then. htmlwidgets::saveWidget(html_object, file = file_name, selfcontained = FALSE) } else if ("sjTable" %in% object_class_names) { + #"sjTable" objects are not compatible with "htmlwidgets" package. So they have to be saved differently + #"sjplot" package produces "sjTable" objects html_object$file = file_name + #TODO. Is there any other function that can save an sjTable to a html file? print(html_object) } else if ("gt_tbl" %in% object_class_names) { + #"gt table" objects are not compatible with "htmlwidgets" package. So they have to be saved differently. + #"mmtable2" package produces "gt_tbl" objects gt::gtsave(html_object, filename = file_name) } From eb35a3baaf6e02204c91531e1533e82312105178 Mon Sep 17 00:00:00 2001 From: JUMA Date: Tue, 26 Mar 2024 10:41:19 +0300 Subject: [PATCH 54/88] chngs --- instat/ucrCalculator.Designer.vb | 410 +++++++++++++++---------------- instat/ucrCalculator.vb | 61 ++--- 2 files changed, 228 insertions(+), 243 deletions(-) diff --git a/instat/ucrCalculator.Designer.vb b/instat/ucrCalculator.Designer.vb index f5246755495..9989539db07 100644 --- a/instat/ucrCalculator.Designer.vb +++ b/instat/ucrCalculator.Designer.vb @@ -62,7 +62,6 @@ Partial Class ucrCalculator Me.cmd0 = New System.Windows.Forms.Button() Me.cmd1 = New System.Windows.Forms.Button() Me.grpDates = New System.Windows.Forms.GroupBox() - Me.cmdRHelp = New instat.ucrSplitButton() Me.ContextMenuStripDate = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.DateLubridateToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DateHmsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -119,7 +118,6 @@ Partial Class ucrCalculator Me.cmdGCD = New System.Windows.Forms.Button() Me.cmdGeneratePrimes = New System.Windows.Forms.Button() Me.cmdNthPrime = New System.Windows.Forms.Button() - Me.cmdIntegerRHelp = New instat.ucrSplitButton() Me.ContextMenuStripInteger = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.GmpToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DescToolsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -142,7 +140,6 @@ Partial Class ucrCalculator Me.cmdIsPrime = New System.Windows.Forms.Button() Me.cmdBigZ = New System.Windows.Forms.Button() Me.grpFactor = New System.Windows.Forms.GroupBox() - Me.cmdTransformHelp = New instat.ucrSplitButton() Me.ContextMenuStripFactor = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.FactorForcatsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cmdShuffle = New System.Windows.Forms.Button() @@ -166,7 +163,6 @@ Partial Class ucrCalculator Me.cmdFactor = New System.Windows.Forms.Button() Me.cmdAnon = New System.Windows.Forms.Button() Me.grpHydroGOF = New System.Windows.Forms.GroupBox() - Me.cmdHydroHelp = New instat.ucrSplitButton() Me.ContextMenuStripHydroGOF = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.HydroGOFToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cmdVE = New System.Windows.Forms.Button() @@ -191,15 +187,15 @@ Partial Class ucrCalculator Me.cmdCp = New System.Windows.Forms.Button() Me.cmdBr2 = New System.Windows.Forms.Button() Me.grpWakefield = New System.Windows.Forms.GroupBox() - Me.cmdLinkert7 = New System.Windows.Forms.Button() + Me.cmdLikert7 = New System.Windows.Forms.Button() Me.cmdWakefield_Year = New System.Windows.Forms.Button() Me.cmdValid = New System.Windows.Forms.Button() - Me.cmdWakefield_Upper = New System.Windows.Forms.Button() + Me.cmdWakefieldUpper = New System.Windows.Forms.Button() Me.cmdString = New System.Windows.Forms.Button() Me.cmdState = New System.Windows.Forms.Button() Me.cmdSpeed = New System.Windows.Forms.Button() Me.cmdSmokes = New System.Windows.Forms.Button() - Me.cmdSex = New System.Windows.Forms.Button() + Me.cmdWakefieldTimes = New System.Windows.Forms.Button() Me.cmdSex_Inclusive = New System.Windows.Forms.Button() Me.cmdGender = New System.Windows.Forms.Button() Me.cmdSentence = New System.Windows.Forms.Button() @@ -215,7 +211,7 @@ Partial Class ucrCalculator Me.cmdLorem_ipsum = New System.Windows.Forms.Button() Me.cmdLikert = New System.Windows.Forms.Button() Me.cmdGpa = New System.Windows.Forms.Button() - Me.cmdEla = New System.Windows.Forms.Button() + Me.cmdWakefieldMinute = New System.Windows.Forms.Button() Me.cmdMath = New System.Windows.Forms.Button() Me.cmdWakefieldLower = New System.Windows.Forms.Button() Me.cmdLanguage = New System.Windows.Forms.Button() @@ -229,7 +225,7 @@ Partial Class ucrCalculator Me.cmdDob = New System.Windows.Forms.Button() Me.cmdDna = New System.Windows.Forms.Button() Me.cmdDice = New System.Windows.Forms.Button() - Me.cmdDied = New System.Windows.Forms.Button() + Me.cmdGrade_Letter = New System.Windows.Forms.Button() Me.cmdDeath = New System.Windows.Forms.Button() Me.cmdWakefieldDates = New System.Windows.Forms.Button() Me.cmdPrimary = New System.Windows.Forms.Button() @@ -247,7 +243,6 @@ Partial Class ucrCalculator Me.cmdGroup = New System.Windows.Forms.Button() Me.cmdGrade = New System.Windows.Forms.Button() Me.grpMaths = New System.Windows.Forms.GroupBox() - Me.cmdMathsHelp = New instat.ucrSplitButton() Me.ContextMenuStripMaths = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.MathsBaseStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.MathsStatsStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -281,7 +276,6 @@ Partial Class ucrCalculator Me.cmdwhichmax = New System.Windows.Forms.Button() Me.cmdwheremax = New System.Windows.Forms.Button() Me.cmdwhichmin = New System.Windows.Forms.Button() - Me.cmdSummaryRHelp = New instat.ucrSplitButton() Me.ContextMenuStripSummary = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.BaseToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem() Me.StatsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -335,7 +329,6 @@ Partial Class ucrCalculator Me.cmdVar = New System.Windows.Forms.Button() Me.grpProbabilty = New System.Windows.Forms.GroupBox() Me.cmdPascal = New System.Windows.Forms.Button() - Me.cmdProbRHelp = New instat.ucrSplitButton() Me.ContextMenuStripProbability = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.ProbStatsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ProbBaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -384,7 +377,6 @@ Partial Class ucrCalculator Me.cmdDecimals = New System.Windows.Forms.Button() Me.cmdMASSFractions = New System.Windows.Forms.Button() Me.cmdScale = New System.Windows.Forms.Button() - Me.cmdTransformRHelp = New instat.ucrSplitButton() Me.ContextMenuStripTransform = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.BaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DplyrToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -419,7 +411,6 @@ Partial Class ucrCalculator Me.cmdLead = New System.Windows.Forms.Button() Me.cmdLag = New System.Windows.Forms.Button() Me.grpLogical = New System.Windows.Forms.GroupBox() - Me.cmdLogicalHelp = New instat.ucrSplitButton() Me.ContextMenuStripLogical = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.LogBaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.LogDplyrToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -483,7 +474,6 @@ Partial Class ucrCalculator Me.cmdSquishb = New System.Windows.Forms.Button() Me.ttCalculator = New System.Windows.Forms.ToolTip(Me.components) Me.grpCircular = New System.Windows.Forms.GroupBox() - Me.cmdCircularHelp = New instat.ucrSplitButton() Me.ContextMenuStripCircular = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.CircularToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cmdCircular = New System.Windows.Forms.Button() @@ -526,7 +516,6 @@ Partial Class ucrCalculator Me.grpComplex = New System.Windows.Forms.GroupBox() Me.cmdAsComplex = New System.Windows.Forms.Button() Me.cmdComplexi = New System.Windows.Forms.Button() - Me.cmdComplexRHelp = New instat.ucrSplitButton() Me.cmdComplexTanH = New System.Windows.Forms.Button() Me.cmdComplexTan = New System.Windows.Forms.Button() Me.cmdComplexPi = New System.Windows.Forms.Button() @@ -617,6 +606,17 @@ Partial Class ucrCalculator Me.ucrInputCalOptions = New instat.ucrInputComboBox() Me.ucrSelectorForCalculations = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverForCalculation = New instat.ucrReceiverExpression() + Me.cmdCircularHelp = New instat.ucrSplitButton() + Me.cmdMathsHelp = New instat.ucrSplitButton() + Me.cmdProbRHelp = New instat.ucrSplitButton() + Me.cmdIntegerRHelp = New instat.ucrSplitButton() + Me.cmdComplexRHelp = New instat.ucrSplitButton() + Me.cmdSummaryRHelp = New instat.ucrSplitButton() + Me.cmdTransformRHelp = New instat.ucrSplitButton() + Me.cmdLogicalHelp = New instat.ucrSplitButton() + Me.cmdRHelp = New instat.ucrSplitButton() + Me.cmdHydroHelp = New instat.ucrSplitButton() + Me.cmdTransformHelp = New instat.ucrSplitButton() Me.grpBasic.SuspendLayout Me.grpDates.SuspendLayout Me.ContextMenuStripDate.SuspendLayout @@ -953,18 +953,6 @@ Partial Class ucrCalculator Me.grpDates.TabStop = False Me.grpDates.Text = "Dates/Times" ' - 'cmdRHelp - ' - Me.cmdRHelp.AutoSize = True - Me.cmdRHelp.ContextMenuStrip = Me.ContextMenuStripDate - Me.cmdRHelp.Location = New System.Drawing.Point(186, 164) - Me.cmdRHelp.Name = "cmdRHelp" - Me.cmdRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdRHelp.SplitMenuStrip = Me.ContextMenuStripDate - Me.cmdRHelp.TabIndex = 212 - Me.cmdRHelp.Text = "R Help" - Me.cmdRHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripDate ' Me.ContextMenuStripDate.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -1562,18 +1550,6 @@ Partial Class ucrCalculator Me.cmdNthPrime.Text = "nth_prime" Me.cmdNthPrime.UseVisualStyleBackColor = True ' - 'cmdIntegerRHelp - ' - Me.cmdIntegerRHelp.AutoSize = True - Me.cmdIntegerRHelp.ContextMenuStrip = Me.ContextMenuStripInteger - Me.cmdIntegerRHelp.Location = New System.Drawing.Point(262, 354) - Me.cmdIntegerRHelp.Name = "cmdIntegerRHelp" - Me.cmdIntegerRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdIntegerRHelp.SplitMenuStrip = Me.ContextMenuStripInteger - Me.cmdIntegerRHelp.TabIndex = 16 - Me.cmdIntegerRHelp.Text = "R Help" - Me.cmdIntegerRHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripInteger ' Me.ContextMenuStripInteger.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -1779,18 +1755,6 @@ Partial Class ucrCalculator Me.grpFactor.TabStop = False Me.grpFactor.Text = "Factor" ' - 'cmdTransformHelp - ' - Me.cmdTransformHelp.AutoSize = True - Me.cmdTransformHelp.ContextMenuStrip = Me.ContextMenuStripFactor - Me.cmdTransformHelp.Location = New System.Drawing.Point(188, 218) - Me.cmdTransformHelp.Name = "cmdTransformHelp" - Me.cmdTransformHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdTransformHelp.SplitMenuStrip = Me.ContextMenuStripFactor - Me.cmdTransformHelp.TabIndex = 212 - Me.cmdTransformHelp.Text = "R Help" - Me.cmdTransformHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripFactor ' Me.ContextMenuStripFactor.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -2057,18 +2021,6 @@ Partial Class ucrCalculator Me.grpHydroGOF.TabStop = False Me.grpHydroGOF.Text = "hydroGOF " ' - 'cmdHydroHelp - ' - Me.cmdHydroHelp.AutoSize = True - Me.cmdHydroHelp.ContextMenuStrip = Me.ContextMenuStripHydroGOF - Me.cmdHydroHelp.Location = New System.Drawing.Point(113, 298) - Me.cmdHydroHelp.Name = "cmdHydroHelp" - Me.cmdHydroHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdHydroHelp.SplitMenuStrip = Me.ContextMenuStripHydroGOF - Me.cmdHydroHelp.TabIndex = 212 - Me.cmdHydroHelp.Text = "R Help" - Me.cmdHydroHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripHydroGOF ' Me.ContextMenuStripHydroGOF.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -2315,15 +2267,15 @@ Partial Class ucrCalculator ' 'grpWakefield ' - Me.grpWakefield.Controls.Add(Me.cmdLinkert7) + Me.grpWakefield.Controls.Add(Me.cmdLikert7) Me.grpWakefield.Controls.Add(Me.cmdWakefield_Year) Me.grpWakefield.Controls.Add(Me.cmdValid) - Me.grpWakefield.Controls.Add(Me.cmdWakefield_Upper) + Me.grpWakefield.Controls.Add(Me.cmdWakefieldUpper) Me.grpWakefield.Controls.Add(Me.cmdString) Me.grpWakefield.Controls.Add(Me.cmdState) Me.grpWakefield.Controls.Add(Me.cmdSpeed) Me.grpWakefield.Controls.Add(Me.cmdSmokes) - Me.grpWakefield.Controls.Add(Me.cmdSex) + Me.grpWakefield.Controls.Add(Me.cmdWakefieldTimes) Me.grpWakefield.Controls.Add(Me.cmdSex_Inclusive) Me.grpWakefield.Controls.Add(Me.cmdGender) Me.grpWakefield.Controls.Add(Me.cmdSentence) @@ -2339,7 +2291,7 @@ Partial Class ucrCalculator Me.grpWakefield.Controls.Add(Me.cmdLorem_ipsum) Me.grpWakefield.Controls.Add(Me.cmdLikert) Me.grpWakefield.Controls.Add(Me.cmdGpa) - Me.grpWakefield.Controls.Add(Me.cmdEla) + Me.grpWakefield.Controls.Add(Me.cmdWakefieldMinute) Me.grpWakefield.Controls.Add(Me.cmdMath) Me.grpWakefield.Controls.Add(Me.cmdWakefieldLower) Me.grpWakefield.Controls.Add(Me.cmdLanguage) @@ -2353,7 +2305,7 @@ Partial Class ucrCalculator Me.grpWakefield.Controls.Add(Me.cmdDob) Me.grpWakefield.Controls.Add(Me.cmdDna) Me.grpWakefield.Controls.Add(Me.cmdDice) - Me.grpWakefield.Controls.Add(Me.cmdDied) + Me.grpWakefield.Controls.Add(Me.cmdGrade_Letter) Me.grpWakefield.Controls.Add(Me.cmdDeath) Me.grpWakefield.Controls.Add(Me.cmdWakefieldDates) Me.grpWakefield.Controls.Add(Me.cmdPrimary) @@ -2377,16 +2329,16 @@ Partial Class ucrCalculator Me.grpWakefield.TabStop = False Me.grpWakefield.Text = "Wakefield" ' - 'cmdLinkert7 + 'cmdLikert7 ' - Me.cmdLinkert7.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) - Me.cmdLinkert7.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdLinkert7.Location = New System.Drawing.Point(427, 382) - Me.cmdLinkert7.Name = "cmdLinkert7" - Me.cmdLinkert7.Size = New System.Drawing.Size(107, 38) - Me.cmdLinkert7.TabIndex = 54 - Me.cmdLinkert7.Text = "linkert7 (O.F)" - Me.cmdLinkert7.UseVisualStyleBackColor = True + Me.cmdLikert7.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) + Me.cmdLikert7.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdLikert7.Location = New System.Drawing.Point(427, 382) + Me.cmdLikert7.Name = "cmdLikert7" + Me.cmdLikert7.Size = New System.Drawing.Size(107, 38) + Me.cmdLikert7.TabIndex = 54 + Me.cmdLikert7.Text = "likert7 (O.F)" + Me.cmdLikert7.UseVisualStyleBackColor = True ' 'cmdWakefield_Year ' @@ -2410,16 +2362,16 @@ Partial Class ucrCalculator Me.cmdValid.Text = "valid (L)" Me.cmdValid.UseVisualStyleBackColor = True ' - 'cmdWakefield_Upper + 'cmdWakefieldUpper ' - Me.cmdWakefield_Upper.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) - Me.cmdWakefield_Upper.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdWakefield_Upper.Location = New System.Drawing.Point(112, 382) - Me.cmdWakefield_Upper.Name = "cmdWakefield_Upper" - Me.cmdWakefield_Upper.Size = New System.Drawing.Size(107, 38) - Me.cmdWakefield_Upper.TabIndex = 51 - Me.cmdWakefield_Upper.Text = "upper (C)" - Me.cmdWakefield_Upper.UseVisualStyleBackColor = True + Me.cmdWakefieldUpper.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) + Me.cmdWakefieldUpper.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdWakefieldUpper.Location = New System.Drawing.Point(112, 382) + Me.cmdWakefieldUpper.Name = "cmdWakefieldUpper" + Me.cmdWakefieldUpper.Size = New System.Drawing.Size(107, 38) + Me.cmdWakefieldUpper.TabIndex = 51 + Me.cmdWakefieldUpper.Text = "upper (F)" + Me.cmdWakefieldUpper.UseVisualStyleBackColor = True ' 'cmdString ' @@ -2465,16 +2417,16 @@ Partial Class ucrCalculator Me.cmdSmokes.Text = "smokes (L)" Me.cmdSmokes.UseVisualStyleBackColor = True ' - 'cmdSex + 'cmdWakefieldTimes ' - Me.cmdSex.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) - Me.cmdSex.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdSex.Location = New System.Drawing.Point(112, 347) - Me.cmdSex.Name = "cmdSex" - Me.cmdSex.Size = New System.Drawing.Size(107, 38) - Me.cmdSex.TabIndex = 46 - Me.cmdSex.Text = "sex (F)" - Me.cmdSex.UseVisualStyleBackColor = True + Me.cmdWakefieldTimes.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) + Me.cmdWakefieldTimes.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdWakefieldTimes.Location = New System.Drawing.Point(112, 347) + Me.cmdWakefieldTimes.Name = "cmdWakefieldTimes" + Me.cmdWakefieldTimes.Size = New System.Drawing.Size(107, 38) + Me.cmdWakefieldTimes.TabIndex = 46 + Me.cmdWakefieldTimes.Text = "times (T)" + Me.cmdWakefieldTimes.UseVisualStyleBackColor = True ' 'cmdSex_Inclusive ' @@ -2641,16 +2593,16 @@ Partial Class ucrCalculator Me.cmdGpa.Text = "gpa" Me.cmdGpa.UseVisualStyleBackColor = True ' - 'cmdEla + 'cmdWakefieldMinute ' - Me.cmdEla.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) - Me.cmdEla.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdEla.Location = New System.Drawing.Point(7, 237) - Me.cmdEla.Name = "cmdEla" - Me.cmdEla.Size = New System.Drawing.Size(107, 38) - Me.cmdEla.TabIndex = 30 - Me.cmdEla.Text = "ela" - Me.cmdEla.UseVisualStyleBackColor = True + Me.cmdWakefieldMinute.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) + Me.cmdWakefieldMinute.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdWakefieldMinute.Location = New System.Drawing.Point(7, 237) + Me.cmdWakefieldMinute.Name = "cmdWakefieldMinute" + Me.cmdWakefieldMinute.Size = New System.Drawing.Size(107, 38) + Me.cmdWakefieldMinute.TabIndex = 30 + Me.cmdWakefieldMinute.Text = "minute (T)" + Me.cmdWakefieldMinute.UseVisualStyleBackColor = True ' 'cmdMath ' @@ -2795,16 +2747,16 @@ Partial Class ucrCalculator Me.cmdDice.Text = "dice" Me.cmdDice.UseVisualStyleBackColor = True ' - 'cmdDied + 'cmdGrade_Letter ' - Me.cmdDied.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) - Me.cmdDied.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdDied.Location = New System.Drawing.Point(112, 90) - Me.cmdDied.Name = "cmdDied" - Me.cmdDied.Size = New System.Drawing.Size(107, 38) - Me.cmdDied.TabIndex = 11 - Me.cmdDied.Text = "died (L)" - Me.cmdDied.UseVisualStyleBackColor = True + Me.cmdGrade_Letter.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.25!) + Me.cmdGrade_Letter.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdGrade_Letter.Location = New System.Drawing.Point(112, 90) + Me.cmdGrade_Letter.Name = "cmdGrade_Letter" + Me.cmdGrade_Letter.Size = New System.Drawing.Size(107, 38) + Me.cmdGrade_Letter.TabIndex = 11 + Me.cmdGrade_Letter.Text = "grade_letter(F)" + Me.cmdGrade_Letter.UseVisualStyleBackColor = True ' 'cmdDeath ' @@ -3017,18 +2969,6 @@ Partial Class ucrCalculator Me.grpMaths.TabStop = False Me.grpMaths.Text = "Maths" ' - 'cmdMathsHelp - ' - Me.cmdMathsHelp.AutoSize = True - Me.cmdMathsHelp.ContextMenuStrip = Me.ContextMenuStripMaths - Me.cmdMathsHelp.Location = New System.Drawing.Point(204, 165) - Me.cmdMathsHelp.Name = "cmdMathsHelp" - Me.cmdMathsHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdMathsHelp.SplitMenuStrip = Me.ContextMenuStripMaths - Me.cmdMathsHelp.TabIndex = 211 - Me.cmdMathsHelp.Text = "R Help" - Me.cmdMathsHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripMaths ' Me.ContextMenuStripMaths.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -3407,18 +3347,6 @@ Partial Class ucrCalculator Me.cmdwhichmin.Text = "which.min" Me.cmdwhichmin.UseVisualStyleBackColor = True ' - 'cmdSummaryRHelp - ' - Me.cmdSummaryRHelp.AutoSize = True - Me.cmdSummaryRHelp.ContextMenuStrip = Me.ContextMenuStripSummary - Me.cmdSummaryRHelp.Location = New System.Drawing.Point(228, 238) - Me.cmdSummaryRHelp.Name = "cmdSummaryRHelp" - Me.cmdSummaryRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdSummaryRHelp.SplitMenuStrip = Me.ContextMenuStripSummary - Me.cmdSummaryRHelp.TabIndex = 185 - Me.cmdSummaryRHelp.Text = "R Help" - Me.cmdSummaryRHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripSummary ' Me.ContextMenuStripSummary.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -4041,18 +3969,6 @@ Partial Class ucrCalculator Me.cmdPascal.Text = "pascal" Me.cmdPascal.UseVisualStyleBackColor = True ' - 'cmdProbRHelp - ' - Me.cmdProbRHelp.AutoSize = True - Me.cmdProbRHelp.ContextMenuStrip = Me.ContextMenuStripProbability - Me.cmdProbRHelp.Location = New System.Drawing.Point(269, 239) - Me.cmdProbRHelp.Name = "cmdProbRHelp" - Me.cmdProbRHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdProbRHelp.SplitMenuStrip = Me.ContextMenuStripProbability - Me.cmdProbRHelp.TabIndex = 212 - Me.cmdProbRHelp.Text = "R Help" - Me.cmdProbRHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripProbability ' Me.ContextMenuStripProbability.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -4643,18 +4559,6 @@ Partial Class ucrCalculator Me.cmdScale.Text = "scale" Me.cmdScale.UseVisualStyleBackColor = True ' - 'cmdTransformRHelp - ' - Me.cmdTransformRHelp.AutoSize = True - Me.cmdTransformRHelp.ContextMenuStrip = Me.ContextMenuStripTransform - Me.cmdTransformRHelp.Location = New System.Drawing.Point(267, 245) - Me.cmdTransformRHelp.Name = "cmdTransformRHelp" - Me.cmdTransformRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdTransformRHelp.SplitMenuStrip = Me.ContextMenuStripTransform - Me.cmdTransformRHelp.TabIndex = 204 - Me.cmdTransformRHelp.Text = "R Help" - Me.cmdTransformRHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripTransform ' Me.ContextMenuStripTransform.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -5010,18 +4914,6 @@ Partial Class ucrCalculator Me.grpLogical.TabStop = False Me.grpLogical.Text = "Logical and Symbols" ' - 'cmdLogicalHelp - ' - Me.cmdLogicalHelp.AutoSize = True - Me.cmdLogicalHelp.ContextMenuStrip = Me.ContextMenuStripLogical - Me.cmdLogicalHelp.Location = New System.Drawing.Point(207, 234) - Me.cmdLogicalHelp.Name = "cmdLogicalHelp" - Me.cmdLogicalHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdLogicalHelp.SplitMenuStrip = Me.ContextMenuStripLogical - Me.cmdLogicalHelp.TabIndex = 212 - Me.cmdLogicalHelp.Text = "R Help" - Me.cmdLogicalHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripLogical ' Me.ContextMenuStripLogical.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -5769,18 +5661,6 @@ Partial Class ucrCalculator Me.grpCircular.TabStop = False Me.grpCircular.Text = "Circular" ' - 'cmdCircularHelp - ' - Me.cmdCircularHelp.AutoSize = True - Me.cmdCircularHelp.ContextMenuStrip = Me.ContextMenuStripCircular - Me.cmdCircularHelp.Location = New System.Drawing.Point(197, 178) - Me.cmdCircularHelp.Name = "cmdCircularHelp" - Me.cmdCircularHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdCircularHelp.SplitMenuStrip = Me.ContextMenuStripCircular - Me.cmdCircularHelp.TabIndex = 212 - Me.cmdCircularHelp.Text = "R Help" - Me.cmdCircularHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripCircular ' Me.ContextMenuStripCircular.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -6276,18 +6156,6 @@ Partial Class ucrCalculator Me.cmdComplexi.Text = "i" Me.cmdComplexi.UseVisualStyleBackColor = True ' - 'cmdComplexRHelp - ' - Me.cmdComplexRHelp.AutoSize = True - Me.cmdComplexRHelp.ContextMenuStrip = Me.ContextMenuStripComplex - Me.cmdComplexRHelp.Location = New System.Drawing.Point(228, 212) - Me.cmdComplexRHelp.Name = "cmdComplexRHelp" - Me.cmdComplexRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdComplexRHelp.SplitMenuStrip = Me.ContextMenuStripComplex - Me.cmdComplexRHelp.TabIndex = 209 - Me.cmdComplexRHelp.Text = "R Help" - Me.cmdComplexRHelp.UseVisualStyleBackColor = True - ' 'cmdComplexTanH ' Me.cmdComplexTanH.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) @@ -7281,7 +7149,7 @@ Partial Class ucrCalculator ' Me.cmdWakefieldHelp.AutoSize = True Me.cmdWakefieldHelp.ContextMenuStrip = Me.ContextMenuStripWakefield - Me.cmdWakefieldHelp.Location = New System.Drawing.Point(968, 52) + Me.cmdWakefieldHelp.Location = New System.Drawing.Point(967, 43) Me.cmdWakefieldHelp.Name = "cmdWakefieldHelp" Me.cmdWakefieldHelp.Size = New System.Drawing.Size(113, 28) Me.cmdWakefieldHelp.SplitMenuStrip = Me.ContextMenuStripWakefield @@ -7357,13 +7225,145 @@ Partial Class ucrCalculator Me.ucrReceiverForCalculation.TabIndex = 120 Me.ucrReceiverForCalculation.ucrSelector = Nothing ' + 'cmdCircularHelp + ' + Me.cmdCircularHelp.AutoSize = True + Me.cmdCircularHelp.ContextMenuStrip = Me.ContextMenuStripCircular + Me.cmdCircularHelp.Location = New System.Drawing.Point(197, 178) + Me.cmdCircularHelp.Name = "cmdCircularHelp" + Me.cmdCircularHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdCircularHelp.SplitMenuStrip = Me.ContextMenuStripCircular + Me.cmdCircularHelp.TabIndex = 212 + Me.cmdCircularHelp.Text = "R Help" + Me.cmdCircularHelp.UseVisualStyleBackColor = True + ' + 'cmdMathsHelp + ' + Me.cmdMathsHelp.AutoSize = True + Me.cmdMathsHelp.ContextMenuStrip = Me.ContextMenuStripMaths + Me.cmdMathsHelp.Location = New System.Drawing.Point(204, 165) + Me.cmdMathsHelp.Name = "cmdMathsHelp" + Me.cmdMathsHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdMathsHelp.SplitMenuStrip = Me.ContextMenuStripMaths + Me.cmdMathsHelp.TabIndex = 211 + Me.cmdMathsHelp.Text = "R Help" + Me.cmdMathsHelp.UseVisualStyleBackColor = True + ' + 'cmdProbRHelp + ' + Me.cmdProbRHelp.AutoSize = True + Me.cmdProbRHelp.ContextMenuStrip = Me.ContextMenuStripProbability + Me.cmdProbRHelp.Location = New System.Drawing.Point(269, 239) + Me.cmdProbRHelp.Name = "cmdProbRHelp" + Me.cmdProbRHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdProbRHelp.SplitMenuStrip = Me.ContextMenuStripProbability + Me.cmdProbRHelp.TabIndex = 212 + Me.cmdProbRHelp.Text = "R Help" + Me.cmdProbRHelp.UseVisualStyleBackColor = True + ' + 'cmdIntegerRHelp + ' + Me.cmdIntegerRHelp.AutoSize = True + Me.cmdIntegerRHelp.ContextMenuStrip = Me.ContextMenuStripInteger + Me.cmdIntegerRHelp.Location = New System.Drawing.Point(262, 354) + Me.cmdIntegerRHelp.Name = "cmdIntegerRHelp" + Me.cmdIntegerRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdIntegerRHelp.SplitMenuStrip = Me.ContextMenuStripInteger + Me.cmdIntegerRHelp.TabIndex = 16 + Me.cmdIntegerRHelp.Text = "R Help" + Me.cmdIntegerRHelp.UseVisualStyleBackColor = True + ' + 'cmdComplexRHelp + ' + Me.cmdComplexRHelp.AutoSize = True + Me.cmdComplexRHelp.ContextMenuStrip = Me.ContextMenuStripComplex + Me.cmdComplexRHelp.Location = New System.Drawing.Point(228, 212) + Me.cmdComplexRHelp.Name = "cmdComplexRHelp" + Me.cmdComplexRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdComplexRHelp.SplitMenuStrip = Me.ContextMenuStripComplex + Me.cmdComplexRHelp.TabIndex = 209 + Me.cmdComplexRHelp.Text = "R Help" + Me.cmdComplexRHelp.UseVisualStyleBackColor = True + ' + 'cmdSummaryRHelp + ' + Me.cmdSummaryRHelp.AutoSize = True + Me.cmdSummaryRHelp.ContextMenuStrip = Me.ContextMenuStripSummary + Me.cmdSummaryRHelp.Location = New System.Drawing.Point(228, 238) + Me.cmdSummaryRHelp.Name = "cmdSummaryRHelp" + Me.cmdSummaryRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdSummaryRHelp.SplitMenuStrip = Me.ContextMenuStripSummary + Me.cmdSummaryRHelp.TabIndex = 185 + Me.cmdSummaryRHelp.Text = "R Help" + Me.cmdSummaryRHelp.UseVisualStyleBackColor = True + ' + 'cmdTransformRHelp + ' + Me.cmdTransformRHelp.AutoSize = True + Me.cmdTransformRHelp.ContextMenuStrip = Me.ContextMenuStripTransform + Me.cmdTransformRHelp.Location = New System.Drawing.Point(267, 245) + Me.cmdTransformRHelp.Name = "cmdTransformRHelp" + Me.cmdTransformRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdTransformRHelp.SplitMenuStrip = Me.ContextMenuStripTransform + Me.cmdTransformRHelp.TabIndex = 204 + Me.cmdTransformRHelp.Text = "R Help" + Me.cmdTransformRHelp.UseVisualStyleBackColor = True + ' + 'cmdLogicalHelp + ' + Me.cmdLogicalHelp.AutoSize = True + Me.cmdLogicalHelp.ContextMenuStrip = Me.ContextMenuStripLogical + Me.cmdLogicalHelp.Location = New System.Drawing.Point(207, 234) + Me.cmdLogicalHelp.Name = "cmdLogicalHelp" + Me.cmdLogicalHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdLogicalHelp.SplitMenuStrip = Me.ContextMenuStripLogical + Me.cmdLogicalHelp.TabIndex = 212 + Me.cmdLogicalHelp.Text = "R Help" + Me.cmdLogicalHelp.UseVisualStyleBackColor = True + ' + 'cmdRHelp + ' + Me.cmdRHelp.AutoSize = True + Me.cmdRHelp.ContextMenuStrip = Me.ContextMenuStripDate + Me.cmdRHelp.Location = New System.Drawing.Point(186, 164) + Me.cmdRHelp.Name = "cmdRHelp" + Me.cmdRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdRHelp.SplitMenuStrip = Me.ContextMenuStripDate + Me.cmdRHelp.TabIndex = 212 + Me.cmdRHelp.Text = "R Help" + Me.cmdRHelp.UseVisualStyleBackColor = True + ' + 'cmdHydroHelp + ' + Me.cmdHydroHelp.AutoSize = True + Me.cmdHydroHelp.ContextMenuStrip = Me.ContextMenuStripHydroGOF + Me.cmdHydroHelp.Location = New System.Drawing.Point(113, 298) + Me.cmdHydroHelp.Name = "cmdHydroHelp" + Me.cmdHydroHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdHydroHelp.SplitMenuStrip = Me.ContextMenuStripHydroGOF + Me.cmdHydroHelp.TabIndex = 212 + Me.cmdHydroHelp.Text = "R Help" + Me.cmdHydroHelp.UseVisualStyleBackColor = True + ' + 'cmdTransformHelp + ' + Me.cmdTransformHelp.AutoSize = True + Me.cmdTransformHelp.ContextMenuStrip = Me.ContextMenuStripFactor + Me.cmdTransformHelp.Location = New System.Drawing.Point(188, 218) + Me.cmdTransformHelp.Name = "cmdTransformHelp" + Me.cmdTransformHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdTransformHelp.SplitMenuStrip = Me.ContextMenuStripFactor + Me.cmdTransformHelp.TabIndex = 212 + Me.cmdTransformHelp.Text = "R Help" + Me.cmdTransformHelp.UseVisualStyleBackColor = True + ' 'ucrCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(120.0!, 120.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.Controls.Add(Me.grpWakefield) Me.Controls.Add(Me.grpList) + Me.Controls.Add(Me.grpWakefield) Me.Controls.Add(Me.cmdRhelpList) Me.Controls.Add(Me.cmdWakefieldHelp) Me.Controls.Add(Me.cmdStringRHelp) @@ -7614,12 +7614,12 @@ Partial Class ucrCalculator Friend WithEvents ttCalculator As ToolTip Friend WithEvents cmdWakefield_Year As Button Friend WithEvents cmdValid As Button - Friend WithEvents cmdWakefield_Upper As Button + Friend WithEvents cmdWakefieldUpper As Button Friend WithEvents cmdString As Button Friend WithEvents cmdState As Button Friend WithEvents cmdSpeed As Button Friend WithEvents cmdSmokes As Button - Friend WithEvents cmdSex As Button + Friend WithEvents cmdWakefieldTimes As Button Friend WithEvents cmdSex_Inclusive As Button Friend WithEvents cmdGender As Button Friend WithEvents cmdSentence As Button @@ -7634,7 +7634,7 @@ Partial Class ucrCalculator Friend WithEvents cmdMarital As Button Friend WithEvents cmdLorem_ipsum As Button Friend WithEvents cmdGpa As Button - Friend WithEvents cmdEla As Button + Friend WithEvents cmdWakefieldMinute As Button Friend WithEvents cmdMath As Button Friend WithEvents cmdWakefieldLower As Button Friend WithEvents cmdLanguage As Button @@ -7648,7 +7648,7 @@ Partial Class ucrCalculator Friend WithEvents cmdDob As Button Friend WithEvents cmdDna As Button Friend WithEvents cmdDice As Button - Friend WithEvents cmdDied As Button + Friend WithEvents cmdGrade_Letter As Button Friend WithEvents cmdDeath As Button Friend WithEvents cmdWakefieldDates As Button Friend WithEvents cmdPrimary As Button @@ -7733,7 +7733,7 @@ Partial Class ucrCalculator Friend WithEvents cmdQbinom As Button Friend WithEvents cmdQbirth As Button Friend WithEvents cmdQbeta As Button - Friend WithEvents cmdLinkert7 As Button + Friend WithEvents cmdLikert7 As Button Friend WithEvents cmdEncodeb As Button Friend WithEvents cmdSquishb As Button Friend WithEvents cmdExtract2 As Button diff --git a/instat/ucrCalculator.vb b/instat/ucrCalculator.vb index 62cb555c4f2..d06fd9b9e64 100644 --- a/instat/ucrCalculator.vb +++ b/instat/ucrCalculator.vb @@ -105,7 +105,6 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdNasplin, "Spline interpolation of missing values. For example na.spline(c(NA,NA,NA,2,2,NA,4,7,NA),maxgap=2,na.rm=FALSE) = (NA,NA,NA,2,2,2.5,4,7,12)") ttCalculator.SetToolTip(cmdNaest, "Missing values as the mean (usually) overall or with a factor. For example na.aggregate(c(NA,NA,NA,2,2,NA,4,7,NA),maxgap=2,na.rm=FALSE) = (NA,NA,NA,2,2,3.75,4,7,3.75)") - ttCalculator.SetToolTip(cmdPower, "power(^)or exponent and can also be given as **. For example 2^3 = 8") ttCalculator.SetToolTip(cmdLesser, "less than(<). For example (2 < 3) is TRUE. (2 < 2) is FALSE, (2 < 1) is FALSE") ttCalculator.SetToolTip(cmdLesserOrEqualsTo, "less than or equals(<=). For example (2 <= 3) is TRUE, (2 <=2) is TRUE, (2 <= 1) is FALSE") @@ -348,7 +347,7 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdInternet_Browser, "Sample from ""Which browser do you use?"" with Chrome, IE, Firefox, Safari, Opera, Android, being the options") ttCalculator.SetToolTip(cmdIq, "Sample from normal distribution with default of mean 100 and sd 15 - not 10 as provided by the package") ttCalculator.SetToolTip(cmdLanguage, "Sample of world's languages with default being list of 99 languages, provided, together with their proportions") - ttCalculator.SetToolTip(cmdWakefield_lower_factor, "Sample of single letters, with default being one of a,b,c,d,e") + ttCalculator.SetToolTip(cmdWakefieldLower, "Sample of single letters, with default being one of a,b,c,d,e") ttCalculator.SetToolTip(cmdMath, "Sample of integers with default of 1 to 4, and probabilities based on New York grading in maths for Grades 3 to 8 children. (Called level instead if equally likely)") ttCalculator.SetToolTip(cmdWakefieldMinute, "Sample of minutes as H:M:S time elements. (Tweak command to hours or seconds if needed)") ttCalculator.SetToolTip(cmdLikert, "Sample from 5-point scale, ranging from strongly agree to strongly disagree, with default of equal probabilities") @@ -370,9 +369,10 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdSpeed, "Sample from normal distribution, with default mean 55 and sd 10") ttCalculator.SetToolTip(cmdState, "Sample with default from the 50 US states in proportion to their 2010 populations") ttCalculator.SetToolTip(cmdString, "Sample with default of 10 random alphanumeric characters") - ttCalculator.SetToolTip(cmdWakefield_Upper_factor, "Sample of single capital letter, with default being one of A, B, C, D, E") + ttCalculator.SetToolTip(cmdWakefieldUpper, "Sample of single capital letter, with default being one of A, B, C, D, E") ttCalculator.SetToolTip(cmdValid, "Logical (TRUE/FALSE) sample with default being equal probability") ttCalculator.SetToolTip(cmdWakefield_Year, "Sample of years with default from 1996 to current year, with equal probability") + ttCalculator.SetToolTip(cmdLikert7, " Sample from 7-point scale, ranging from strongly agree to strongly disagree, with default of equal probabilities") Const strTooltipCmdLength = "number of observations: For example length(c(1,2,3,4,NA)) = 5 " ttCalculator.SetToolTip(cmdLength, strTooltipCmdLength) @@ -2285,7 +2285,7 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldDeathFunction.ToScript, 0) End Sub - Private Sub cmdGrade_Letter_Click(sender As Object, e As EventArgs) Handles cmdGrade_letter.Click + Private Sub cmdGrade_Letter_Click(sender As Object, e As EventArgs) Handles cmdGrade_Letter.Click Dim clsWakefieldgrade_letterFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction @@ -2297,7 +2297,7 @@ Public Class ucrCalculator clsWakefieldgrade_letterFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) clsWakefieldgrade_letterFunction.AddParameter("mean", "88", iPosition:=1) clsWakefieldgrade_letterFunction.AddParameter("sd", "4", iPosition:=2) - clsWakefieldgrade_letterFunction.AddParameter("name", Chr(34) & "Grade_letter" & Chr(34), iPosition:=3) + clsWakefieldgrade_letterFunction.AddParameter("name", Chr(34) & "Grade_Letter" & Chr(34), iPosition:=3) ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldgrade_letterFunction.ToScript, 0) End Sub @@ -2717,23 +2717,6 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLanguageFunction.ToScript, 0) End Sub - Private Sub cmdWakefieldLower_Click(sender As Object, e As EventArgs) - Dim clsWakefieldLowerFunction As New RFunction - Dim clsWakefieldNrowFunction As New RFunction - - clsWakefieldNrowFunction.SetRCommand("nrow") - clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - - clsWakefieldLowerFunction.SetPackageName("wakefield") - clsWakefieldLowerFunction.SetRCommand("lower") - clsWakefieldLowerFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldLowerFunction.AddParameter("k", "5", iPosition:=1) - clsWakefieldLowerFunction.AddParameter("x", "LETTERS", iPosition:=2) - clsWakefieldLowerFunction.AddParameter("prob", "NULL", iPosition:=3) - clsWakefieldLowerFunction.AddParameter("name", Chr(34) & "Lower" & Chr(34), iPosition:=4) - - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLowerFunction.ToScript, 0) - End Sub Private Sub cmdMath_Click(sender As Object, e As EventArgs) Handles cmdMath.Click Dim clsWakefieldMathFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction @@ -2758,7 +2741,7 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldMathFunction.ToScript, 0) End Sub - Private Sub cmdWakefieldMinute_Click(sender As Object, e As EventArgs) Handles cmdWakefieldMinute.Click '"""""" + Private Sub cmdWakefieldMinute_Click(sender As Object, e As EventArgs) Handles cmdWakefieldMinute.Click Dim clsWakefieldMinuteFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction @@ -2768,7 +2751,10 @@ Public Class ucrCalculator clsWakefieldMinuteFunction.SetPackageName("wakefield") clsWakefieldMinuteFunction.SetRCommand("minute") clsWakefieldMinuteFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldMinuteFunction.AddParameter("name", Chr(34) & "Minute" & Chr(34), iPosition:=3) + clsWakefieldMinuteFunction.AddParameter("x", "seq(0, 59, by = 1)/60 ", iPosition:=1) + clsWakefieldMinuteFunction.AddParameter("prob", "NULL", iPosition:=2) + clsWakefieldMinuteFunction.AddParameter("random", "FALSE", iPosition:=3) + clsWakefieldMinuteFunction.AddParameter("name", Chr(34) & "Minute" & Chr(34), iPosition:=4) ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldMinuteFunction.ToScript, 0) End Sub @@ -3141,18 +3127,21 @@ Public Class ucrCalculator End Sub Private Sub cmdWakefieldTimes_Click(sender As Object, e As EventArgs) Handles cmdWakefieldTimes.Click - Dim clsWakefieldtime_stampFunction As New RFunction + Dim clsWakefieldTimestampFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsWakefieldtime_stampFunction.SetPackageName("wakefield") - clsWakefieldtime_stampFunction.SetRCommand("time_stamp") - clsWakefieldtime_stampFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldtime_stampFunction.AddParameter("name", Chr(34) & "Time_stamp" & Chr(34), iPosition:=3) + clsWakefieldTimestampFunction.SetPackageName("wakefield") + clsWakefieldTimestampFunction.SetRCommand("time_stamp") + clsWakefieldTimestampFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldTimestampFunction.AddParameter("x", "seq(0, 23, by = 1)", iPosition:=1) + clsWakefieldTimestampFunction.AddParameter("prob", "NULL", iPosition:=2) + clsWakefieldTimestampFunction.AddParameter("random", "FALSE", iPosition:=3) + clsWakefieldTimestampFunction.AddParameter("name", Chr(34) & "Time" & Chr(34), iPosition:=4) - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldtime_stampFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldTimestampFunction.ToScript, 0) End Sub Private Sub cmdSmokes_Click(sender As Object, e As EventArgs) Handles cmdSmokes.Click @@ -3243,12 +3232,12 @@ Public Class ucrCalculator clsWakefieldUpper_factorFunction.AddParameter("k", "5", iPosition:=1) clsWakefieldUpper_factorFunction.AddParameter("x", "LETTERS", iPosition:=2) clsWakefieldUpper_factorFunction.AddParameter("prob", "NULL", iPosition:=3) - clsWakefieldUpper_factorFunction.AddParameter("name", Chr(34) & "Upper_factor" & Chr(34), iPosition:=4) + clsWakefieldUpper_factorFunction.AddParameter("name", Chr(34) & "Upper" & Chr(34), iPosition:=4) ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldUpper_factorFunction.ToScript, 0) End Sub - Private Sub cmdWakefield_lower_factor_click(sender As Object, e As EventArgs) Handles cmdWakefieldLower.Click + Private Sub cmdWakefieldLower_click(sender As Object, e As EventArgs) Handles cmdWakefieldLower.Click Dim clsWakefieldLower_FactorFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction @@ -3261,7 +3250,7 @@ Public Class ucrCalculator clsWakefieldLower_FactorFunction.AddParameter("k", "5", iPosition:=1) clsWakefieldLower_FactorFunction.AddParameter("x", "letters", iPosition:=2) clsWakefieldLower_FactorFunction.AddParameter("prob", "NULL", iPosition:=3) - clsWakefieldLower_FactorFunction.AddParameter("name", Chr(34) & "Lower_factor" & Chr(34), iPosition:=4) + clsWakefieldLower_FactorFunction.AddParameter("name", Chr(34) & "Lower" & Chr(34), iPosition:=4) ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLower_FactorFunction.ToScript, 0) End Sub @@ -3727,7 +3716,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdLikert7_Click(sender As Object, e As EventArgs) Handles cmdLinkert7.Click '"""""""" + Private Sub cmdLikert7_Click(sender As Object, e As EventArgs) Handles cmdLikert7.Click Dim clsWakefieldLikert7Function As New RFunction Dim clsWakefieldNrowFunction As New RFunction Dim clsLikert7ListFunction As New RFunction @@ -5547,8 +5536,4 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition("as.complex( )", 1) End If End Sub - - Private Sub cmdWakefieldLower_Click_1(sender As Object, e As EventArgs) Handles cmdWakefieldLower.Click - - End Sub End Class From 56db3d4a55d0392741588e94198ffc15aff2ebf3 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Tue, 26 Mar 2024 10:32:17 +0100 Subject: [PATCH 55/88] Code changes to TestOk --- instat/dlgTransform.vb | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 30c868bd016..18a169332fc 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -754,21 +754,14 @@ Public Class dlgTransform Private Sub TestOKEnabled() If rdoNumeric.Checked AndAlso rdoLogical.Checked Then - If rdoSingle.Checked Then - If Not ucrInputLogicOperations.GetText = "is.na" AndAlso Not ucrInputLogicOperations.GetText = "!is.na" Then - ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete AndAlso Not ucrInputLogicalValues.IsEmpty) - Else - ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete) - End If - ElseIf rdoMultiple.Checked Then - If Not ucrInputLogicOperations.GetText = "is.na" AndAlso Not ucrInputLogicOperations.GetText = "!is.na" Then - ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso Not ucrInputLogicalValues.IsEmpty) - Else - ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty()) - End If + If Not ucrInputLogicOperations.GetText = "is.na" AndAlso Not ucrInputLogicOperations.GetText = "!is.na" Then + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete AndAlso Not ucrInputLogicalValues.IsEmpty) Else - ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty()) + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete) End If + + Else + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty()) End If End Sub From f326863bb9500b7d256502ae049b3a699fd286c7 Mon Sep 17 00:00:00 2001 From: Ntalumeso Date: Tue, 26 Mar 2024 21:46:10 +0300 Subject: [PATCH 56/88] fixed bug in running the script from script window --- instat/clsRLink.vb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index 71c6b2fc6f8..b5bae7a3a64 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -749,8 +749,24 @@ Public Class RLink bShowWaitDialogOverride:=Nothing) End If - clsOutputLogger.AddOutput(clsRStatement.Text, strOutput, bAsFile:=True, - bDisplayOutputInExternalViewer:=clsRStatement.TextNoFormatting.StartsWith("view_object_data")) + ' Split the strOutput into an array of lines, removing empty entries + Dim arrFilesPaths() As String = strOutput.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) + + ' Check if arrFilesPaths has at least one element before iterating + If arrFilesPaths.Length > 0 Then + ' Iterate through each file path + For Each _path In arrFilesPaths + ' Add output to logger + clsOutputLogger.AddOutput(clsRStatement.Text, _path, bAsFile:=True, + bDisplayOutputInExternalViewer:=clsRStatement.TextNoFormatting.StartsWith("view_object_data")) + Next + Else + ' Add output to logger + clsOutputLogger.AddOutput(clsRStatement.Text, strOutput, bAsFile:=True, + bDisplayOutputInExternalViewer:=clsRStatement.TextNoFormatting.StartsWith("view_object_data")) + End If + + ' Log the script LogScript(clsRStatement.Text.TrimEnd(vbCr, vbLf)) Catch e As Exception From f70ff44fa426ded81b7f1aa0152076e9fb8e27a2 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:06:38 +0100 Subject: [PATCH 57/88] Code Changes --- instat/dlgHistogram.vb | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index 20f718dfdeb..74b2176d8c6 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -743,29 +743,21 @@ Public Class dlgHistogram End If End Sub - - Private Sub CoreControls_ControlContentsChanged() Handles ucrVariablesAsFactorforHist.ControlContentsChanged, ucrSaveHist.ControlContentsChanged, ucrFactorReceiver.ControlContentsChanged, ucrChkRidges.ControlContentsChanged, ucrInputAddReorder.ControlContentsChanged, ucrChkBinWidth.ControlContentsChanged, ucrNudBinwidth.ControlContentsChanged, ucrNudMinHeight.ControlContentsChanged - TestOkEnabled() - End Sub - Private Sub ucrChkOmitYAxis_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkOmitYAxis.ControlValueChanged, ucrChkDisplayAsDotPlot.ControlValueChanged - If ucrChkDisplayAsDotPlot.Checked Then - If ucrChkOmitYAxis.Checked Then - clsBaseOperator.AddParameter("scale", clsRFunctionParameter:=clsYlabScalesFunction, iPosition:=4, bIncludeArgumentName:=False) - Else - clsBaseOperator.RemoveParameterByName("scale") - End If + If ucrChkDisplayAsDotPlot.Checked AndAlso ucrChkOmitYAxis.Checked Then + clsBaseOperator.AddParameter("scale", clsRFunctionParameter:=clsYlabScalesFunction, iPosition:=4, bIncludeArgumentName:=False) + Else + clsBaseOperator.RemoveParameterByName("scale") End If End Sub Private Sub ucrChkMinHeight_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkMinHeight.ControlValueChanged, ucrNudMinHeight.ControlValueChanged - If ucrChkRidges.Checked Then - If ucrChkMinHeight.Checked Then - clsRgeomPlotFunction.AddParameter("rel_min_height", ucrNudMinHeight.GetText, iPosition:=4) - Else - clsRgeomPlotFunction.RemoveParameterByName("rel_min_height") - End If + If ucrChkRidges.Checked AndAlso ucrChkMinHeight.Checked Then + clsRgeomPlotFunction.AddParameter("rel_min_height", ucrNudMinHeight.GetText, iPosition:=4) + Else + clsRgeomPlotFunction.RemoveParameterByName("rel_min_height") End If + End Sub Private Sub ucrChkBinWidth_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkBinWidth.ControlValueChanged, ucrNudBinwidth.ControlValueChanged @@ -830,4 +822,7 @@ Public Class dlgHistogram SetPipeAssignTo() End Sub + Private Sub CoreControls_ControlContentsChanged() Handles ucrVariablesAsFactorforHist.ControlContentsChanged, ucrSaveHist.ControlContentsChanged, ucrFactorReceiver.ControlContentsChanged, ucrChkRidges.ControlContentsChanged, ucrInputAddReorder.ControlContentsChanged, ucrChkBinWidth.ControlContentsChanged, ucrNudBinwidth.ControlContentsChanged, ucrNudMinHeight.ControlContentsChanged + TestOkEnabled() + End Sub End Class \ No newline at end of file From 83b1bfdf17e0d74d83267d74a56c9b5791ecb174 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Thu, 28 Mar 2024 10:16:30 +0100 Subject: [PATCH 58/88] Change made --- instat/dlgClimograph.Designer.vb | 283 ++++++++++++++++++++++++++++++- 1 file changed, 282 insertions(+), 1 deletion(-) diff --git a/instat/dlgClimograph.Designer.vb b/instat/dlgClimograph.Designer.vb index cff96c37a9b..241a4a22a6c 100644 --- a/instat/dlgClimograph.Designer.vb +++ b/instat/dlgClimograph.Designer.vb @@ -22,13 +22,273 @@ Partial Class dlgClimograph 'Ne la modifiez pas à l'aide de l'éditeur de code. _ Private Sub InitializeComponent() + Me.ucrReceiverAbsolute = New instat.ucrReceiverSingle() + Me.lblAbsolute = New System.Windows.Forms.Label() + Me.ucrInputStation = New instat.ucrInputComboBox() + Me.ucr1stFactorReceiver = New instat.ucrReceiverSingle() + Me.lblFacetBy = New System.Windows.Forms.Label() + Me.ucrReceiverRain = New instat.ucrReceiverSingle() + Me.lblRain = New System.Windows.Forms.Label() + Me.ucrReceiverMaxtem = New instat.ucrReceiverSingle() + Me.lblMaxtem = New System.Windows.Forms.Label() + Me.ucrReceiverMintemp = New instat.ucrReceiverSingle() + Me.lblMintem = New System.Windows.Forms.Label() + Me.rdoClimograph = New System.Windows.Forms.RadioButton() + Me.rdoWalterLieth = New System.Windows.Forms.RadioButton() + Me.ucrPnlClimograph = New instat.UcrPanel() + Me.ucrBase = New instat.ucrButtons() + Me.ucrSave = New instat.ucrSave() + Me.ucrReceiverMonth = New instat.ucrReceiverSingle() + Me.lblMonth = New System.Windows.Forms.Label() + Me.ucrSelectorClimograph = New instat.ucrSelectorByDataFrameAddRemove() Me.SuspendLayout() ' + 'ucrReceiverAbsolute + ' + Me.ucrReceiverAbsolute.AutoSize = True + Me.ucrReceiverAbsolute.frmParent = Me + Me.ucrReceiverAbsolute.Location = New System.Drawing.Point(267, 280) + Me.ucrReceiverAbsolute.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverAbsolute.Name = "ucrReceiverAbsolute" + Me.ucrReceiverAbsolute.Selector = Nothing + Me.ucrReceiverAbsolute.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverAbsolute.strNcFilePath = "" + Me.ucrReceiverAbsolute.TabIndex = 77 + Me.ucrReceiverAbsolute.ucrSelector = Nothing + ' + 'lblAbsolute + ' + Me.lblAbsolute.AutoSize = True + Me.lblAbsolute.Location = New System.Drawing.Point(267, 264) + Me.lblAbsolute.Name = "lblAbsolute" + Me.lblAbsolute.Size = New System.Drawing.Size(111, 13) + Me.lblAbsolute.TabIndex = 76 + Me.lblAbsolute.Text = "Temperature min, min:" + ' + 'ucrInputStation + ' + Me.ucrInputStation.AddQuotesIfUnrecognised = True + Me.ucrInputStation.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputStation.GetSetSelectedIndex = -1 + Me.ucrInputStation.IsReadOnly = False + Me.ucrInputStation.Location = New System.Drawing.Point(379, 68) + Me.ucrInputStation.Name = "ucrInputStation" + Me.ucrInputStation.Size = New System.Drawing.Size(86, 21) + Me.ucrInputStation.TabIndex = 65 + ' + 'ucr1stFactorReceiver + ' + Me.ucr1stFactorReceiver.AutoSize = True + Me.ucr1stFactorReceiver.frmParent = Me + Me.ucr1stFactorReceiver.Location = New System.Drawing.Point(267, 68) + Me.ucr1stFactorReceiver.Margin = New System.Windows.Forms.Padding(0) + Me.ucr1stFactorReceiver.Name = "ucr1stFactorReceiver" + Me.ucr1stFactorReceiver.Selector = Nothing + Me.ucr1stFactorReceiver.Size = New System.Drawing.Size(109, 26) + Me.ucr1stFactorReceiver.strNcFilePath = "" + Me.ucr1stFactorReceiver.TabIndex = 64 + Me.ucr1stFactorReceiver.ucrSelector = Nothing + ' + 'lblFacetBy + ' + Me.lblFacetBy.AutoSize = True + Me.lblFacetBy.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFacetBy.Location = New System.Drawing.Point(267, 53) + Me.lblFacetBy.Name = "lblFacetBy" + Me.lblFacetBy.Size = New System.Drawing.Size(43, 13) + Me.lblFacetBy.TabIndex = 63 + Me.lblFacetBy.Tag = "" + Me.lblFacetBy.Text = "Station:" + ' + 'ucrReceiverRain + ' + Me.ucrReceiverRain.AutoSize = True + Me.ucrReceiverRain.frmParent = Me + Me.ucrReceiverRain.Location = New System.Drawing.Point(267, 150) + Me.ucrReceiverRain.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverRain.Name = "ucrReceiverRain" + Me.ucrReceiverRain.Selector = Nothing + Me.ucrReceiverRain.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverRain.strNcFilePath = "" + Me.ucrReceiverRain.TabIndex = 69 + Me.ucrReceiverRain.ucrSelector = Nothing + ' + 'lblRain + ' + Me.lblRain.AutoSize = True + Me.lblRain.Location = New System.Drawing.Point(267, 134) + Me.lblRain.Name = "lblRain" + Me.lblRain.Size = New System.Drawing.Size(48, 13) + Me.lblRain.TabIndex = 68 + Me.lblRain.Text = "RainFall:" + ' + 'ucrReceiverMaxtem + ' + Me.ucrReceiverMaxtem.AutoSize = True + Me.ucrReceiverMaxtem.frmParent = Me + Me.ucrReceiverMaxtem.Location = New System.Drawing.Point(267, 193) + Me.ucrReceiverMaxtem.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMaxtem.Name = "ucrReceiverMaxtem" + Me.ucrReceiverMaxtem.Selector = Nothing + Me.ucrReceiverMaxtem.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverMaxtem.strNcFilePath = "" + Me.ucrReceiverMaxtem.TabIndex = 71 + Me.ucrReceiverMaxtem.ucrSelector = Nothing + ' + 'lblMaxtem + ' + Me.lblMaxtem.AutoSize = True + Me.lblMaxtem.Location = New System.Drawing.Point(267, 177) + Me.lblMaxtem.Name = "lblMaxtem" + Me.lblMaxtem.Size = New System.Drawing.Size(93, 13) + Me.lblMaxtem.TabIndex = 70 + Me.lblMaxtem.Text = "Temperature Max:" + ' + 'ucrReceiverMintemp + ' + Me.ucrReceiverMintemp.AutoSize = True + Me.ucrReceiverMintemp.frmParent = Me + Me.ucrReceiverMintemp.Location = New System.Drawing.Point(267, 234) + Me.ucrReceiverMintemp.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMintemp.Name = "ucrReceiverMintemp" + Me.ucrReceiverMintemp.Selector = Nothing + Me.ucrReceiverMintemp.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverMintemp.strNcFilePath = "" + Me.ucrReceiverMintemp.TabIndex = 73 + Me.ucrReceiverMintemp.ucrSelector = Nothing + ' + 'lblMintem + ' + Me.lblMintem.AutoSize = True + Me.lblMintem.Location = New System.Drawing.Point(267, 218) + Me.lblMintem.Name = "lblMintem" + Me.lblMintem.Size = New System.Drawing.Size(90, 13) + Me.lblMintem.TabIndex = 72 + Me.lblMintem.Text = "Temperature Min:" + ' + 'rdoClimograph + ' + Me.rdoClimograph.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoClimograph.BackColor = System.Drawing.SystemColors.Control + Me.rdoClimograph.Enabled = False + Me.rdoClimograph.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoClimograph.FlatAppearance.BorderSize = 2 + Me.rdoClimograph.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoClimograph.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoClimograph.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoClimograph.Location = New System.Drawing.Point(195, 13) + Me.rdoClimograph.Name = "rdoClimograph" + Me.rdoClimograph.Size = New System.Drawing.Size(119, 28) + Me.rdoClimograph.TabIndex = 62 + Me.rdoClimograph.TabStop = True + Me.rdoClimograph.Tag = "" + Me.rdoClimograph.Text = "Ordinary Climograph" + Me.rdoClimograph.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoClimograph.UseVisualStyleBackColor = False + ' + 'rdoWalterLieth + ' + Me.rdoWalterLieth.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoWalterLieth.BackColor = System.Drawing.SystemColors.Control + Me.rdoWalterLieth.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoWalterLieth.FlatAppearance.BorderSize = 2 + Me.rdoWalterLieth.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoWalterLieth.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoWalterLieth.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoWalterLieth.Location = New System.Drawing.Point(117, 13) + Me.rdoWalterLieth.Name = "rdoWalterLieth" + Me.rdoWalterLieth.Size = New System.Drawing.Size(80, 28) + Me.rdoWalterLieth.TabIndex = 61 + Me.rdoWalterLieth.TabStop = True + Me.rdoWalterLieth.Tag = "" + Me.rdoWalterLieth.Text = "Walter Lieth" + Me.rdoWalterLieth.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoWalterLieth.UseVisualStyleBackColor = False + ' + 'ucrPnlClimograph + ' + Me.ucrPnlClimograph.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlClimograph.Location = New System.Drawing.Point(107, 5) + Me.ucrPnlClimograph.Name = "ucrPnlClimograph" + Me.ucrPnlClimograph.Size = New System.Drawing.Size(236, 41) + Me.ucrPnlClimograph.TabIndex = 60 + ' + 'ucrBase + ' + Me.ucrBase.AutoSize = True + Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrBase.Location = New System.Drawing.Point(12, 332) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(408, 52) + Me.ucrBase.TabIndex = 75 + ' + 'ucrSave + ' + Me.ucrSave.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSave.Location = New System.Drawing.Point(12, 305) + Me.ucrSave.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSave.Name = "ucrSave" + Me.ucrSave.Size = New System.Drawing.Size(282, 24) + Me.ucrSave.TabIndex = 74 + ' + 'ucrReceiverMonth + ' + Me.ucrReceiverMonth.AutoSize = True + Me.ucrReceiverMonth.frmParent = Me + Me.ucrReceiverMonth.Location = New System.Drawing.Point(267, 109) + Me.ucrReceiverMonth.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMonth.Name = "ucrReceiverMonth" + Me.ucrReceiverMonth.Selector = Nothing + Me.ucrReceiverMonth.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverMonth.strNcFilePath = "" + Me.ucrReceiverMonth.TabIndex = 67 + Me.ucrReceiverMonth.ucrSelector = Nothing + ' + 'lblMonth + ' + Me.lblMonth.AutoSize = True + Me.lblMonth.Location = New System.Drawing.Point(267, 93) + Me.lblMonth.Name = "lblMonth" + Me.lblMonth.Size = New System.Drawing.Size(40, 13) + Me.lblMonth.TabIndex = 66 + Me.lblMonth.Text = "Month:" + ' + 'ucrSelectorClimograph + ' + Me.ucrSelectorClimograph.AutoSize = True + Me.ucrSelectorClimograph.bDropUnusedFilterLevels = False + Me.ucrSelectorClimograph.bShowHiddenColumns = False + Me.ucrSelectorClimograph.bUseCurrentFilter = True + Me.ucrSelectorClimograph.Location = New System.Drawing.Point(11, 48) + Me.ucrSelectorClimograph.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorClimograph.Name = "ucrSelectorClimograph" + Me.ucrSelectorClimograph.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorClimograph.TabIndex = 59 + ' 'dlgClimograph ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(428, 450) + Me.ClientSize = New System.Drawing.Size(477, 388) + Me.Controls.Add(Me.ucrReceiverAbsolute) + Me.Controls.Add(Me.lblAbsolute) + Me.Controls.Add(Me.ucrInputStation) + Me.Controls.Add(Me.ucr1stFactorReceiver) + Me.Controls.Add(Me.lblFacetBy) + Me.Controls.Add(Me.ucrReceiverRain) + Me.Controls.Add(Me.lblRain) + Me.Controls.Add(Me.ucrReceiverMaxtem) + Me.Controls.Add(Me.lblMaxtem) + Me.Controls.Add(Me.ucrReceiverMintemp) + Me.Controls.Add(Me.lblMintem) + Me.Controls.Add(Me.rdoClimograph) + Me.Controls.Add(Me.rdoWalterLieth) + Me.Controls.Add(Me.ucrPnlClimograph) + Me.Controls.Add(Me.ucrBase) + Me.Controls.Add(Me.ucrSave) + Me.Controls.Add(Me.ucrReceiverMonth) + Me.Controls.Add(Me.lblMonth) + Me.Controls.Add(Me.ucrSelectorClimograph) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -36,6 +296,27 @@ Partial Class dlgClimograph Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Climograph" Me.ResumeLayout(False) + Me.PerformLayout() End Sub + + Friend WithEvents ucrReceiverAbsolute As ucrReceiverSingle + Friend WithEvents lblAbsolute As Label + Friend WithEvents ucrInputStation As ucrInputComboBox + Friend WithEvents ucr1stFactorReceiver As ucrReceiverSingle + Friend WithEvents lblFacetBy As Label + Friend WithEvents ucrReceiverRain As ucrReceiverSingle + Friend WithEvents lblRain As Label + Friend WithEvents ucrReceiverMaxtem As ucrReceiverSingle + Friend WithEvents lblMaxtem As Label + Friend WithEvents ucrReceiverMintemp As ucrReceiverSingle + Friend WithEvents lblMintem As Label + Friend WithEvents rdoClimograph As RadioButton + Friend WithEvents rdoWalterLieth As RadioButton + Friend WithEvents ucrPnlClimograph As UcrPanel + Friend WithEvents ucrBase As ucrButtons + Friend WithEvents ucrSave As ucrSave + Friend WithEvents ucrReceiverMonth As ucrReceiverSingle + Friend WithEvents lblMonth As Label + Friend WithEvents ucrSelectorClimograph As ucrSelectorByDataFrameAddRemove End Class From 32c384f9d69fcddf69da381a5d1efb1ff34079ab Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Thu, 28 Mar 2024 10:22:02 +0100 Subject: [PATCH 59/88] change made --- instat/dlgClimograph.vb | 357 ++++++++++++++++++++++++++++++++++++- instat/frmMain.Designer.vb | 5 +- 2 files changed, 357 insertions(+), 5 deletions(-) diff --git a/instat/dlgClimograph.vb b/instat/dlgClimograph.vb index 26752c99347..97d6da1aebd 100644 --- a/instat/dlgClimograph.vb +++ b/instat/dlgClimograph.vb @@ -1,3 +1,358 @@ -Public Class dlgClimograph +' R- Instat +' Copyright (C) 2015-2017 +' +' 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 +' along with this program. If not, see . +Imports instat.Translations + +Public Class dlgClimograph + Private bFirstload As Boolean = True + Private bReset As Boolean = True + Private clsGgwalterliethFunction, clsDummyFunction As RFunction + Private clsBaseOperator As New ROperator + Private ReadOnly strFacetWrap As String = "Facet Wrap" + Private ReadOnly strFacetRow As String = "Facet Row" + Private ReadOnly strFacetCol As String = "Facet Column" + Private ReadOnly strNone As String = "None" + Private clsFacetFunction As New RFunction + Private clsGroupByFunction As New RFunction + Private clsFacetOperator As New ROperator + Private clsFacetRowOp As New ROperator + Private clsFacetColOp As New ROperator + Private clsPipeOperator As New ROperator + Private bUpdateComboOptions As Boolean = True + Private bUpdatingParameters As Boolean = False + + Private Sub dlgClimograph_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseDialog() + bFirstload = False + End If + If bReset Then + SetDefaults() + End If + SetRCodeForControls(bReset) + bReset = False + TestOKEnabled() + autoTranslate(Me) + End Sub + + Private Sub InitialiseDialog() + ucrBase.iHelpTopicID = 432 + + ucrSelectorClimograph.SetParameter(New RParameter("data", 0)) + ucrSelectorClimograph.SetParameterIsrfunction() + + ucrPnlClimograph.AddRadioButton(rdoClimograph) + ucrPnlClimograph.AddRadioButton(rdoWalterLieth) + ucrPnlClimograph.AddParameterValuesCondition(rdoWalterLieth, "checked", "WalterLieth") + ucrPnlClimograph.AddParameterValuesCondition(rdoClimograph, "checked", "Climograph") + + ucrReceiverMonth.SetParameter(New RParameter("month", 1)) + ucrReceiverMonth.SetParameterIsString() + ucrReceiverMonth.Selector = ucrSelectorClimograph + ucrReceiverMonth.SetClimaticType("month") + ucrReceiverMonth.bAutoFill = True + ucrReceiverMonth.strSelectorHeading = "Month Variables" + ucrReceiverMonth.SetLinkedDisplayControl(lblMonth) + + ucrReceiverRain.SetParameter(New RParameter("p_mes", 3)) + ucrReceiverRain.SetParameterIsString() + ucrReceiverRain.Selector = ucrSelectorClimograph + ucrReceiverRain.SetClimaticType("rain") + ucrReceiverRain.bAutoFill = True + ucrReceiverRain.strSelectorHeading = "Rain Variables" + ucrReceiverRain.SetLinkedDisplayControl(lblRain) + + ucrReceiverMaxtem.SetParameter(New RParameter("tm_max", 4)) + ucrReceiverMaxtem.SetParameterIsString() + ucrReceiverMaxtem.Selector = ucrSelectorClimograph + ucrReceiverMaxtem.SetClimaticType("temp_max") + ucrReceiverMaxtem.bAutoFill = True + ucrReceiverMaxtem.strSelectorHeading = "Variables" + ucrReceiverMaxtem.SetLinkedDisplayControl(lblMaxtem) + + ucrReceiverMintemp.SetParameter(New RParameter("tm_min", 5)) + ucrReceiverMintemp.SetParameterIsString() + ucrReceiverMintemp.Selector = ucrSelectorClimograph + ucrReceiverMintemp.SetClimaticType("temp_min") + ucrReceiverMintemp.bAutoFill = True + ucrReceiverMintemp.strSelectorHeading = "Variables" + ucrReceiverMintemp.SetLinkedDisplayControl(lblMintem) + + ucr1stFactorReceiver.SetParameter(New RParameter("station")) + ucr1stFactorReceiver.Selector = ucrSelectorClimograph + ucr1stFactorReceiver.SetIncludedDataTypes({"factor"}) + ucr1stFactorReceiver.strSelectorHeading = "Factors" + ucr1stFactorReceiver.bWithQuotes = False + ucr1stFactorReceiver.SetParameterIsString() + ucr1stFactorReceiver.SetValuesToIgnore({"."}) + + ucrInputStation.SetItems({strFacetWrap, strFacetRow, strFacetCol, strNone}) + ucrInputStation.SetDropDownStyleAsNonEditable() + + ucrReceiverAbsolute.SetParameter(New RParameter("ta_min", 6)) + ucrReceiverAbsolute.SetParameterIsString() + ucrReceiverAbsolute.Selector = ucrSelectorClimograph + ucrReceiverAbsolute.strSelectorHeading = "Variables" + ucrReceiverAbsolute.SetLinkedDisplayControl(lblAbsolute) + + ucrSave.SetPrefix("wl_graph") + ucrSave.SetIsComboBox() + ucrSave.SetSaveTypeAsGraph() + ucrSave.SetCheckBoxText("Save") + ucrSave.SetDataFrameSelector(ucrSelectorClimograph.ucrAvailableDataFrames) + ucrSave.SetAssignToIfUncheckedValue("last_graph") + End Sub + + Private Sub SetDefaults() + clsGgwalterliethFunction = New RFunction + clsBaseOperator = New ROperator + clsDummyFunction = New RFunction + clsGroupByFunction = New RFunction + clsPipeOperator = New ROperator + + clsFacetFunction = New RFunction + clsFacetOperator = New ROperator + clsFacetRowOp = New ROperator + clsFacetColOp = New ROperator + + ucrSelectorClimograph.Reset() + ucrSave.Reset() + + ucrInputStation.SetName(strFacetWrap) + ucrInputStation.bUpdateRCodeFromControl = True + + ucrReceiverMonth.SetMeAsReceiver() + + clsDummyFunction.AddParameter("checked", "WalterLieth", iPosition:=0) + + clsPipeOperator.SetOperation("%>%") + SetPipeAssignTo() + + clsGgwalterliethFunction.SetRCommand("ggwalter_lieth") + + clsFacetFunction.SetPackageName("ggplot2") + clsFacetRowOp.SetOperation("+") + clsFacetRowOp.bBrackets = False + clsFacetColOp.SetOperation("+") + clsFacetColOp.bBrackets = False + clsFacetOperator.SetOperation("~") + clsFacetOperator.bForceIncludeOperation = True + clsFacetOperator.bBrackets = False + clsFacetFunction.AddParameter("facets", clsROperatorParameter:=clsFacetOperator, iPosition:=0) + + clsGroupByFunction.SetPackageName("dplyr") + clsGroupByFunction.SetRCommand("group_by") + + clsBaseOperator.SetOperation("+") + clsBaseOperator.AddParameter("ggwalter_lieth", clsRFunctionParameter:=clsGgwalterliethFunction, iPosition:=0) + + ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperator) + End Sub + + Private Sub SetRCodeForControls(bReset) + ucrSelectorClimograph.SetRCode(clsGgwalterliethFunction, bReset) + ucrPnlClimograph.SetRCode(clsDummyFunction, bReset) + ucrReceiverMonth.SetRCode(clsGgwalterliethFunction, bReset) + ucrReceiverRain.SetRCode(clsGgwalterliethFunction, bReset) + ucrReceiverMintemp.SetRCode(clsGgwalterliethFunction, bReset) + ucrReceiverMaxtem.SetRCode(clsGgwalterliethFunction, bReset) + ucrReceiverAbsolute.SetRCode(clsGgwalterliethFunction, bReset) + ucrSave.SetRCode(clsBaseOperator, bReset) + If bReset Then + AutoFacetStation() + End If + End Sub + + Private Sub TestOKEnabled() + If rdoWalterLieth.Checked AndAlso ((Not ucrReceiverAbsolute.IsEmpty AndAlso Not ucrReceiverMaxtem.IsEmpty AndAlso Not ucrReceiverMintemp.IsEmpty AndAlso Not ucrReceiverMonth.IsEmpty AndAlso Not ucrReceiverRain.IsEmpty) OrElse Not ucrSave.IsComplete) Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + End Sub + + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + SetDefaults() + SetRCodeForControls(True) + UpdateParameters() + TestOKEnabled() + End Sub + + Private Sub ucrInput_ControlValueChanged(ucrChangedControl As ucrInputComboBox) Handles ucrInputStation.ControlValueChanged + If Not bUpdateComboOptions Then + Exit Sub + End If + Dim strChangedText As String = ucrChangedControl.GetText() + If strChangedText <> strNone Then + If Not strChangedText = strFacetCol AndAlso Not strChangedText = strFacetRow AndAlso + Not ucrInputStation.Equals(ucrChangedControl) AndAlso ucrInputStation.GetText() = strChangedText Then + bUpdateComboOptions = False + ucrInputStation.SetName(strNone) + bUpdateComboOptions = True + End If + If (strChangedText = strFacetWrap AndAlso ucrInputStation.GetText = strFacetRow) OrElse (strChangedText = strFacetRow AndAlso + ucrInputStation.GetText = strFacetWrap) OrElse (strChangedText = strFacetWrap AndAlso + ucrInputStation.GetText = strFacetCol) OrElse (strChangedText = strFacetCol AndAlso ucrInputStation.GetText = strFacetWrap) Then + ucrInputStation.SetName(strNone) + End If + End If + UpdateParameters() + AddRemoveFacets() + AddRemoveGroupBy() + End Sub + + Private Sub UpdateParameters() + clsFacetOperator.RemoveParameterByName("wrap" & ucrInputStation.Name) + clsFacetColOp.RemoveParameterByName("col" & ucrInputStation.Name) + clsFacetRowOp.RemoveParameterByName("row" & ucrInputStation.Name) + + clsBaseOperator.RemoveParameterByName("facets") + bUpdatingParameters = True + ucr1stFactorReceiver.SetRCode(Nothing) + Select Case ucrInputStation.GetText() + Case strFacetWrap + ucr1stFactorReceiver.ChangeParameterName("wrap" & ucrInputStation.Name) + ucr1stFactorReceiver.SetRCode(clsFacetOperator) + Case strFacetCol + ucr1stFactorReceiver.ChangeParameterName("col" & ucrInputStation.Name) + ucr1stFactorReceiver.SetRCode(clsFacetColOp) + Case strFacetRow + ucr1stFactorReceiver.ChangeParameterName("row" & ucrInputStation.Name) + ucr1stFactorReceiver.SetRCode(clsFacetRowOp) + End Select + bUpdatingParameters = False + End Sub + + Private Sub AddRemoveFacets() + Dim bWrap As Boolean = False + Dim bCol As Boolean = False + Dim bRow As Boolean = False + + If bUpdatingParameters Then + Exit Sub + End If + + clsBaseOperator.RemoveParameterByName("facets") + If Not ucr1stFactorReceiver.IsEmpty Then + Select Case ucrInputStation.GetText() + Case strFacetWrap + bWrap = True + Case strFacetCol + bCol = True + Case strFacetRow + bRow = True + End Select + End If + + If bWrap OrElse bRow OrElse bCol Then + clsBaseOperator.AddParameter("facets", clsRFunctionParameter:=clsFacetFunction) + End If + If bWrap Then + clsFacetFunction.SetRCommand("facet_wrap") + End If + If bRow OrElse bCol Then + clsFacetFunction.SetRCommand("facet_grid") + End If + If bRow Then + clsFacetOperator.AddParameter("left", clsROperatorParameter:=clsFacetRowOp, iPosition:=0) + ElseIf bCol AndAlso Not bWrap Then + clsFacetOperator.AddParameter("left", ".", iPosition:=0) + Else + clsFacetOperator.RemoveParameterByName("left") + End If + If bCol Then + clsFacetOperator.AddParameter("right", clsROperatorParameter:=clsFacetColOp, iPosition:=1) + ElseIf bRow AndAlso Not bWrap Then + clsFacetOperator.AddParameter("right", ".", iPosition:=1) + Else + clsFacetOperator.RemoveParameterByName("right") + End If + End Sub + + Private Sub ucr1stFactorReceiver_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucr1stFactorReceiver.ControlValueChanged + If Not ucr1stFactorReceiver.IsEmpty Then + clsGgwalterliethFunction.AddParameter("station", Chr(34) & ucr1stFactorReceiver.GetVariableNames(False) & Chr(34), iPosition:=1) + Else + clsGgwalterliethFunction.RemoveParameterByName("station") + End If + AddRemoveFacets() + AddRemoveGroupBy() + End Sub + + Private Sub AutoFacetStation() + Dim ucrCurrentReceiver As ucrReceiver = ucrSelectorClimograph.CurrentReceiver + + If ucrCurrentReceiver IsNot Nothing Then + ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrSelectorClimograph.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) + ucrCurrentReceiver.SetMeAsReceiver() + AddRemoveGroupBy() + End If + End Sub + + Private Sub ucrSelectorClimograph_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorClimograph.ControlValueChanged + AutoFacetStation() + SetPipeAssignTo() + End Sub + + Private Sub GetParameterValue(clsOperator As ROperator) + Dim i As Integer = 0 + For Each clsTempParam As RParameter In clsOperator.clsParameters + If clsTempParam.strArgumentValue <> "" AndAlso clsTempParam.strArgumentValue <> "." Then + clsGroupByFunction.AddParameter(i, clsTempParam.strArgumentValue, bIncludeArgumentName:=False, iPosition:=i) + i = i + 1 + End If + Next + End Sub + + Private Sub AddRemoveGroupBy() + + If clsPipeOperator.ContainsParameter("mutate") Then + clsGroupByFunction.ClearParameters() + If clsBaseOperator.ContainsParameter("facets") Then + Select Case ucrInputStation.GetText() + Case strFacetWrap + GetParameterValue(clsFacetOperator) + Case strFacetCol + GetParameterValue(clsFacetColOp) + Case strFacetRow + GetParameterValue(clsFacetRowOp) + End Select + End If + + If clsGroupByFunction.iParameterCount > 0 Then + clsPipeOperator.AddParameter("group_by", clsRFunctionParameter:=clsGroupByFunction, iPosition:=1) + Else + clsPipeOperator.RemoveParameterByName("group_by") + End If + Else + clsPipeOperator.RemoveParameterByName("group_by") + End If + + SetPipeAssignTo() + End Sub + + Private Sub SetPipeAssignTo() + If ucrSelectorClimograph.ucrAvailableDataFrames.cboAvailableDataFrames.Text <> "" AndAlso clsPipeOperator.clsParameters.Count > 1 Then + clsPipeOperator.SetAssignTo(ucrSelectorClimograph.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + Else + clsPipeOperator.RemoveAssignTo() + End If + End Sub + + Private Sub AllControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlClimograph.ControlContentsChanged, ucrReceiverRain.ControlContentsChanged, ucrReceiverAbsolute.ControlContentsChanged, ucrReceiverMonth.ControlContentsChanged, ucrReceiverMaxtem.ControlContentsChanged, ucrReceiverMintemp.ControlContentsChanged, ucrSave.ControlContentsChanged + TestOKEnabled() + End Sub End Class \ No newline at end of file diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index 123b0175b38..863f5e4816f 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -2193,7 +2193,6 @@ Partial Class frmMain ' 'mnuClimaticDescribeClimograph ' - Me.mnuClimaticDescribeClimograph.Enabled = False Me.mnuClimaticDescribeClimograph.Name = "mnuClimaticDescribeClimograph" Me.mnuClimaticDescribeClimograph.Size = New System.Drawing.Size(211, 22) Me.mnuClimaticDescribeClimograph.Text = "Climograph..." @@ -5120,9 +5119,7 @@ Partial Class frmMain Me.IsMdiContainer = True Me.MainMenuStrip = Me.mnuBar Me.Name = "frmMain" - Me.Text = "R-Instat " + My.Application.Info.Version.Major.ToString + "." + - My.Application.Info.Version.Minor.ToString + "." + - My.Application.Info.Version.Build.ToString + Me.Text = "R-Instat .." Me.WindowState = System.Windows.Forms.FormWindowState.Maximized Me.stsStrip.ResumeLayout(False) Me.stsStrip.PerformLayout() From 9427bdf27f4c25e861460c86c4226e90a8225fc0 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Thu, 28 Mar 2024 10:27:45 +0100 Subject: [PATCH 60/88] Change made --- .../InstatObject/R/stand_alone_functions.R | 392 +++++++++++++----- 1 file changed, 285 insertions(+), 107 deletions(-) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index 904794d2d2c..d69af86edbb 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2,7 +2,6 @@ get_default_significant_figures <- function(data) { if(is.numeric(data)) return(3) else return(NA) } - convert_to_character_matrix <- function(data, format_decimal_places = TRUE, decimal_places, is_scientific = FALSE, return_data_frame = TRUE, na_display = NULL, check.names = TRUE) { if(nrow(data) == 0) { out <- matrix(nrow = 0, ncol = ncol(data)) @@ -40,7 +39,6 @@ convert_to_character_matrix <- function(data, format_decimal_places = TRUE, deci if(return_data_frame) out <- data.frame(out, stringsAsFactors = FALSE, check.names = check.names) return(out) } - next_default_item = function(prefix, existing_names = c(), include_index = FALSE, start_index = 1) { if(!is.character(prefix)) stop("prefix must be of type character") @@ -59,7 +57,6 @@ next_default_item = function(prefix, existing_names = c(), include_index = FALSE } return(out) } - import_from_ODK = function(username, form_name, platform) { if(platform == "kobo") { url <- "https://kc.kobotoolbox.org/api/v1/data" @@ -97,7 +94,6 @@ import_from_ODK = function(username, form_name, platform) { out <- jsonlite::fromJSON(form_data, flatten = TRUE) return(out) } - get_odk_form_names = function(username, platform) { #TODO This should not be repeated if(platform == "kobo") { @@ -122,7 +118,6 @@ get_odk_form_names = function(username, platform) { form_names <- sapply(forms, function(x) x$title) return(form_names) } - convert_SST <- function(datafile, data_from = 5){ start_year <- get_years_from_data(datafile)[1] end_year <- get_years_from_data(datafile)[length(get_years_from_data(datafile))] @@ -152,19 +147,15 @@ convert_SST <- function(datafile, data_from = 5){ my_data = cbind(period, lat_lon_df, SST_value) return(list(my_data, lat_lon_df)) } - get_years_from_data <- function(datafile){ return(na.omit(t(unique(datafile[3,2:ncol(datafile)])))) } - get_lat_from_data <- function(datafile){ return(unique(na.omit(as.numeric(as.character(datafile[5:nrow(datafile),1]))))) } - get_lon_from_data <- function(datafile){ return(na.omit(as.numeric(unique(t(datafile[5,2:ncol(datafile)]))))) } - lat_lon_dataframe <- function(datafile){ latitude <- get_lat_from_data(datafile) longitude <- get_lon_from_data(datafile) @@ -182,7 +173,6 @@ lat_lon_dataframe <- function(datafile){ } return(cbind(lat_lon,station)) } - output_CPT <- function(data, lat_lon_data, station_latlondata, latitude, longitude, station, year, element, long.data = TRUE, na_code = -999) { if(missing(data)) stop("data should be provided") @@ -256,24 +246,20 @@ output_CPT <- function(data, lat_lon_data, station_latlondata, latitude, longitu cpt_data <- rbind(t_lat_lon_data, unstacked_data) return(cpt_data) } - yday_366 <- function(date) { temp_doy <- lubridate::yday(date) temp_leap <- lubridate::leap_year(date) temp_doy[(!is.na(temp_doy)) & temp_doy > 59 & (!temp_leap)] <- 1 + temp_doy[(!is.na(temp_doy)) & temp_doy > 59 & (!temp_leap)] return(temp_doy) } - dekade <- function(date) { temp_dekade <- 3 * (lubridate::month(date)) - 2 + (lubridate::mday(date) > 10) + (lubridate::mday(date) > 20) return(temp_dekade) } - pentad <- function(date){ temp_pentad <- 6*(lubridate::month(date)) - 5 + (lubridate::mday(date) > 5) + (lubridate::mday(date) > 10) + (lubridate::mday(date) > 15) + (lubridate::mday(date) > 20) + (lubridate::mday(date) > 25) return(temp_pentad) } - nc_get_dim_min_max <- function(nc, dimension, time_as_date = TRUE) { if(!dimension %in% names(nc$dim)) stop(dimension, " not found in file.") vals <- nc$dim[[dimension]]$vals @@ -299,7 +285,6 @@ nc_get_dim_min_max <- function(nc, dimension, time_as_date = TRUE) { bounds <- c(min(vals, na.rm = TRUE), max(vals, na.rm = TRUE)) return(bounds) } - nc_as_data_frame <- function(nc, vars, keep_raw_time = TRUE, include_metadata = TRUE, boundary = NULL, lon_points = NULL, lat_points = NULL, id_points = NULL, show_requested_points = TRUE, great_circle_dist = TRUE) { if(missing(vars)) vars <- ncdf4.helpers::nc.get.variable.list(nc) if(sum(is.null(lon_points), is.null(lat_points)) == 1) stop("You must specificy both lon_points and lat_points") @@ -418,7 +403,6 @@ nc_as_data_frame <- function(nc, vars, keep_raw_time = TRUE, include_metadata = count_list[[1]] <- count dim_values_list[[1]] <- dim_values } - dim_axes <- ncdf4.helpers::nc.get.dim.axes(nc) time_dims <- names(dim_axes[which(dim_axes == "T" & names(dim_axes) %in% dim_names)]) var_data_list <- list() @@ -533,7 +517,6 @@ nc_as_data_frame <- function(nc, vars, keep_raw_time = TRUE, include_metadata = } return(var_data) } - # open_NetCDF <- function(nc_data, latitude_col_name, longitude_col_name, default_names){ # variables = names(nc_data$var) # lat_lon_names = names(nc_data$dim) @@ -613,7 +596,6 @@ nc_as_data_frame <- function(nc, vars, keep_raw_time = TRUE, include_metadata = # } # return(list(my_data, lat_lon_df, new_lat_lon_column_names)) # } - multiple_nc_as_data_frame <- function(path, vars, keep_raw_time = TRUE, include_metadata = TRUE, boundary = NULL, lon_points = NULL, lat_points = NULL, id_points = NULL, show_requested_points = TRUE, great_circle_dist = TRUE, id = "id") { filepaths <- list.files(path = path, pattern="*\\.nc", full.names = TRUE) filenames <- basename(filepaths) @@ -635,7 +617,6 @@ multiple_nc_as_data_frame <- function(path, vars, keep_raw_time = TRUE, include_ merged_data <- dplyr::bind_rows(nc_list, .id = id) return(merged_data) } - import_from_iri <- function(download_from, data_file, path, X1, X2,Y1,Y2, get_area_point){ if(path == ""){ gaugelocdir = getwd() @@ -795,46 +776,38 @@ import_from_iri <- function(download_from, data_file, path, X1, X2,Y1,Y2, get_ar file.remove(paste(gaugelocdir,"tmp_iri.csv",sep="/")) return(list(dataout,lat_lon_dataframe)) } - is.logical.like <- function(x) { if(is.logical(x)) return(TRUE) else if(is.numeric(x)) return(all(na.omit(x) %in% c(1,0))) else return(FALSE) } - is.binary <- function(x) { if(is.logical(x)) return(TRUE) else if(is.numeric(x)) return(all(na.omit(x) %in% c(1,0))) else if(is.factor(x)) return(nlevels(x) == 2) else return(FALSE) } - get_column_attributes <- function(x, drop = c("class", "levels")) { tmp_attr <- attributes(x) tmp_attr <- tmp_attr[!names(tmp_attr) %in% drop] return(tmp_attr) } - split_items_in_groups <- function(items, num) { if(length(items) %% num != 0) stop("The number of items must be divisible by the number of groups") x <- split(items, rep(1:num, each = length(items)/num)) return(x) } - cancor_coef <- function(object) { object[c("xcoef", "ycoef")] } ################### - # cmsaf Plot.Region script - # # This script displays a map of the selected product. # You can either specify a certain year / month from a data file with several time steps # or plot one 2D field. # Prepare the your netcdf-files with the R-script "Prep.Data.R" or "Apply.Function.R" ########################################################################################## - plot.region <- function(lon, lat, product, time, time_point = as.Date("2002-01-01"), add2title = "CM SAF, ", lonmin = NA, lonmax = NA, latmin = NA, latmax = NA, height = 600, width = 600, plot.ano = FALSE, set.col.breaks = FALSE, brk.set = seq(240,310,5), colmin0 = NA, colmax0 = NA, ncol = 14, plotHighRes = FALSE, plotCoastline = TRUE, plotCountries = TRUE, plotRivers = FALSE, contour.thick = 2, plotCities = TRUE, pch.cities = 2, cex.cities = 1, label.cities = TRUE, plotCapitals = 1, cex.label.cities = 0.5, dlat = 0.25, plotOwnLocations = FALSE, loc_lon = c(), loc_lat = c(), loc_name = c(""), label_pos = 1, variable = "Tm", level = 5, CTY.type = 4) { # Set the variable name @@ -913,7 +886,6 @@ plot.region <- function(lon, lat, product, time, time_point = as.Date("2002-01-0 if (varname == "CTY") datalev <- CTY.type #--------------------------------------------------# - # Invert the latitude dimension if necessary if (lat[ny] < lat[1]) { sort.out <- sort(lat,index.return=TRUE) @@ -1062,7 +1034,6 @@ plot.region <- function(lon, lat, product, time, time_point = as.Date("2002-01-0 axis(3,lwd=1,at=c(lonmin,lonmax),tick=TRUE,lwd.ticks=0,labels=FALSE) axis(4,lwd=1,at=c(latmin,latmax), tick=TRUE,lwd.ticks=0,labels=FALSE) } - duplicated_cases <- function(col_name, ignore = NULL, tolerance=0.01) { col_name <- as.vector(col_name) col_data1 <- c(1, rep(NA, length(col_name) - 1)) @@ -1089,7 +1060,6 @@ duplicated_cases <- function(col_name, ignore = NULL, tolerance=0.01) { } return(col_data1) } - #This is Sam function from issue #4270 duplicated_count_index<-function(x, type = "count"){ if(type == "count"){ @@ -1122,21 +1092,17 @@ duplicated_count_index<-function(x, type = "count"){ return(x$count) } } - - get_installed_packages_with_data <- function(with_data = TRUE) { all_installed_packages <- .packages(all.available = TRUE) if (with_data) all_installed_packages <- unique(data(package = all_installed_packages)[["results"]][,1]) return(all_installed_packages) } - drop_unused_levels <- function(dat, columns) { for(i in seq_along(columns)) { if(is.factor(dat[[columns[i]]])) dat[[columns[i]]] <- droplevels(dat[[columns[i]]]) } return(dat) } - compare_columns <- function(x, y, use_unique = TRUE, sort_values = TRUE, firstnotsecond = TRUE, secondnotfirst = TRUE, display_intersection = FALSE, display_union = FALSE, display_values = TRUE) { x_name <- deparse(substitute(x)) y_name <- deparse(substitute(y)) @@ -1177,8 +1143,6 @@ compare_columns <- function(x, y, use_unique = TRUE, sort_values = TRUE, firstno if(display_union) cat(paste0("Union (Values that appear in either column): ", paste0("'", dplyr::union(x, y), "'", collapse = ", "))) } } - - consecutive_sum <- function(x, initial_value = NA){ out = x for(i in 1:length(x)){ @@ -1194,11 +1158,9 @@ consecutive_sum <- function(x, initial_value = NA){ } return(out) } - max_consecutive_sum <- function(x){ max(consecutive_sum(x, initial_value = 0)) } - hashed_id <- function(x, salt, algo = "crc32") { if (missing(salt)){ y <- x @@ -1207,9 +1169,7 @@ hashed_id <- function(x, salt, algo = "crc32") { } y <- sapply(y, function(X) digest::digest(X, algo = algo)) as.character(y) - } - # Possible alternative but is slower: # spells <- function(z) { # Reduce(function(x,y) {y = dplyr::if_else(y == 0, 0, x + 1)}, z[-1], @@ -1227,7 +1187,6 @@ hashed_id <- function(x, salt, algo = "crc32") { } return(y) } - convert_to_dec_deg <- function (dd, mm = 0 , ss = 0, dir) { if(missing(dd)) stop("dd must be supplied") if(!missing(dir)) { @@ -1241,17 +1200,14 @@ convert_to_dec_deg <- function (dd, mm = 0 , ss = 0, dir) { decdeg <- (dd + ((mm * 60) + ss)/3600) * sgn return(decdeg) } - convert_yy_to_yyyy <- function (x, base) { if(missing(base)) stop("base year must be supplied") dplyr::if_else(x+2000 <= base, x+2000, x+1900) } - create_av_packs <- function() { av_packs <<- available.packages(repos = "https://cran.rstudio.com/") av_packs <<- data.frame(av_packs) } - package_check <- function(package) { out <- c() if (!pingr::is_online()) out[[1]] <- "5" @@ -1294,13 +1250,11 @@ in_top_n <- function(x, n = 10, wt, fun = sum) { else dat <- dat %>% dplyr::count(x, sort = TRUE, name = "fq") return(x %in% dat$x[1:n]) } - summary_sample <- function(x, size, replace = FALSE){ if(length(x)==0){return(NA)} else if(length(x)==1){return(x)} else{sample(x = x, size = size, replace = replace)} } - add_xy_area_range <- function(path, min_lon, max_lon, min_lat, max_lat, dim_x = "X", dim_y = "Y") { paste0( path, "/", dim_x, "/", @@ -1313,7 +1267,6 @@ add_xy_area_range <- function(path, min_lon, max_lon, min_lat, max_lat, dim_x = "RANGEEDGES", "/" ) } - add_xy_point_range <- function(path, min_lon, min_lat, dim_x = "X", dim_y = "Y") { paste0( path, "/", dim_x, "/", @@ -1324,7 +1277,6 @@ add_xy_point_range <- function(path, min_lon, min_lat, dim_x = "X", dim_y = "Y") "VALUES", "/" ) } - add_t_range <- function(path, min_date, max_date, dim_t = "T") { paste0( path, dim_t, "/", @@ -1335,7 +1287,6 @@ add_t_range <- function(path, min_date, max_date, dim_t = "T") { "RANGEEDGES", "/" ) } - add_nc <- function(path) { paste0(path, "data.nc") } @@ -1347,8 +1298,6 @@ fourier_series <- function(x, n, period) { "cos(", x, " * ", h, " * ", p2, " / ", period, ")", collapse = " + ") } - - climatic_missing <- function(data, date, elements = ..., stations, start = TRUE, end = FALSE){ @@ -1368,7 +1317,6 @@ climatic_missing <- function(data, date, elements = ..., stations, values_to = "value") # sort start/end times - # set start date if (start){ data.stack <- data.stack %>% @@ -1418,10 +1366,8 @@ climatic_missing <- function(data, date, elements = ..., stations, if (missing(stations)){ summary.data$stations <- NULL } - return(summary.data) } - climatic_details <- function(data, date, elements = ..., stations, @@ -1490,7 +1436,6 @@ climatic_details <- function(data, date, elements = ..., stations, From = dplyr::first({{ date }}), To = dplyr::last({{ date }})) %>% dplyr::mutate(is.complete = ifelse(no == na, 1, 0)) # 0 if all are missing - detail.table.month <- detail.table.month %>% dplyr::group_by({{ stations }}, Element) %>% dplyr::mutate(element.na = data.table::rleid(is.complete)) %>% @@ -1548,15 +1493,11 @@ climatic_details <- function(data, date, elements = ..., stations, dplyr::mutate(Level = make_factor(Level)) return(detail.table.all) - } - slope <- function(y, x) { x <- as.numeric(x) lm(y ~ x)$coefficients[2] - } - # make_factor is intended to be somewhat equivalent to forcats::as_factor() or base::as.factor(). # It provides default behaviour for converting to factor depending on the data type, similar to forcats::as_factor(). # For "character" and "numeric" types make_factor is consistent with forcats::as_factor() in terms of the order of the factor levels. @@ -1583,9 +1524,6 @@ make_factor <- function(x, ordered = is.ordered(x)) { factor(x, levels = as.character(unique(x)), ordered = ordered) } } - - - # wwr_export function is meant to reshape data into formats required by WMO for submission of climatic data # this gives Yearly data records with monthly and annual data for a particular year: wwr_export <- function(data, year, month, mean_station_pressure, mean_sea_level_pressure, @@ -1851,7 +1789,6 @@ wwr_export <- function(data, year, month, mean_station_pressure, mean_sea_level_ } cat(i, "file(s) created at:", folder) } - dd_to_dms <- function(x, lat) { if (lat) dir <- ifelse(x >= 0, "N", "S") else dir <- ifelse(x >= 0, "E", "W") @@ -1861,7 +1798,6 @@ dd_to_dms <- function(x, lat) { s <- round((x - d - m/60) * 3600) return(paste(sprintf(ifelse(lat, "%02d", "%03d"), d), sprintf("%02d", m), sprintf("%02d", s), dir)) } - plot_mrl <- function(data, station_name, element_name, umin, umax, ncol = 1, xlab = "Threshold", ylab = "Mean excess", fill = "red", col = "black", rug = TRUE, addNexcesses = TRUE, textsize = 4) { @@ -1899,13 +1835,10 @@ plot_mrl <- function(data, station_name, element_name, umin, umax, ncol = 1, ) } } - - ### Constants month_abb_english <- c("Jan","Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec") month_name_english <- c("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") - # factored out code for a multiple indices for a single station. # Called by climdex(). # Not intended to be used externally. @@ -1963,7 +1896,6 @@ climdex_single_station <- function(ci, freq = "annual", indices, year, month, } return(df_ind) } - climdex <- function(data, station, date, year, month, prec, tmax, tmin, indices, freq = "annual", base.range = c(1961, 1990), n = 5, northern.hemisphere = TRUE, quantiles = NULL, temp.qtiles = c(0.1, 0.9), @@ -2053,7 +1985,6 @@ climdex <- function(data, station, date, year, month, prec, tmax, tmin, indices, } return(df_out) } - spei_input <- function(data, station, year, month, element) { if (missing(station)) id_cols <- c(year, month) else id_cols <- c(station, year, month) # SPEI package assumes data is ordered so must be sorted @@ -2093,7 +2024,6 @@ spei_input <- function(data, station, year, month, element) { } ts_data } - # This function extracts the SPEI/SPI column from an spei object x. # It requires the original data in order to return a vector of the correct length by removing NA values introduced when unstacking. # An alternative to this is to have a single wrapper SPEI/SPI function to handle this. @@ -2127,9 +2057,7 @@ spei_output <- function(x, data, station, year, month) { col <- as.vector(vals) } col - } - # This function has been adapted from extRemes::threshrange.plot(). # It has been adapted for use in R-Instat and uses ggplot2 graphical system rather than base plot(). threshold_Plot <- function(x, r, type = c("GP", "PP", "Exponential"), nint = 10, @@ -2244,7 +2172,6 @@ threshold_Plot <- function(x, r, type = c("GP", "PP", "Exponential"), nint = 10, } patchwork::wrap_plots(lst_plots, ncol = 1) } - # This function produces multiple threshold plots for various stations at a time. plot_multiple_threshold <- function(data, station_col_name, element_col_name, r, type = c("GP", "PP", "Exponential"), nint = 10, alpha = 0.05, ncol = 1, xlb = "", main = NULL , verbose = FALSE,...) { @@ -2264,8 +2191,6 @@ plot_multiple_threshold <- function(data, station_col_name, element_col_name, r, threshold_Plot(x = element_col, r = r, type = type, nint = nint, alpha = alpha, verbose = verbose) } } - - plot_declustered <- function(data, station_col_name, element_col_name, threshold, r = NULL, xlab = NULL, ylab = NULL, ncol = 1, print_summary = FALSE) { if (!missing(station_col_name)) { plts <- list() @@ -2301,7 +2226,6 @@ plot_declustered <- function(data, station_col_name, element_col_name, threshold } } } - #This function creates a wrapper around functions from openair package other_rose_plots <- function(data, type1_col_name, type2_col_name, date_col_name, wd_col_name, ws_col_name, main_method, single_pollutant, multiple_pollutant, ...) { type <- "default" @@ -2336,7 +2260,6 @@ other_rose_plots <- function(data, type1_col_name, type2_col_name, date_col_name openair::polarFreq(mydata = data, type = type, pollutant = single_pollutant, ...) } } - #This function creates a wrapper around windRose and pollutionRose functions from openair package wind_pollution_rose <- function(mydata, date_name, pollutant, type1_col_name, type2_col_name, ...) { type <- "default" @@ -2358,12 +2281,10 @@ wind_pollution_rose <- function(mydata, date_name, pollutant, type1_col_name, ty openair::pollutionRose(mydata = mydata, type = type, pollutant, ...) } } - n_non_numeric <- function(x) { x <- as.character(x) sum(is.na(x) != is.na(suppressWarnings(as.numeric(x)))) } - # This function creates a wrapper around grDevices::recordPlot() to enable non-ggplot graphs to be saved as recorded_plot objects. # It also handles graphics devices carefully. record_graph <- function(x) { @@ -2395,8 +2316,6 @@ slopegraph_theme <- function(x_text_size = 12){ ggplot2::theme(axis.text.x.top = ggplot2::element_text(size = x_text_size, face = "bold")), ggplot2::theme(axis.ticks = ggplot2::element_blank())) } - - # slightly amended the "newggslopegraph" function in the CGPfunctions package slopegraph <- function(data, x, y, colour, data_label = NULL, y_text_size = 3, @@ -2523,7 +2442,6 @@ slopegraph <- function(data, x, y, colour, data_label = NULL, ggplot2::geom_label(ggplot2::aes_string(label = Ndata_label), size = data_text_size, label.padding = unit(data_label_padding, "lines"), label.size = data_label_line_size, colour = data_text_colour, fill = data_label_fill_colour) } - # Returns a three-letter string representing a specific quarter in a year (e.g. "JFM", "AMJ" etc.). get_quarter_label <- function(quarter, start_month){ if (!start_month %in% 1:12) stop(start_month, " is an invalid start month, must be in range of 1:12") @@ -2533,27 +2451,21 @@ get_quarter_label <- function(quarter, start_month){ paste(mabb[start_pos:(start_pos+2)], collapse = "")}) return(factor(x = qtr, levels = unique(qtr))) } - is.containVariableLabel <- function(x){ return(isTRUE(sjlabelled::get_label(x) != "")) } - is.emptyvariable <- function(x){ return(isTRUE(length(x) == sum(x == ""))) } - is.NAvariable <- function(x){ return(isTRUE(length(x) == sum(is.na(x)))) } - is.levelscount <- function(x, n){ return(isTRUE(sum(levels(x)) == n)) } - is.containValueLabel <- function(x){ return(labels_label %in% names(attributes(x))) } - is.containPartialValueLabel <- function(x) { if(is.containValueLabel(x)) { levelCounts <- table(x) @@ -2562,7 +2474,6 @@ is.containPartialValueLabel <- function(x) { } else{return(FALSE)} } - read_corpora <- function(data){ data_all <- NULL description <- NULL @@ -2611,8 +2522,6 @@ read_corpora <- function(data){ } return (data.frame(data_all)) } - - # Bind two data frames # and remove any duplicates from data frame x that are in data frame y # x = our data to remove duplicates from @@ -2622,7 +2531,6 @@ cbind_unique <- function(x, y, cols){ x <- x %>% dplyr::select(c(setdiff(names(x), cols))) x <- dplyr::bind_cols(x = x, y = dplyr::select(y, tidyselect::all_of(cols))) } - #object is the object to be displayed #object_format is the display format. If supplied, then returns file name of the object #if not then it prints the object @@ -2639,7 +2547,6 @@ view_object_data <- function(object, object_format = NULL) { } return(file_name) } - view_object <- function(data_book_object) { return( view_object_data( @@ -2648,7 +2555,6 @@ view_object <- function(data_book_object) { ) ) } - #displays the graph object in the set R "viewer". #if the viewer is not available then #it saves the object as a file in the temporary folder @@ -2683,7 +2589,6 @@ view_graph_object <- function(graph_object){ print(graph_object) } dev.off() #todo. use graphics.off() which one is better? - #todo. should we use respective package "convenience" functions to save the objects as image files depending on the class names? #investigate if it will help with resolution and scaling? @@ -2698,7 +2603,6 @@ view_graph_object <- function(graph_object){ return(file_name) } - #displays the object in the set R "viewer". #if the viewer is not available then #it saves the object as a file in the temporary folder @@ -2729,7 +2633,6 @@ view_text_object <- function(text_object){ return(file_name) } - #displays the html object in the set R "viewer". #if the viewer is not available then #it saves the object as a file in the temporary folder @@ -2774,7 +2677,6 @@ view_html_object <- function(html_object){ message("R viewer not detected. File saved in location ", file_name) return(file_name) } - #tries to recordPlot if graph_object = NULL, then returns graph object of class "recordedplot". #applicable to base graphs only check_graph <- function(graph_object){ @@ -2804,8 +2706,6 @@ check_graph <- function(graph_object){ return(out) } - - get_data_book_output_object_names <- function(output_object_list, object_type_label = NULL, excluded_items = c(), @@ -2849,7 +2749,6 @@ get_data_book_output_object_names <- function(output_object_list, } } - get_vignette <- function (package = NULL, lib.loc = NULL, all = TRUE) { oneLink <- function(s) { @@ -2909,7 +2808,6 @@ get_vignette <- function (package = NULL, lib.loc = NULL, all = TRUE) port, basename(file)))} else return(sprintf("file://%s", file)) } - # for issue 8342 - adding in a count of the number of elements that have missing values by period (and station) cumulative_inventory <- function(data, station = NULL, from, to){ if (is.null(station)){ @@ -2939,7 +2837,6 @@ cumulative_inventory <- function(data, station = NULL, from, to){ } return(data) } - getRowHeadersWithText <- function(data, column, searchText, ignore_case, use_regex) { if(use_regex){ # Find the rows that match the search text using regex @@ -2955,7 +2852,6 @@ getRowHeadersWithText <- function(data, column, searchText, ignore_case, use_reg # Return the row headers return(rowHeaders) } - # Custom function to convert character to list of numeric vector convert_to_list <- function(x) { if (grepl("^c\\(", x)) { @@ -2968,7 +2864,6 @@ convert_to_list <- function(x) { return(as.numeric(x)) } } - getExample <- function (topic, package = NULL, lib.loc = NULL, character.only = TRUE, give.lines = FALSE, local = FALSE, echo = TRUE, verbose = getOption("verbose"), setRNG = FALSE, ask = getOption("example.ask"), prompt.prefix = abbreviate(topic, 6), run.dontrun = FALSE, run.donttest = interactive()) { if (!character.only) { topic <- substitute(topic) @@ -3008,7 +2903,6 @@ getExample <- function (topic, package = NULL, lib.loc = NULL, character.only = } return(example_text) } - WB_evaporation <- function(water_balance, frac, capacity, evaporation_value, rain){ if (water_balance >= frac*capacity){ evaporation <- evaporation_value @@ -3030,7 +2924,6 @@ WB_evaporation <- function(water_balance, frac, capacity, evaporation_value, rai } return(evaporation) } - write_weather_data <- function(year, month, day, rain, mn_tmp, mx_tmp, missing_code, output_file) { # Create a data frame with the provided inputs weather_data <- data.frame(year = year, @@ -3047,4 +2940,289 @@ write_weather_data <- function(year, month, day, rain, mn_tmp, mx_tmp, missing_c write.table(weather_data, file = output_file, sep = "\t", row.names = FALSE, col.names = TRUE, quote = FALSE) cat("Weather data has been written to", output_file, "\n") +} +prepare_walter_lieth <- function(data, month, tm_min, ta_min){ + dat_long_int <- NULL + for (j in seq(nrow(data) - 1)) { + intres <- NULL + for (i in seq_len(ncol(data))) { + if (is.character(data[j, i]) | is.factor(data[j, i])) { + val <- as.data.frame(data[j, i]) + } + else { + interpol <- approx(x = data[c(j, j + 1), "indrow"], + y = data[c(j, j + 1), i], + n = 50) + val <- as.data.frame(interpol$y) + } + names(val) <- names(data)[i] + intres <- dplyr::bind_cols(intres, val) + } + dat_long_int <- dplyr::bind_rows(dat_long_int, intres) + } + dat_long_int$interpolate <- TRUE + dat_long_int[[month]] <- "" + data$interpolate <- FALSE + dat_long_int <- dat_long_int[!dat_long_int$indrow %in% data$indrow, ] + dat_long_end <- dplyr::bind_rows(data, dat_long_int) + dat_long_end <- dat_long_end[order(dat_long_end$indrow), ] + dat_long_end <- dat_long_end[dat_long_end$indrow >= 0 & dat_long_end$indrow <= 12, ] + dat_long_end <- tibble::as_tibble(dat_long_end) + + getpolymax <- function(x, y, y_lim) { + initpoly <- FALSE + yres <- NULL + xres <- NULL + for (i in seq_len(length(y))) { + lastobs <- i == length(x) + if (y[i] > y_lim[i]) { + if (isFALSE(initpoly)) { + xres <- c(xres, x[i]) + yres <- c(yres, y_lim[i]) + initpoly <- TRUE + } + xres <- c(xres, x[i]) + yres <- c(yres, y[i]) + if (lastobs) { + xres <- c(xres, x[i], NA) + yres <- c(yres, y_lim[i], NA) + } + } + else { + if (initpoly) { + xres <- c(xres, x[i - 1], NA) + yres <- c(yres, y_lim[i - 1], NA) + initpoly <- FALSE + } + } + } + poly <- tibble::tibble(x = xres, y = yres) + return(poly) + } + getlines <- function(x, y, y_lim) { + yres <- NULL + xres <- NULL + ylim_res <- NULL + for (i in seq_len(length(y))) { + if (y[i] > y_lim[i]) { + xres <- c(xres, x[i]) + yres <- c(yres, y[i]) + ylim_res <- c(ylim_res, y_lim[i]) + } + } + line <- tibble::tibble(x = xres, y = yres, ylim_res = ylim_res) + return(line) + } + prep_max_poly <- getpolymax(x = dat_long_end$indrow, y = pmax(dat_long_end$pm_reesc, + 50), y_lim = rep(50, length(dat_long_end$indrow))) + tm_max_line <- getlines(x = dat_long_end$indrow, y = dat_long_end$tm, + y_lim = dat_long_end$pm_reesc) + pm_max_line <- getlines(x = dat_long_end$indrow, y = pmin(dat_long_end$pm_reesc, + 50), y_lim = dat_long_end$tm) + dat_real <- dat_long_end[dat_long_end$interpolate == FALSE, + c("indrow", ta_min)] + x <- NULL + y <- NULL + for (i in seq_len(nrow(dat_real))) { + if (dat_real[i, ][[ta_min]] < 0) { + x <- c(x, NA, rep(dat_real[i, ]$indrow - 0.5, 2), + rep(dat_real[i, ]$indrow + 0.5, 2), NA) + y <- c(y, NA, -3, 0, 0, -3, NA) + } + else { + x <- c(x, NA) + y <- c(y, NA) + } + } + probfreeze <- tibble::tibble(x = x, y = y) + rm(dat_real) + dat_real <- dat_long_end[dat_long_end$interpolate == FALSE, + c("indrow", tm_min)] + x <- NULL + y <- NULL + for (i in seq_len(nrow(dat_real))) { + if (dat_real[i, ][[tm_min]] < 0) { + x <- c(x, NA, rep(dat_real[i, ]$indrow - 0.5, 2), + rep(dat_real[i, ]$indrow + 0.5, 2), NA) + y <- c(y, NA, -3, 0, 0, -3, NA) + } + else { + x <- c(x, NA) + y <- c(y, NA) + } + } + surefreeze <- tibble::tibble(x = x, y = y) + return_list <- list(dat_long_end, + tm_max_line, + pm_max_line, + prep_max_poly, + probfreeze, + surefreeze) + names(return_list) <- c("dat_long_end", "tm_max_line", "pm_max_line", + "prep_max_poly", "prob_freeze", "surefreeze") + return(return_list) +} +ggwalter_lieth <- function (data, month, station = NULL, p_mes, tm_max, tm_min, ta_min, station_name = "", + alt = NA, per = NA, pcol = "#002F70", + tcol = "#ff0000", pfcol = "#9BAEE2", sfcol = "#3C6FC4", + shem = FALSE, p3line = FALSE, ...) + { + + # Preprocess data with vectorised operations + data <- data %>% + dplyr::mutate(tm = (.data[[tm_max]] + .data[[tm_min]]) / 2, + pm_reesc = dplyr::if_else(.data[[p_mes]] < 100, .data[[p_mes]] * 0.5, .data[[p_mes]] * 0.05 + 45), + p3line = .data[[p_mes]] / 3) %>% + dplyr::mutate(across(.data[[month]], ~ forcats::fct_expand(.data[[month]], ""))) %>% + dplyr::arrange(.data[[month]]) + # do this for each station, if we have a station + if (!is.null(station)){ + data <- data %>% group_by(!!sym(station)) + } + data <- data %>% + group_modify(~{ + # Add dummy rows at the beginning and end for each group + .x <- bind_rows(.x[nrow(.x), , drop = FALSE], .x, .x[1, , drop = FALSE]) + # Clear month value for the dummy rows + .x[c(1, nrow(.x)), which(names(.x) == data[[month]])] <- "" + # Add an index column for plotting or further transformations + .x <- cbind(indrow = seq(-0.5, 12.5, 1), .x) + .x + }) + + if (!is.null(station)){ + data <- data %>% ungroup() + } + data <- data.frame(data) + + # split by station + if (is.null(station)){ + data_list <- prepare_walter_lieth(data, month, tm_min, ta_min) + # data things + dat_long_end <- data_list$dat_long_end + tm_max_line <- data_list$tm_max_line + pm_max_line <- data_list$pm_max_line + prep_max_poly <- data_list$prep_max_poly + probfreeze <- data_list$prob_freeze + surefreeze <- data_list$surefreeze + } else { + results <- + map(.x = unique(data[[station]]), + .f = ~{filtered_data <- data %>% filter(!!sym(station) == .x) + prepare_walter_lieth(filtered_data, month, tm_min, ta_min)}) + # Function to bind rows for a specific sub-element across all main elements + n <- length(results) + m <- length(results[[1]]) + station_name <- unique(data[[station]]) + binds <- NULL + combined <- NULL + for (j in 1:m){ + for (i in 1:n) { # for each station data set + binds[[i]] <- results[[i]][[j]] %>% mutate(!!sym(station) := station_name[i]) + } + combined[[j]] <- do.call(rbind, binds) # Combine all the sub-elements row-wise + } + # data things + dat_long_end <- combined[[1]] + tm_max_line <- combined[[2]] + pm_max_line <- combined[[3]] + prep_max_poly <- combined[[4]] + probfreeze <- combined[[5]] + surefreeze <- combined[[6]] + } + + # data frame pretty things ------------------------------------------------------ + ticks <- data.frame(x = seq(0, 12), ymin = -3, ymax = 0) + title <- station_name + if (!is.na(alt)) { + title <- paste0(title, " (", prettyNum(alt, big.mark = ",", + decimal.mark = "."), " m)") + } + if (!is.na(per)) { + title <- paste0(title, "\n", per) + } + sub <- paste(round(mean(dat_long_end[dat_long_end$interpolate == FALSE, ]$tm), 1), + "C ", + prettyNum(round(sum(dat_long_end[dat_long_end$interpolate == FALSE, ][[p_mes]])), big.mark = ","), " mm", sep = "") + + maxtm <- prettyNum(round(max(dat_long_end[[tm_max]]), 1)) + mintm <- prettyNum(round(min(dat_long_end[[tm_min]]), 1)) + tags <- paste0(paste0(rep(" \n", 6), collapse = ""), maxtm, + paste0(rep(" \n", 10), collapse = ""), mintm) + month_breaks <- dat_long_end[dat_long_end[[month]] != "", ]$indrow + month_labs <- dat_long_end[dat_long_end[[month]] != "", ][[month]] + + ymax <- max(60, 10 * floor(max(dat_long_end$pm_reesc)/10) + 10) + ymin <- min(-3, min(dat_long_end$tm)) + range_tm <- seq(0, ymax, 10) + if (ymin < -3) { + ymin <- floor(ymin/10) * 10 + range_tm <- seq(ymin, ymax, 10) + } + templabs <- paste0(range_tm) + templabs[range_tm > 50] <- "" + range_prec <- range_tm * 2 + range_prec[range_tm > 50] <- range_tm[range_tm > 50] * 20 - 900 + preclabs <- paste0(range_prec) + preclabs[range_tm < 0] <- "" + + wandlplot <- ggplot2::ggplot() + ggplot2::geom_line(data = dat_long_end, + aes(x = .data$indrow, y = .data$pm_reesc), color = pcol) + + ggplot2::geom_line(data = dat_long_end, aes(x = .data$indrow, + y = .data$tm), color = tcol) + if (nrow(tm_max_line > 0)) { + wandlplot <- wandlplot + ggplot2::geom_segment(aes(x = .data$x, + y = .data$ylim_res, xend = .data$x, yend = .data$y), + data = tm_max_line, color = tcol, alpha = 0.2) + } + if (nrow(pm_max_line > 0)) { + wandlplot <- wandlplot + ggplot2::geom_segment(aes(x = .data$x, + y = .data$ylim_res, xend = .data$x, yend = .data$y), + data = pm_max_line, color = pcol, alpha = 0.2) + } + if (p3line) { + wandlplot <- wandlplot + ggplot2::geom_line(data = dat_long_end, + aes(x = .data$indrow, y = .data$p3line), color = pcol) + } + if (max(dat_long_end$pm_reesc) > 50) { + wandlplot <- wandlplot + ggplot2::geom_polygon(data = prep_max_poly, aes(x, y), + fill = pcol) + } + if (min(dat_long_end[[ta_min]]) < 0) { + wandlplot <- wandlplot + ggplot2::geom_polygon(data = probfreeze, aes(x = x, y = y), + fill = pfcol, colour = "black") + } + if (min(dat_long_end[[tm_min]]) < 0) { + wandlplot <- wandlplot + geom_polygon(data = surefreeze, aes(x = x, y = y), + fill = sfcol, colour = "black") + } + wandlplot <- wandlplot + geom_hline(yintercept = c(0, 50), + size = 0.5) + + geom_segment(data = ticks, aes(x = x, xend = x, y = ymin, yend = ymax)) + + scale_x_continuous(breaks = month_breaks, name = "", labels = month_labs, expand = c(0, 0)) + + scale_y_continuous("C", limits = c(ymin, ymax), labels = templabs, + breaks = range_tm, sec.axis = dup_axis(name = "mm", labels = preclabs)) + wandlplot <- wandlplot + + ggplot2::labs(title = title, subtitle = sub, tag = tags) + + ggplot2::theme_classic() + + ggplot2::theme(plot.title = element_text(lineheight = 1, size = 14, face = "bold"), + plot.subtitle = element_text(hjust = 1, vjust = 1, size = 14), + plot.tag = element_text(size = 10), + plot.tag.position = "left", axis.ticks.length.x.bottom = unit(0, "pt"), + axis.line.x.bottom = element_blank(), + axis.title.y.left = element_text(angle = 0, + vjust = 0.9, size = 10, colour = tcol, + margin = unit(rep(10, 4), "pt")), + axis.text.x.bottom = element_text(size = 10), + axis.text.y.left = element_text(colour = tcol, size = 10), + axis.title.y.right = element_text(angle = 0, vjust = 0.9, + size = 10, colour = pcol, + margin = unit(rep(10, 4), "pt")), + axis.text.y.right = element_text(colour = pcol, size = 10)) + + if (!is.null(station)){ + wandlplot <- wandlplot + facet_wrap(station) + } + + return(wandlplot) } \ No newline at end of file From 3d52f15b21eeaef7ab1167c651bd6a4e5c957153 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Thu, 28 Mar 2024 10:34:57 +0100 Subject: [PATCH 61/88] Change made --- instat/frmMain.Designer.vb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index 863f5e4816f..ecf06650717 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -5119,7 +5119,9 @@ Partial Class frmMain Me.IsMdiContainer = True Me.MainMenuStrip = Me.mnuBar Me.Name = "frmMain" - Me.Text = "R-Instat .." + Me.Text = "R-Instat " + My.Application.Info.Version.Major.ToString + "." + + My.Application.Info.Version.Minor.ToString + "." + + My.Application.Info.Version.Build.ToString Me.WindowState = System.Windows.Forms.FormWindowState.Maximized Me.stsStrip.ResumeLayout(False) Me.stsStrip.PerformLayout() From 9790eed3e0cac65989f4d00591881aceb22ec109 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Thu, 28 Mar 2024 10:49:49 +0100 Subject: [PATCH 62/88] Cchange made --- instat/dlgClimograph.vb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instat/dlgClimograph.vb b/instat/dlgClimograph.vb index 97d6da1aebd..b7c7646e0c5 100644 --- a/instat/dlgClimograph.vb +++ b/instat/dlgClimograph.vb @@ -284,7 +284,8 @@ Public Class dlgClimograph Private Sub ucr1stFactorReceiver_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucr1stFactorReceiver.ControlValueChanged If Not ucr1stFactorReceiver.IsEmpty Then - clsGgwalterliethFunction.AddParameter("station", Chr(34) & ucr1stFactorReceiver.GetVariableNames(False) & Chr(34), iPosition:=1) + 'clsGgwalterliethFunction.AddParameter("station", Chr(34) & ucr1stFactorReceiver.GetVariableNames(False) & Chr(34), iPosition:=1) + clsGgwalterliethFunction.AddParameter("station", ucr1stFactorReceiver.GetVariableNames(), iPosition:=1) Else clsGgwalterliethFunction.RemoveParameterByName("station") End If From c0c3bd9cba4bd905a53f7e5d275b448455452711 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Thu, 28 Mar 2024 11:06:16 +0100 Subject: [PATCH 63/88] Change made --- .../InstatObject/R/stand_alone_functions.R | 144 ++++++++++++++++-- 1 file changed, 135 insertions(+), 9 deletions(-) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index d69af86edbb..e5cb1ade294 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2,6 +2,7 @@ get_default_significant_figures <- function(data) { if(is.numeric(data)) return(3) else return(NA) } + convert_to_character_matrix <- function(data, format_decimal_places = TRUE, decimal_places, is_scientific = FALSE, return_data_frame = TRUE, na_display = NULL, check.names = TRUE) { if(nrow(data) == 0) { out <- matrix(nrow = 0, ncol = ncol(data)) @@ -39,6 +40,7 @@ convert_to_character_matrix <- function(data, format_decimal_places = TRUE, deci if(return_data_frame) out <- data.frame(out, stringsAsFactors = FALSE, check.names = check.names) return(out) } + next_default_item = function(prefix, existing_names = c(), include_index = FALSE, start_index = 1) { if(!is.character(prefix)) stop("prefix must be of type character") @@ -57,6 +59,7 @@ next_default_item = function(prefix, existing_names = c(), include_index = FALSE } return(out) } + import_from_ODK = function(username, form_name, platform) { if(platform == "kobo") { url <- "https://kc.kobotoolbox.org/api/v1/data" @@ -94,6 +97,7 @@ import_from_ODK = function(username, form_name, platform) { out <- jsonlite::fromJSON(form_data, flatten = TRUE) return(out) } + get_odk_form_names = function(username, platform) { #TODO This should not be repeated if(platform == "kobo") { @@ -118,6 +122,7 @@ get_odk_form_names = function(username, platform) { form_names <- sapply(forms, function(x) x$title) return(form_names) } + convert_SST <- function(datafile, data_from = 5){ start_year <- get_years_from_data(datafile)[1] end_year <- get_years_from_data(datafile)[length(get_years_from_data(datafile))] @@ -147,15 +152,19 @@ convert_SST <- function(datafile, data_from = 5){ my_data = cbind(period, lat_lon_df, SST_value) return(list(my_data, lat_lon_df)) } + get_years_from_data <- function(datafile){ return(na.omit(t(unique(datafile[3,2:ncol(datafile)])))) } + get_lat_from_data <- function(datafile){ return(unique(na.omit(as.numeric(as.character(datafile[5:nrow(datafile),1]))))) } + get_lon_from_data <- function(datafile){ return(na.omit(as.numeric(unique(t(datafile[5,2:ncol(datafile)]))))) } + lat_lon_dataframe <- function(datafile){ latitude <- get_lat_from_data(datafile) longitude <- get_lon_from_data(datafile) @@ -173,6 +182,7 @@ lat_lon_dataframe <- function(datafile){ } return(cbind(lat_lon,station)) } + output_CPT <- function(data, lat_lon_data, station_latlondata, latitude, longitude, station, year, element, long.data = TRUE, na_code = -999) { if(missing(data)) stop("data should be provided") @@ -246,20 +256,24 @@ output_CPT <- function(data, lat_lon_data, station_latlondata, latitude, longitu cpt_data <- rbind(t_lat_lon_data, unstacked_data) return(cpt_data) } + yday_366 <- function(date) { temp_doy <- lubridate::yday(date) temp_leap <- lubridate::leap_year(date) temp_doy[(!is.na(temp_doy)) & temp_doy > 59 & (!temp_leap)] <- 1 + temp_doy[(!is.na(temp_doy)) & temp_doy > 59 & (!temp_leap)] return(temp_doy) } + dekade <- function(date) { temp_dekade <- 3 * (lubridate::month(date)) - 2 + (lubridate::mday(date) > 10) + (lubridate::mday(date) > 20) return(temp_dekade) } + pentad <- function(date){ temp_pentad <- 6*(lubridate::month(date)) - 5 + (lubridate::mday(date) > 5) + (lubridate::mday(date) > 10) + (lubridate::mday(date) > 15) + (lubridate::mday(date) > 20) + (lubridate::mday(date) > 25) return(temp_pentad) } + nc_get_dim_min_max <- function(nc, dimension, time_as_date = TRUE) { if(!dimension %in% names(nc$dim)) stop(dimension, " not found in file.") vals <- nc$dim[[dimension]]$vals @@ -285,6 +299,7 @@ nc_get_dim_min_max <- function(nc, dimension, time_as_date = TRUE) { bounds <- c(min(vals, na.rm = TRUE), max(vals, na.rm = TRUE)) return(bounds) } + nc_as_data_frame <- function(nc, vars, keep_raw_time = TRUE, include_metadata = TRUE, boundary = NULL, lon_points = NULL, lat_points = NULL, id_points = NULL, show_requested_points = TRUE, great_circle_dist = TRUE) { if(missing(vars)) vars <- ncdf4.helpers::nc.get.variable.list(nc) if(sum(is.null(lon_points), is.null(lat_points)) == 1) stop("You must specificy both lon_points and lat_points") @@ -403,6 +418,7 @@ nc_as_data_frame <- function(nc, vars, keep_raw_time = TRUE, include_metadata = count_list[[1]] <- count dim_values_list[[1]] <- dim_values } + dim_axes <- ncdf4.helpers::nc.get.dim.axes(nc) time_dims <- names(dim_axes[which(dim_axes == "T" & names(dim_axes) %in% dim_names)]) var_data_list <- list() @@ -517,6 +533,7 @@ nc_as_data_frame <- function(nc, vars, keep_raw_time = TRUE, include_metadata = } return(var_data) } + # open_NetCDF <- function(nc_data, latitude_col_name, longitude_col_name, default_names){ # variables = names(nc_data$var) # lat_lon_names = names(nc_data$dim) @@ -596,6 +613,7 @@ nc_as_data_frame <- function(nc, vars, keep_raw_time = TRUE, include_metadata = # } # return(list(my_data, lat_lon_df, new_lat_lon_column_names)) # } + multiple_nc_as_data_frame <- function(path, vars, keep_raw_time = TRUE, include_metadata = TRUE, boundary = NULL, lon_points = NULL, lat_points = NULL, id_points = NULL, show_requested_points = TRUE, great_circle_dist = TRUE, id = "id") { filepaths <- list.files(path = path, pattern="*\\.nc", full.names = TRUE) filenames <- basename(filepaths) @@ -617,6 +635,7 @@ multiple_nc_as_data_frame <- function(path, vars, keep_raw_time = TRUE, include_ merged_data <- dplyr::bind_rows(nc_list, .id = id) return(merged_data) } + import_from_iri <- function(download_from, data_file, path, X1, X2,Y1,Y2, get_area_point){ if(path == ""){ gaugelocdir = getwd() @@ -776,38 +795,46 @@ import_from_iri <- function(download_from, data_file, path, X1, X2,Y1,Y2, get_ar file.remove(paste(gaugelocdir,"tmp_iri.csv",sep="/")) return(list(dataout,lat_lon_dataframe)) } + is.logical.like <- function(x) { if(is.logical(x)) return(TRUE) else if(is.numeric(x)) return(all(na.omit(x) %in% c(1,0))) else return(FALSE) } + is.binary <- function(x) { if(is.logical(x)) return(TRUE) else if(is.numeric(x)) return(all(na.omit(x) %in% c(1,0))) else if(is.factor(x)) return(nlevels(x) == 2) else return(FALSE) } + get_column_attributes <- function(x, drop = c("class", "levels")) { tmp_attr <- attributes(x) tmp_attr <- tmp_attr[!names(tmp_attr) %in% drop] return(tmp_attr) } + split_items_in_groups <- function(items, num) { if(length(items) %% num != 0) stop("The number of items must be divisible by the number of groups") x <- split(items, rep(1:num, each = length(items)/num)) return(x) } + cancor_coef <- function(object) { object[c("xcoef", "ycoef")] } ################### + # cmsaf Plot.Region script + # # This script displays a map of the selected product. # You can either specify a certain year / month from a data file with several time steps # or plot one 2D field. # Prepare the your netcdf-files with the R-script "Prep.Data.R" or "Apply.Function.R" ########################################################################################## + plot.region <- function(lon, lat, product, time, time_point = as.Date("2002-01-01"), add2title = "CM SAF, ", lonmin = NA, lonmax = NA, latmin = NA, latmax = NA, height = 600, width = 600, plot.ano = FALSE, set.col.breaks = FALSE, brk.set = seq(240,310,5), colmin0 = NA, colmax0 = NA, ncol = 14, plotHighRes = FALSE, plotCoastline = TRUE, plotCountries = TRUE, plotRivers = FALSE, contour.thick = 2, plotCities = TRUE, pch.cities = 2, cex.cities = 1, label.cities = TRUE, plotCapitals = 1, cex.label.cities = 0.5, dlat = 0.25, plotOwnLocations = FALSE, loc_lon = c(), loc_lat = c(), loc_name = c(""), label_pos = 1, variable = "Tm", level = 5, CTY.type = 4) { # Set the variable name @@ -886,6 +913,7 @@ plot.region <- function(lon, lat, product, time, time_point = as.Date("2002-01-0 if (varname == "CTY") datalev <- CTY.type #--------------------------------------------------# + # Invert the latitude dimension if necessary if (lat[ny] < lat[1]) { sort.out <- sort(lat,index.return=TRUE) @@ -1034,6 +1062,7 @@ plot.region <- function(lon, lat, product, time, time_point = as.Date("2002-01-0 axis(3,lwd=1,at=c(lonmin,lonmax),tick=TRUE,lwd.ticks=0,labels=FALSE) axis(4,lwd=1,at=c(latmin,latmax), tick=TRUE,lwd.ticks=0,labels=FALSE) } + duplicated_cases <- function(col_name, ignore = NULL, tolerance=0.01) { col_name <- as.vector(col_name) col_data1 <- c(1, rep(NA, length(col_name) - 1)) @@ -1060,6 +1089,7 @@ duplicated_cases <- function(col_name, ignore = NULL, tolerance=0.01) { } return(col_data1) } + #This is Sam function from issue #4270 duplicated_count_index<-function(x, type = "count"){ if(type == "count"){ @@ -1092,17 +1122,21 @@ duplicated_count_index<-function(x, type = "count"){ return(x$count) } } + + get_installed_packages_with_data <- function(with_data = TRUE) { all_installed_packages <- .packages(all.available = TRUE) if (with_data) all_installed_packages <- unique(data(package = all_installed_packages)[["results"]][,1]) return(all_installed_packages) } + drop_unused_levels <- function(dat, columns) { for(i in seq_along(columns)) { if(is.factor(dat[[columns[i]]])) dat[[columns[i]]] <- droplevels(dat[[columns[i]]]) } return(dat) } + compare_columns <- function(x, y, use_unique = TRUE, sort_values = TRUE, firstnotsecond = TRUE, secondnotfirst = TRUE, display_intersection = FALSE, display_union = FALSE, display_values = TRUE) { x_name <- deparse(substitute(x)) y_name <- deparse(substitute(y)) @@ -1143,6 +1177,8 @@ compare_columns <- function(x, y, use_unique = TRUE, sort_values = TRUE, firstno if(display_union) cat(paste0("Union (Values that appear in either column): ", paste0("'", dplyr::union(x, y), "'", collapse = ", "))) } } + + consecutive_sum <- function(x, initial_value = NA){ out = x for(i in 1:length(x)){ @@ -1158,9 +1194,11 @@ consecutive_sum <- function(x, initial_value = NA){ } return(out) } + max_consecutive_sum <- function(x){ max(consecutive_sum(x, initial_value = 0)) } + hashed_id <- function(x, salt, algo = "crc32") { if (missing(salt)){ y <- x @@ -1169,7 +1207,9 @@ hashed_id <- function(x, salt, algo = "crc32") { } y <- sapply(y, function(X) digest::digest(X, algo = algo)) as.character(y) + } + # Possible alternative but is slower: # spells <- function(z) { # Reduce(function(x,y) {y = dplyr::if_else(y == 0, 0, x + 1)}, z[-1], @@ -1187,6 +1227,7 @@ hashed_id <- function(x, salt, algo = "crc32") { } return(y) } + convert_to_dec_deg <- function (dd, mm = 0 , ss = 0, dir) { if(missing(dd)) stop("dd must be supplied") if(!missing(dir)) { @@ -1200,14 +1241,17 @@ convert_to_dec_deg <- function (dd, mm = 0 , ss = 0, dir) { decdeg <- (dd + ((mm * 60) + ss)/3600) * sgn return(decdeg) } + convert_yy_to_yyyy <- function (x, base) { if(missing(base)) stop("base year must be supplied") dplyr::if_else(x+2000 <= base, x+2000, x+1900) } + create_av_packs <- function() { av_packs <<- available.packages(repos = "https://cran.rstudio.com/") av_packs <<- data.frame(av_packs) } + package_check <- function(package) { out <- c() if (!pingr::is_online()) out[[1]] <- "5" @@ -1250,11 +1294,13 @@ in_top_n <- function(x, n = 10, wt, fun = sum) { else dat <- dat %>% dplyr::count(x, sort = TRUE, name = "fq") return(x %in% dat$x[1:n]) } + summary_sample <- function(x, size, replace = FALSE){ if(length(x)==0){return(NA)} else if(length(x)==1){return(x)} else{sample(x = x, size = size, replace = replace)} } + add_xy_area_range <- function(path, min_lon, max_lon, min_lat, max_lat, dim_x = "X", dim_y = "Y") { paste0( path, "/", dim_x, "/", @@ -1267,6 +1313,7 @@ add_xy_area_range <- function(path, min_lon, max_lon, min_lat, max_lat, dim_x = "RANGEEDGES", "/" ) } + add_xy_point_range <- function(path, min_lon, min_lat, dim_x = "X", dim_y = "Y") { paste0( path, "/", dim_x, "/", @@ -1277,6 +1324,7 @@ add_xy_point_range <- function(path, min_lon, min_lat, dim_x = "X", dim_y = "Y") "VALUES", "/" ) } + add_t_range <- function(path, min_date, max_date, dim_t = "T") { paste0( path, dim_t, "/", @@ -1287,6 +1335,7 @@ add_t_range <- function(path, min_date, max_date, dim_t = "T") { "RANGEEDGES", "/" ) } + add_nc <- function(path) { paste0(path, "data.nc") } @@ -1298,6 +1347,8 @@ fourier_series <- function(x, n, period) { "cos(", x, " * ", h, " * ", p2, " / ", period, ")", collapse = " + ") } + + climatic_missing <- function(data, date, elements = ..., stations, start = TRUE, end = FALSE){ @@ -1317,6 +1368,7 @@ climatic_missing <- function(data, date, elements = ..., stations, values_to = "value") # sort start/end times + # set start date if (start){ data.stack <- data.stack %>% @@ -1366,8 +1418,10 @@ climatic_missing <- function(data, date, elements = ..., stations, if (missing(stations)){ summary.data$stations <- NULL } + return(summary.data) } + climatic_details <- function(data, date, elements = ..., stations, @@ -1436,6 +1490,7 @@ climatic_details <- function(data, date, elements = ..., stations, From = dplyr::first({{ date }}), To = dplyr::last({{ date }})) %>% dplyr::mutate(is.complete = ifelse(no == na, 1, 0)) # 0 if all are missing + detail.table.month <- detail.table.month %>% dplyr::group_by({{ stations }}, Element) %>% dplyr::mutate(element.na = data.table::rleid(is.complete)) %>% @@ -1493,11 +1548,15 @@ climatic_details <- function(data, date, elements = ..., stations, dplyr::mutate(Level = make_factor(Level)) return(detail.table.all) + } + slope <- function(y, x) { x <- as.numeric(x) lm(y ~ x)$coefficients[2] + } + # make_factor is intended to be somewhat equivalent to forcats::as_factor() or base::as.factor(). # It provides default behaviour for converting to factor depending on the data type, similar to forcats::as_factor(). # For "character" and "numeric" types make_factor is consistent with forcats::as_factor() in terms of the order of the factor levels. @@ -1524,6 +1583,9 @@ make_factor <- function(x, ordered = is.ordered(x)) { factor(x, levels = as.character(unique(x)), ordered = ordered) } } + + + # wwr_export function is meant to reshape data into formats required by WMO for submission of climatic data # this gives Yearly data records with monthly and annual data for a particular year: wwr_export <- function(data, year, month, mean_station_pressure, mean_sea_level_pressure, @@ -1789,6 +1851,7 @@ wwr_export <- function(data, year, month, mean_station_pressure, mean_sea_level_ } cat(i, "file(s) created at:", folder) } + dd_to_dms <- function(x, lat) { if (lat) dir <- ifelse(x >= 0, "N", "S") else dir <- ifelse(x >= 0, "E", "W") @@ -1798,6 +1861,7 @@ dd_to_dms <- function(x, lat) { s <- round((x - d - m/60) * 3600) return(paste(sprintf(ifelse(lat, "%02d", "%03d"), d), sprintf("%02d", m), sprintf("%02d", s), dir)) } + plot_mrl <- function(data, station_name, element_name, umin, umax, ncol = 1, xlab = "Threshold", ylab = "Mean excess", fill = "red", col = "black", rug = TRUE, addNexcesses = TRUE, textsize = 4) { @@ -1835,10 +1899,13 @@ plot_mrl <- function(data, station_name, element_name, umin, umax, ncol = 1, ) } } + + ### Constants month_abb_english <- c("Jan","Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec") month_name_english <- c("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") + # factored out code for a multiple indices for a single station. # Called by climdex(). # Not intended to be used externally. @@ -1896,6 +1963,7 @@ climdex_single_station <- function(ci, freq = "annual", indices, year, month, } return(df_ind) } + climdex <- function(data, station, date, year, month, prec, tmax, tmin, indices, freq = "annual", base.range = c(1961, 1990), n = 5, northern.hemisphere = TRUE, quantiles = NULL, temp.qtiles = c(0.1, 0.9), @@ -1985,6 +2053,7 @@ climdex <- function(data, station, date, year, month, prec, tmax, tmin, indices, } return(df_out) } + spei_input <- function(data, station, year, month, element) { if (missing(station)) id_cols <- c(year, month) else id_cols <- c(station, year, month) # SPEI package assumes data is ordered so must be sorted @@ -2024,6 +2093,7 @@ spei_input <- function(data, station, year, month, element) { } ts_data } + # This function extracts the SPEI/SPI column from an spei object x. # It requires the original data in order to return a vector of the correct length by removing NA values introduced when unstacking. # An alternative to this is to have a single wrapper SPEI/SPI function to handle this. @@ -2057,7 +2127,9 @@ spei_output <- function(x, data, station, year, month) { col <- as.vector(vals) } col + } + # This function has been adapted from extRemes::threshrange.plot(). # It has been adapted for use in R-Instat and uses ggplot2 graphical system rather than base plot(). threshold_Plot <- function(x, r, type = c("GP", "PP", "Exponential"), nint = 10, @@ -2172,6 +2244,7 @@ threshold_Plot <- function(x, r, type = c("GP", "PP", "Exponential"), nint = 10, } patchwork::wrap_plots(lst_plots, ncol = 1) } + # This function produces multiple threshold plots for various stations at a time. plot_multiple_threshold <- function(data, station_col_name, element_col_name, r, type = c("GP", "PP", "Exponential"), nint = 10, alpha = 0.05, ncol = 1, xlb = "", main = NULL , verbose = FALSE,...) { @@ -2191,6 +2264,8 @@ plot_multiple_threshold <- function(data, station_col_name, element_col_name, r, threshold_Plot(x = element_col, r = r, type = type, nint = nint, alpha = alpha, verbose = verbose) } } + + plot_declustered <- function(data, station_col_name, element_col_name, threshold, r = NULL, xlab = NULL, ylab = NULL, ncol = 1, print_summary = FALSE) { if (!missing(station_col_name)) { plts <- list() @@ -2226,6 +2301,7 @@ plot_declustered <- function(data, station_col_name, element_col_name, threshold } } } + #This function creates a wrapper around functions from openair package other_rose_plots <- function(data, type1_col_name, type2_col_name, date_col_name, wd_col_name, ws_col_name, main_method, single_pollutant, multiple_pollutant, ...) { type <- "default" @@ -2260,6 +2336,7 @@ other_rose_plots <- function(data, type1_col_name, type2_col_name, date_col_name openair::polarFreq(mydata = data, type = type, pollutant = single_pollutant, ...) } } + #This function creates a wrapper around windRose and pollutionRose functions from openair package wind_pollution_rose <- function(mydata, date_name, pollutant, type1_col_name, type2_col_name, ...) { type <- "default" @@ -2281,10 +2358,12 @@ wind_pollution_rose <- function(mydata, date_name, pollutant, type1_col_name, ty openair::pollutionRose(mydata = mydata, type = type, pollutant, ...) } } + n_non_numeric <- function(x) { x <- as.character(x) sum(is.na(x) != is.na(suppressWarnings(as.numeric(x)))) } + # This function creates a wrapper around grDevices::recordPlot() to enable non-ggplot graphs to be saved as recorded_plot objects. # It also handles graphics devices carefully. record_graph <- function(x) { @@ -2316,6 +2395,8 @@ slopegraph_theme <- function(x_text_size = 12){ ggplot2::theme(axis.text.x.top = ggplot2::element_text(size = x_text_size, face = "bold")), ggplot2::theme(axis.ticks = ggplot2::element_blank())) } + + # slightly amended the "newggslopegraph" function in the CGPfunctions package slopegraph <- function(data, x, y, colour, data_label = NULL, y_text_size = 3, @@ -2442,6 +2523,7 @@ slopegraph <- function(data, x, y, colour, data_label = NULL, ggplot2::geom_label(ggplot2::aes_string(label = Ndata_label), size = data_text_size, label.padding = unit(data_label_padding, "lines"), label.size = data_label_line_size, colour = data_text_colour, fill = data_label_fill_colour) } + # Returns a three-letter string representing a specific quarter in a year (e.g. "JFM", "AMJ" etc.). get_quarter_label <- function(quarter, start_month){ if (!start_month %in% 1:12) stop(start_month, " is an invalid start month, must be in range of 1:12") @@ -2451,21 +2533,27 @@ get_quarter_label <- function(quarter, start_month){ paste(mabb[start_pos:(start_pos+2)], collapse = "")}) return(factor(x = qtr, levels = unique(qtr))) } + is.containVariableLabel <- function(x){ return(isTRUE(sjlabelled::get_label(x) != "")) } + is.emptyvariable <- function(x){ return(isTRUE(length(x) == sum(x == ""))) } + is.NAvariable <- function(x){ return(isTRUE(length(x) == sum(is.na(x)))) } + is.levelscount <- function(x, n){ return(isTRUE(sum(levels(x)) == n)) } + is.containValueLabel <- function(x){ return(labels_label %in% names(attributes(x))) } + is.containPartialValueLabel <- function(x) { if(is.containValueLabel(x)) { levelCounts <- table(x) @@ -2474,6 +2562,7 @@ is.containPartialValueLabel <- function(x) { } else{return(FALSE)} } + read_corpora <- function(data){ data_all <- NULL description <- NULL @@ -2522,6 +2611,8 @@ read_corpora <- function(data){ } return (data.frame(data_all)) } + + # Bind two data frames # and remove any duplicates from data frame x that are in data frame y # x = our data to remove duplicates from @@ -2531,6 +2622,7 @@ cbind_unique <- function(x, y, cols){ x <- x %>% dplyr::select(c(setdiff(names(x), cols))) x <- dplyr::bind_cols(x = x, y = dplyr::select(y, tidyselect::all_of(cols))) } + #object is the object to be displayed #object_format is the display format. If supplied, then returns file name of the object #if not then it prints the object @@ -2542,11 +2634,12 @@ view_object_data <- function(object, object_format = NULL) { file_name <- view_text_object(object) } else if (identical(object_format, "html")) { file_name <- view_html_object(object) - }else{ + } else{ print(object) } return(file_name) } + view_object <- function(data_book_object) { return( view_object_data( @@ -2555,6 +2648,7 @@ view_object <- function(data_book_object) { ) ) } + #displays the graph object in the set R "viewer". #if the viewer is not available then #it saves the object as a file in the temporary folder @@ -2589,6 +2683,7 @@ view_graph_object <- function(graph_object){ print(graph_object) } dev.off() #todo. use graphics.off() which one is better? + #todo. should we use respective package "convenience" functions to save the objects as image files depending on the class names? #investigate if it will help with resolution and scaling? @@ -2603,6 +2698,7 @@ view_graph_object <- function(graph_object){ return(file_name) } + #displays the object in the set R "viewer". #if the viewer is not available then #it saves the object as a file in the temporary folder @@ -2633,11 +2729,29 @@ view_text_object <- function(text_object){ return(file_name) } + +view_html_object <- function(html_object) { + # Check if html_object is a list and has more than one element + if (is.list(html_object) && all(sapply(html_object, class) == class(html_object[[1]]))) { + file_names <- vector("list", length(html_object)) + for (i in seq_along(html_object)) { + # If html_object is a list with multiple elements of the same class, + # use a for loop to process each element + file_names[[i]] <- process_html_object(html_object[[i]]) + } + return(file_names) + } + + # Process the html_object + return(process_html_object(html_object)) +} + +#Function to process individual HTML object #displays the html object in the set R "viewer". #if the viewer is not available then #it saves the object as a file in the temporary folder #and returns the file path. -view_html_object <- function(html_object){ +process_html_object <- function(html_object) { #if there is a viewer, like in the case of RStudio then just print the object #this check is primarily meant to make this function work in a similar manner when run outside R-Instat r_viewer <- base::getOption("viewer") @@ -2648,14 +2762,13 @@ view_html_object <- function(html_object){ return(html_object) } + # Get a unique temporary file name from the tempdir path + file_name <- tempfile(pattern = "viewhtml", fileext = ".html") - file_name <- "" - #get a vector of available class names + # Get a vector of available class names object_class_names <- class(html_object) - #get a unique temporary file name from the tempdir path - file_name <- tempfile(pattern = "viewhtml", fileext = ".html") - #save the object as a html file depending on the object type + # Save the object as an HTML file depending on the object type if ("htmlwidget" %in% object_class_names) { #Note. When selfcontained is set to True #a "Saving a widget with selfcontained = TRUE requires pandoc" error is thrown in R-Instat @@ -2671,12 +2784,15 @@ view_html_object <- function(html_object){ } else if ("gt_tbl" %in% object_class_names) { #"gt table" objects are not compatible with "htmlwidgets" package. So they have to be saved differently. #"mmtable2" package produces "gt_tbl" objects - gt::gtsave(html_object,filename = file_name) + gt::gtsave(html_object, filename = file_name) } message("R viewer not detected. File saved in location ", file_name) return(file_name) -} +} + + + #tries to recordPlot if graph_object = NULL, then returns graph object of class "recordedplot". #applicable to base graphs only check_graph <- function(graph_object){ @@ -2706,6 +2822,8 @@ check_graph <- function(graph_object){ return(out) } + + get_data_book_output_object_names <- function(output_object_list, object_type_label = NULL, excluded_items = c(), @@ -2749,6 +2867,7 @@ get_data_book_output_object_names <- function(output_object_list, } } + get_vignette <- function (package = NULL, lib.loc = NULL, all = TRUE) { oneLink <- function(s) { @@ -2808,6 +2927,7 @@ get_vignette <- function (package = NULL, lib.loc = NULL, all = TRUE) port, basename(file)))} else return(sprintf("file://%s", file)) } + # for issue 8342 - adding in a count of the number of elements that have missing values by period (and station) cumulative_inventory <- function(data, station = NULL, from, to){ if (is.null(station)){ @@ -2837,6 +2957,7 @@ cumulative_inventory <- function(data, station = NULL, from, to){ } return(data) } + getRowHeadersWithText <- function(data, column, searchText, ignore_case, use_regex) { if(use_regex){ # Find the rows that match the search text using regex @@ -2852,6 +2973,7 @@ getRowHeadersWithText <- function(data, column, searchText, ignore_case, use_reg # Return the row headers return(rowHeaders) } + # Custom function to convert character to list of numeric vector convert_to_list <- function(x) { if (grepl("^c\\(", x)) { @@ -2864,6 +2986,7 @@ convert_to_list <- function(x) { return(as.numeric(x)) } } + getExample <- function (topic, package = NULL, lib.loc = NULL, character.only = TRUE, give.lines = FALSE, local = FALSE, echo = TRUE, verbose = getOption("verbose"), setRNG = FALSE, ask = getOption("example.ask"), prompt.prefix = abbreviate(topic, 6), run.dontrun = FALSE, run.donttest = interactive()) { if (!character.only) { topic <- substitute(topic) @@ -2903,6 +3026,7 @@ getExample <- function (topic, package = NULL, lib.loc = NULL, character.only = } return(example_text) } + WB_evaporation <- function(water_balance, frac, capacity, evaporation_value, rain){ if (water_balance >= frac*capacity){ evaporation <- evaporation_value @@ -2924,6 +3048,7 @@ WB_evaporation <- function(water_balance, frac, capacity, evaporation_value, rai } return(evaporation) } + write_weather_data <- function(year, month, day, rain, mn_tmp, mx_tmp, missing_code, output_file) { # Create a data frame with the provided inputs weather_data <- data.frame(year = year, @@ -2941,6 +3066,7 @@ write_weather_data <- function(year, month, day, rain, mn_tmp, mx_tmp, missing_c cat("Weather data has been written to", output_file, "\n") } + prepare_walter_lieth <- function(data, month, tm_min, ta_min){ dat_long_int <- NULL for (j in seq(nrow(data) - 1)) { From 32b18e4a0d998989e46be22bc71e4e47f9ca2919 Mon Sep 17 00:00:00 2001 From: JUMA Date: Thu, 28 Mar 2024 15:56:46 +0300 Subject: [PATCH 64/88] design --- instat/ucrCalculator.Designer.vb | 322 +++++++++++++++---------------- 1 file changed, 161 insertions(+), 161 deletions(-) diff --git a/instat/ucrCalculator.Designer.vb b/instat/ucrCalculator.Designer.vb index 9989539db07..77ef4753380 100644 --- a/instat/ucrCalculator.Designer.vb +++ b/instat/ucrCalculator.Designer.vb @@ -62,6 +62,7 @@ Partial Class ucrCalculator Me.cmd0 = New System.Windows.Forms.Button() Me.cmd1 = New System.Windows.Forms.Button() Me.grpDates = New System.Windows.Forms.GroupBox() + Me.cmdRHelp = New instat.ucrSplitButton() Me.ContextMenuStripDate = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.DateLubridateToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DateHmsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -118,6 +119,7 @@ Partial Class ucrCalculator Me.cmdGCD = New System.Windows.Forms.Button() Me.cmdGeneratePrimes = New System.Windows.Forms.Button() Me.cmdNthPrime = New System.Windows.Forms.Button() + Me.cmdIntegerRHelp = New instat.ucrSplitButton() Me.ContextMenuStripInteger = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.GmpToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DescToolsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -140,6 +142,7 @@ Partial Class ucrCalculator Me.cmdIsPrime = New System.Windows.Forms.Button() Me.cmdBigZ = New System.Windows.Forms.Button() Me.grpFactor = New System.Windows.Forms.GroupBox() + Me.cmdTransformHelp = New instat.ucrSplitButton() Me.ContextMenuStripFactor = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.FactorForcatsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cmdShuffle = New System.Windows.Forms.Button() @@ -163,6 +166,7 @@ Partial Class ucrCalculator Me.cmdFactor = New System.Windows.Forms.Button() Me.cmdAnon = New System.Windows.Forms.Button() Me.grpHydroGOF = New System.Windows.Forms.GroupBox() + Me.cmdHydroHelp = New instat.ucrSplitButton() Me.ContextMenuStripHydroGOF = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.HydroGOFToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cmdVE = New System.Windows.Forms.Button() @@ -243,6 +247,7 @@ Partial Class ucrCalculator Me.cmdGroup = New System.Windows.Forms.Button() Me.cmdGrade = New System.Windows.Forms.Button() Me.grpMaths = New System.Windows.Forms.GroupBox() + Me.cmdMathsHelp = New instat.ucrSplitButton() Me.ContextMenuStripMaths = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.MathsBaseStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.MathsStatsStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -276,6 +281,7 @@ Partial Class ucrCalculator Me.cmdwhichmax = New System.Windows.Forms.Button() Me.cmdwheremax = New System.Windows.Forms.Button() Me.cmdwhichmin = New System.Windows.Forms.Button() + Me.cmdSummaryRHelp = New instat.ucrSplitButton() Me.ContextMenuStripSummary = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.BaseToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem() Me.StatsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -329,6 +335,7 @@ Partial Class ucrCalculator Me.cmdVar = New System.Windows.Forms.Button() Me.grpProbabilty = New System.Windows.Forms.GroupBox() Me.cmdPascal = New System.Windows.Forms.Button() + Me.cmdProbRHelp = New instat.ucrSplitButton() Me.ContextMenuStripProbability = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.ProbStatsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ProbBaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -377,6 +384,7 @@ Partial Class ucrCalculator Me.cmdDecimals = New System.Windows.Forms.Button() Me.cmdMASSFractions = New System.Windows.Forms.Button() Me.cmdScale = New System.Windows.Forms.Button() + Me.cmdTransformRHelp = New instat.ucrSplitButton() Me.ContextMenuStripTransform = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.BaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DplyrToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -411,6 +419,7 @@ Partial Class ucrCalculator Me.cmdLead = New System.Windows.Forms.Button() Me.cmdLag = New System.Windows.Forms.Button() Me.grpLogical = New System.Windows.Forms.GroupBox() + Me.cmdLogicalHelp = New instat.ucrSplitButton() Me.ContextMenuStripLogical = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.LogBaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.LogDplyrToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -474,6 +483,7 @@ Partial Class ucrCalculator Me.cmdSquishb = New System.Windows.Forms.Button() Me.ttCalculator = New System.Windows.Forms.ToolTip(Me.components) Me.grpCircular = New System.Windows.Forms.GroupBox() + Me.cmdCircularHelp = New instat.ucrSplitButton() Me.ContextMenuStripCircular = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.CircularToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cmdCircular = New System.Windows.Forms.Button() @@ -516,6 +526,7 @@ Partial Class ucrCalculator Me.grpComplex = New System.Windows.Forms.GroupBox() Me.cmdAsComplex = New System.Windows.Forms.Button() Me.cmdComplexi = New System.Windows.Forms.Button() + Me.cmdComplexRHelp = New instat.ucrSplitButton() Me.cmdComplexTanH = New System.Windows.Forms.Button() Me.cmdComplexTan = New System.Windows.Forms.Button() Me.cmdComplexPi = New System.Windows.Forms.Button() @@ -606,17 +617,6 @@ Partial Class ucrCalculator Me.ucrInputCalOptions = New instat.ucrInputComboBox() Me.ucrSelectorForCalculations = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverForCalculation = New instat.ucrReceiverExpression() - Me.cmdCircularHelp = New instat.ucrSplitButton() - Me.cmdMathsHelp = New instat.ucrSplitButton() - Me.cmdProbRHelp = New instat.ucrSplitButton() - Me.cmdIntegerRHelp = New instat.ucrSplitButton() - Me.cmdComplexRHelp = New instat.ucrSplitButton() - Me.cmdSummaryRHelp = New instat.ucrSplitButton() - Me.cmdTransformRHelp = New instat.ucrSplitButton() - Me.cmdLogicalHelp = New instat.ucrSplitButton() - Me.cmdRHelp = New instat.ucrSplitButton() - Me.cmdHydroHelp = New instat.ucrSplitButton() - Me.cmdTransformHelp = New instat.ucrSplitButton() Me.grpBasic.SuspendLayout Me.grpDates.SuspendLayout Me.ContextMenuStripDate.SuspendLayout @@ -953,6 +953,18 @@ Partial Class ucrCalculator Me.grpDates.TabStop = False Me.grpDates.Text = "Dates/Times" ' + 'cmdRHelp + ' + Me.cmdRHelp.AutoSize = True + Me.cmdRHelp.ContextMenuStrip = Me.ContextMenuStripDate + Me.cmdRHelp.Location = New System.Drawing.Point(186, 164) + Me.cmdRHelp.Name = "cmdRHelp" + Me.cmdRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdRHelp.SplitMenuStrip = Me.ContextMenuStripDate + Me.cmdRHelp.TabIndex = 212 + Me.cmdRHelp.Text = "R Help" + Me.cmdRHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripDate ' Me.ContextMenuStripDate.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -1550,6 +1562,18 @@ Partial Class ucrCalculator Me.cmdNthPrime.Text = "nth_prime" Me.cmdNthPrime.UseVisualStyleBackColor = True ' + 'cmdIntegerRHelp + ' + Me.cmdIntegerRHelp.AutoSize = True + Me.cmdIntegerRHelp.ContextMenuStrip = Me.ContextMenuStripInteger + Me.cmdIntegerRHelp.Location = New System.Drawing.Point(262, 354) + Me.cmdIntegerRHelp.Name = "cmdIntegerRHelp" + Me.cmdIntegerRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdIntegerRHelp.SplitMenuStrip = Me.ContextMenuStripInteger + Me.cmdIntegerRHelp.TabIndex = 16 + Me.cmdIntegerRHelp.Text = "R Help" + Me.cmdIntegerRHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripInteger ' Me.ContextMenuStripInteger.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -1755,6 +1779,18 @@ Partial Class ucrCalculator Me.grpFactor.TabStop = False Me.grpFactor.Text = "Factor" ' + 'cmdTransformHelp + ' + Me.cmdTransformHelp.AutoSize = True + Me.cmdTransformHelp.ContextMenuStrip = Me.ContextMenuStripFactor + Me.cmdTransformHelp.Location = New System.Drawing.Point(188, 218) + Me.cmdTransformHelp.Name = "cmdTransformHelp" + Me.cmdTransformHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdTransformHelp.SplitMenuStrip = Me.ContextMenuStripFactor + Me.cmdTransformHelp.TabIndex = 212 + Me.cmdTransformHelp.Text = "R Help" + Me.cmdTransformHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripFactor ' Me.ContextMenuStripFactor.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -2021,6 +2057,18 @@ Partial Class ucrCalculator Me.grpHydroGOF.TabStop = False Me.grpHydroGOF.Text = "hydroGOF " ' + 'cmdHydroHelp + ' + Me.cmdHydroHelp.AutoSize = True + Me.cmdHydroHelp.ContextMenuStrip = Me.ContextMenuStripHydroGOF + Me.cmdHydroHelp.Location = New System.Drawing.Point(113, 298) + Me.cmdHydroHelp.Name = "cmdHydroHelp" + Me.cmdHydroHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdHydroHelp.SplitMenuStrip = Me.ContextMenuStripHydroGOF + Me.cmdHydroHelp.TabIndex = 212 + Me.cmdHydroHelp.Text = "R Help" + Me.cmdHydroHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripHydroGOF ' Me.ContextMenuStripHydroGOF.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -2969,6 +3017,18 @@ Partial Class ucrCalculator Me.grpMaths.TabStop = False Me.grpMaths.Text = "Maths" ' + 'cmdMathsHelp + ' + Me.cmdMathsHelp.AutoSize = True + Me.cmdMathsHelp.ContextMenuStrip = Me.ContextMenuStripMaths + Me.cmdMathsHelp.Location = New System.Drawing.Point(204, 165) + Me.cmdMathsHelp.Name = "cmdMathsHelp" + Me.cmdMathsHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdMathsHelp.SplitMenuStrip = Me.ContextMenuStripMaths + Me.cmdMathsHelp.TabIndex = 211 + Me.cmdMathsHelp.Text = "R Help" + Me.cmdMathsHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripMaths ' Me.ContextMenuStripMaths.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -3347,6 +3407,18 @@ Partial Class ucrCalculator Me.cmdwhichmin.Text = "which.min" Me.cmdwhichmin.UseVisualStyleBackColor = True ' + 'cmdSummaryRHelp + ' + Me.cmdSummaryRHelp.AutoSize = True + Me.cmdSummaryRHelp.ContextMenuStrip = Me.ContextMenuStripSummary + Me.cmdSummaryRHelp.Location = New System.Drawing.Point(228, 238) + Me.cmdSummaryRHelp.Name = "cmdSummaryRHelp" + Me.cmdSummaryRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdSummaryRHelp.SplitMenuStrip = Me.ContextMenuStripSummary + Me.cmdSummaryRHelp.TabIndex = 185 + Me.cmdSummaryRHelp.Text = "R Help" + Me.cmdSummaryRHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripSummary ' Me.ContextMenuStripSummary.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -3969,6 +4041,18 @@ Partial Class ucrCalculator Me.cmdPascal.Text = "pascal" Me.cmdPascal.UseVisualStyleBackColor = True ' + 'cmdProbRHelp + ' + Me.cmdProbRHelp.AutoSize = True + Me.cmdProbRHelp.ContextMenuStrip = Me.ContextMenuStripProbability + Me.cmdProbRHelp.Location = New System.Drawing.Point(269, 239) + Me.cmdProbRHelp.Name = "cmdProbRHelp" + Me.cmdProbRHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdProbRHelp.SplitMenuStrip = Me.ContextMenuStripProbability + Me.cmdProbRHelp.TabIndex = 212 + Me.cmdProbRHelp.Text = "R Help" + Me.cmdProbRHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripProbability ' Me.ContextMenuStripProbability.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -4559,6 +4643,18 @@ Partial Class ucrCalculator Me.cmdScale.Text = "scale" Me.cmdScale.UseVisualStyleBackColor = True ' + 'cmdTransformRHelp + ' + Me.cmdTransformRHelp.AutoSize = True + Me.cmdTransformRHelp.ContextMenuStrip = Me.ContextMenuStripTransform + Me.cmdTransformRHelp.Location = New System.Drawing.Point(267, 245) + Me.cmdTransformRHelp.Name = "cmdTransformRHelp" + Me.cmdTransformRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdTransformRHelp.SplitMenuStrip = Me.ContextMenuStripTransform + Me.cmdTransformRHelp.TabIndex = 204 + Me.cmdTransformRHelp.Text = "R Help" + Me.cmdTransformRHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripTransform ' Me.ContextMenuStripTransform.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -4914,6 +5010,18 @@ Partial Class ucrCalculator Me.grpLogical.TabStop = False Me.grpLogical.Text = "Logical and Symbols" ' + 'cmdLogicalHelp + ' + Me.cmdLogicalHelp.AutoSize = True + Me.cmdLogicalHelp.ContextMenuStrip = Me.ContextMenuStripLogical + Me.cmdLogicalHelp.Location = New System.Drawing.Point(207, 234) + Me.cmdLogicalHelp.Name = "cmdLogicalHelp" + Me.cmdLogicalHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdLogicalHelp.SplitMenuStrip = Me.ContextMenuStripLogical + Me.cmdLogicalHelp.TabIndex = 212 + Me.cmdLogicalHelp.Text = "R Help" + Me.cmdLogicalHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripLogical ' Me.ContextMenuStripLogical.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -5661,6 +5769,18 @@ Partial Class ucrCalculator Me.grpCircular.TabStop = False Me.grpCircular.Text = "Circular" ' + 'cmdCircularHelp + ' + Me.cmdCircularHelp.AutoSize = True + Me.cmdCircularHelp.ContextMenuStrip = Me.ContextMenuStripCircular + Me.cmdCircularHelp.Location = New System.Drawing.Point(197, 178) + Me.cmdCircularHelp.Name = "cmdCircularHelp" + Me.cmdCircularHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdCircularHelp.SplitMenuStrip = Me.ContextMenuStripCircular + Me.cmdCircularHelp.TabIndex = 212 + Me.cmdCircularHelp.Text = "R Help" + Me.cmdCircularHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripCircular ' Me.ContextMenuStripCircular.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -6156,6 +6276,18 @@ Partial Class ucrCalculator Me.cmdComplexi.Text = "i" Me.cmdComplexi.UseVisualStyleBackColor = True ' + 'cmdComplexRHelp + ' + Me.cmdComplexRHelp.AutoSize = True + Me.cmdComplexRHelp.ContextMenuStrip = Me.ContextMenuStripComplex + Me.cmdComplexRHelp.Location = New System.Drawing.Point(228, 212) + Me.cmdComplexRHelp.Name = "cmdComplexRHelp" + Me.cmdComplexRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdComplexRHelp.SplitMenuStrip = Me.ContextMenuStripComplex + Me.cmdComplexRHelp.TabIndex = 209 + Me.cmdComplexRHelp.Text = "R Help" + Me.cmdComplexRHelp.UseVisualStyleBackColor = True + ' 'cmdComplexTanH ' Me.cmdComplexTanH.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) @@ -7225,145 +7357,11 @@ Partial Class ucrCalculator Me.ucrReceiverForCalculation.TabIndex = 120 Me.ucrReceiverForCalculation.ucrSelector = Nothing ' - 'cmdCircularHelp - ' - Me.cmdCircularHelp.AutoSize = True - Me.cmdCircularHelp.ContextMenuStrip = Me.ContextMenuStripCircular - Me.cmdCircularHelp.Location = New System.Drawing.Point(197, 178) - Me.cmdCircularHelp.Name = "cmdCircularHelp" - Me.cmdCircularHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdCircularHelp.SplitMenuStrip = Me.ContextMenuStripCircular - Me.cmdCircularHelp.TabIndex = 212 - Me.cmdCircularHelp.Text = "R Help" - Me.cmdCircularHelp.UseVisualStyleBackColor = True - ' - 'cmdMathsHelp - ' - Me.cmdMathsHelp.AutoSize = True - Me.cmdMathsHelp.ContextMenuStrip = Me.ContextMenuStripMaths - Me.cmdMathsHelp.Location = New System.Drawing.Point(204, 165) - Me.cmdMathsHelp.Name = "cmdMathsHelp" - Me.cmdMathsHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdMathsHelp.SplitMenuStrip = Me.ContextMenuStripMaths - Me.cmdMathsHelp.TabIndex = 211 - Me.cmdMathsHelp.Text = "R Help" - Me.cmdMathsHelp.UseVisualStyleBackColor = True - ' - 'cmdProbRHelp - ' - Me.cmdProbRHelp.AutoSize = True - Me.cmdProbRHelp.ContextMenuStrip = Me.ContextMenuStripProbability - Me.cmdProbRHelp.Location = New System.Drawing.Point(269, 239) - Me.cmdProbRHelp.Name = "cmdProbRHelp" - Me.cmdProbRHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdProbRHelp.SplitMenuStrip = Me.ContextMenuStripProbability - Me.cmdProbRHelp.TabIndex = 212 - Me.cmdProbRHelp.Text = "R Help" - Me.cmdProbRHelp.UseVisualStyleBackColor = True - ' - 'cmdIntegerRHelp - ' - Me.cmdIntegerRHelp.AutoSize = True - Me.cmdIntegerRHelp.ContextMenuStrip = Me.ContextMenuStripInteger - Me.cmdIntegerRHelp.Location = New System.Drawing.Point(262, 354) - Me.cmdIntegerRHelp.Name = "cmdIntegerRHelp" - Me.cmdIntegerRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdIntegerRHelp.SplitMenuStrip = Me.ContextMenuStripInteger - Me.cmdIntegerRHelp.TabIndex = 16 - Me.cmdIntegerRHelp.Text = "R Help" - Me.cmdIntegerRHelp.UseVisualStyleBackColor = True - ' - 'cmdComplexRHelp - ' - Me.cmdComplexRHelp.AutoSize = True - Me.cmdComplexRHelp.ContextMenuStrip = Me.ContextMenuStripComplex - Me.cmdComplexRHelp.Location = New System.Drawing.Point(228, 212) - Me.cmdComplexRHelp.Name = "cmdComplexRHelp" - Me.cmdComplexRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdComplexRHelp.SplitMenuStrip = Me.ContextMenuStripComplex - Me.cmdComplexRHelp.TabIndex = 209 - Me.cmdComplexRHelp.Text = "R Help" - Me.cmdComplexRHelp.UseVisualStyleBackColor = True - ' - 'cmdSummaryRHelp - ' - Me.cmdSummaryRHelp.AutoSize = True - Me.cmdSummaryRHelp.ContextMenuStrip = Me.ContextMenuStripSummary - Me.cmdSummaryRHelp.Location = New System.Drawing.Point(228, 238) - Me.cmdSummaryRHelp.Name = "cmdSummaryRHelp" - Me.cmdSummaryRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdSummaryRHelp.SplitMenuStrip = Me.ContextMenuStripSummary - Me.cmdSummaryRHelp.TabIndex = 185 - Me.cmdSummaryRHelp.Text = "R Help" - Me.cmdSummaryRHelp.UseVisualStyleBackColor = True - ' - 'cmdTransformRHelp - ' - Me.cmdTransformRHelp.AutoSize = True - Me.cmdTransformRHelp.ContextMenuStrip = Me.ContextMenuStripTransform - Me.cmdTransformRHelp.Location = New System.Drawing.Point(267, 245) - Me.cmdTransformRHelp.Name = "cmdTransformRHelp" - Me.cmdTransformRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdTransformRHelp.SplitMenuStrip = Me.ContextMenuStripTransform - Me.cmdTransformRHelp.TabIndex = 204 - Me.cmdTransformRHelp.Text = "R Help" - Me.cmdTransformRHelp.UseVisualStyleBackColor = True - ' - 'cmdLogicalHelp - ' - Me.cmdLogicalHelp.AutoSize = True - Me.cmdLogicalHelp.ContextMenuStrip = Me.ContextMenuStripLogical - Me.cmdLogicalHelp.Location = New System.Drawing.Point(207, 234) - Me.cmdLogicalHelp.Name = "cmdLogicalHelp" - Me.cmdLogicalHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdLogicalHelp.SplitMenuStrip = Me.ContextMenuStripLogical - Me.cmdLogicalHelp.TabIndex = 212 - Me.cmdLogicalHelp.Text = "R Help" - Me.cmdLogicalHelp.UseVisualStyleBackColor = True - ' - 'cmdRHelp - ' - Me.cmdRHelp.AutoSize = True - Me.cmdRHelp.ContextMenuStrip = Me.ContextMenuStripDate - Me.cmdRHelp.Location = New System.Drawing.Point(186, 164) - Me.cmdRHelp.Name = "cmdRHelp" - Me.cmdRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdRHelp.SplitMenuStrip = Me.ContextMenuStripDate - Me.cmdRHelp.TabIndex = 212 - Me.cmdRHelp.Text = "R Help" - Me.cmdRHelp.UseVisualStyleBackColor = True - ' - 'cmdHydroHelp - ' - Me.cmdHydroHelp.AutoSize = True - Me.cmdHydroHelp.ContextMenuStrip = Me.ContextMenuStripHydroGOF - Me.cmdHydroHelp.Location = New System.Drawing.Point(113, 298) - Me.cmdHydroHelp.Name = "cmdHydroHelp" - Me.cmdHydroHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdHydroHelp.SplitMenuStrip = Me.ContextMenuStripHydroGOF - Me.cmdHydroHelp.TabIndex = 212 - Me.cmdHydroHelp.Text = "R Help" - Me.cmdHydroHelp.UseVisualStyleBackColor = True - ' - 'cmdTransformHelp - ' - Me.cmdTransformHelp.AutoSize = True - Me.cmdTransformHelp.ContextMenuStrip = Me.ContextMenuStripFactor - Me.cmdTransformHelp.Location = New System.Drawing.Point(188, 218) - Me.cmdTransformHelp.Name = "cmdTransformHelp" - Me.cmdTransformHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdTransformHelp.SplitMenuStrip = Me.ContextMenuStripFactor - Me.cmdTransformHelp.TabIndex = 212 - Me.cmdTransformHelp.Text = "R Help" - Me.cmdTransformHelp.UseVisualStyleBackColor = True - ' 'ucrCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(120.0!, 120.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.Controls.Add(Me.grpList) - Me.Controls.Add(Me.grpWakefield) Me.Controls.Add(Me.cmdRhelpList) Me.Controls.Add(Me.cmdWakefieldHelp) Me.Controls.Add(Me.cmdStringRHelp) @@ -7376,61 +7374,63 @@ Partial Class ucrCalculator Me.Controls.Add(Me.ucrReceiverForCalculation) Me.Controls.Add(Me.lblExpression) Me.Controls.Add(Me.grpSymbols) + Me.Controls.Add(Me.grpModifier) + Me.Controls.Add(Me.grpDates) + Me.Controls.Add(Me.grpHydroGOF) + Me.Controls.Add(Me.grpFactor) + Me.Controls.Add(Me.grpList) + Me.Controls.Add(Me.grpWakefield) Me.Controls.Add(Me.grpCircular) Me.Controls.Add(Me.grpMaths) Me.Controls.Add(Me.grpProbabilty) Me.Controls.Add(Me.grpInteger) Me.Controls.Add(Me.grpTestString) - Me.Controls.Add(Me.grpModifier) Me.Controls.Add(Me.grpComplex) Me.Controls.Add(Me.grpSummary) Me.Controls.Add(Me.grpTransform) Me.Controls.Add(Me.grpLogical) - Me.Controls.Add(Me.grpDates) - Me.Controls.Add(Me.grpHydroGOF) - Me.Controls.Add(Me.grpFactor) Me.Name = "ucrCalculator" Me.Size = New System.Drawing.Size(1123, 572) Me.grpBasic.ResumeLayout(False) Me.grpDates.ResumeLayout(False) - Me.grpDates.PerformLayout() + Me.grpDates.PerformLayout Me.ContextMenuStripDate.ResumeLayout(False) Me.ContextMenuStripComplex.ResumeLayout(False) Me.grpInteger.ResumeLayout(False) - Me.grpInteger.PerformLayout() + Me.grpInteger.PerformLayout Me.ContextMenuStripInteger.ResumeLayout(False) Me.grpFactor.ResumeLayout(False) - Me.grpFactor.PerformLayout() + Me.grpFactor.PerformLayout Me.ContextMenuStripFactor.ResumeLayout(False) Me.grpHydroGOF.ResumeLayout(False) - Me.grpHydroGOF.PerformLayout() + Me.grpHydroGOF.PerformLayout Me.ContextMenuStripHydroGOF.ResumeLayout(False) Me.grpWakefield.ResumeLayout(False) Me.grpMaths.ResumeLayout(False) - Me.grpMaths.PerformLayout() + Me.grpMaths.PerformLayout Me.ContextMenuStripMaths.ResumeLayout(False) Me.grpSummary.ResumeLayout(False) - Me.grpSummary.PerformLayout() + Me.grpSummary.PerformLayout Me.ContextMenuStripSummary.ResumeLayout(False) Me.grpFrequencies.ResumeLayout(False) Me.grpProbabilty.ResumeLayout(False) - Me.grpProbabilty.PerformLayout() + Me.grpProbabilty.PerformLayout Me.ContextMenuStripProbability.ResumeLayout(False) Me.grpRandom.ResumeLayout(False) Me.grpTransform.ResumeLayout(False) - Me.grpTransform.PerformLayout() + Me.grpTransform.PerformLayout Me.ContextMenuStripTransform.ResumeLayout(False) Me.grpLogical.ResumeLayout(False) - Me.grpLogical.PerformLayout() + Me.grpLogical.PerformLayout Me.ContextMenuStripLogical.ResumeLayout(False) Me.grpTestString.ResumeLayout(False) Me.grpCircular.ResumeLayout(False) - Me.grpCircular.PerformLayout() + Me.grpCircular.PerformLayout Me.ContextMenuStripCircular.ResumeLayout(False) Me.grpModifier.ResumeLayout(False) Me.grpSymbols.ResumeLayout(False) Me.grpComplex.ResumeLayout(False) - Me.grpComplex.PerformLayout() + Me.grpComplex.PerformLayout Me.ContextMenuStripTxtString.ResumeLayout(False) Me.ContextMenuStripWakefield.ResumeLayout(False) Me.ContextMenuStripList.ResumeLayout(False) @@ -7438,7 +7438,7 @@ Partial Class ucrCalculator Me.GroupBox1.ResumeLayout(False) Me.grpMathBloc.ResumeLayout(False) Me.ResumeLayout(False) - Me.PerformLayout() + Me.PerformLayout End Sub From 284eb6729567bf731fe8b07f4c10fb5c0f10acce Mon Sep 17 00:00:00 2001 From: JUMA Date: Thu, 28 Mar 2024 16:03:02 +0300 Subject: [PATCH 65/88] chng --- instat/ucrCalculator.Designer.vb | 559 +++++++++++++++++-------------- instat/ucrCalculator.vb | 58 ++-- 2 files changed, 351 insertions(+), 266 deletions(-) diff --git a/instat/ucrCalculator.Designer.vb b/instat/ucrCalculator.Designer.vb index 77ef4753380..4bc4c83985d 100644 --- a/instat/ucrCalculator.Designer.vb +++ b/instat/ucrCalculator.Designer.vb @@ -66,25 +66,6 @@ Partial Class ucrCalculator Me.ContextMenuStripDate = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.DateLubridateToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DateHmsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.cmdPm = New System.Windows.Forms.Button() - Me.cmdTime = New System.Windows.Forms.Button() - Me.cmdDateTime = New System.Windows.Forms.Button() - Me.cmdQuarter = New System.Windows.Forms.Button() - Me.cmdD_In_M = New System.Windows.Forms.Button() - Me.cmdAm = New System.Windows.Forms.Button() - Me.cmdSec = New System.Windows.Forms.Button() - Me.cmdHour = New System.Windows.Forms.Button() - Me.cmdminutes = New System.Windows.Forms.Button() - Me.cmdDmy = New System.Windows.Forms.Button() - Me.cmdDay = New System.Windows.Forms.Button() - Me.cmdMonth = New System.Windows.Forms.Button() - Me.cmdYear = New System.Windows.Forms.Button() - Me.cmdDate = New System.Windows.Forms.Button() - Me.cmdYday = New System.Windows.Forms.Button() - Me.cmdWday = New System.Windows.Forms.Button() - Me.cmdMdy = New System.Windows.Forms.Button() - Me.cmdYmd = New System.Windows.Forms.Button() - Me.cmdLeap = New System.Windows.Forms.Button() Me.ContextMenuStripComplex = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.ComplexBaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.grpInteger = New System.Windows.Forms.GroupBox() @@ -617,6 +598,30 @@ Partial Class ucrCalculator Me.ucrInputCalOptions = New instat.ucrInputComboBox() Me.ucrSelectorForCalculations = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverForCalculation = New instat.ucrReceiverExpression() + Me.cmdYmdHms = New System.Windows.Forms.Button() + Me.cmdYmdHm = New System.Windows.Forms.Button() + Me.cmdAsDate = New System.Windows.Forms.Button() + Me.cmdAsTime = New System.Windows.Forms.Button() + Me.cmdYmdH = New System.Windows.Forms.Button() + Me.cmdPm = New System.Windows.Forms.Button() + Me.cmdTime = New System.Windows.Forms.Button() + Me.cmdDateTime = New System.Windows.Forms.Button() + Me.cmdQuarter = New System.Windows.Forms.Button() + Me.cmdD_In_M = New System.Windows.Forms.Button() + Me.cmdAm = New System.Windows.Forms.Button() + Me.cmdSec = New System.Windows.Forms.Button() + Me.cmdHour = New System.Windows.Forms.Button() + Me.cmdMinutes = New System.Windows.Forms.Button() + Me.cmdDmy = New System.Windows.Forms.Button() + Me.cmdDay = New System.Windows.Forms.Button() + Me.cmdMonth = New System.Windows.Forms.Button() + Me.cmdYear = New System.Windows.Forms.Button() + Me.cmdDate = New System.Windows.Forms.Button() + Me.cmdYday = New System.Windows.Forms.Button() + Me.cmdWday = New System.Windows.Forms.Button() + Me.cmdMdy = New System.Windows.Forms.Button() + Me.cmdYmd = New System.Windows.Forms.Button() + Me.cmdLeap = New System.Windows.Forms.Button() Me.grpBasic.SuspendLayout Me.grpDates.SuspendLayout Me.ContextMenuStripDate.SuspendLayout @@ -925,7 +930,11 @@ Partial Class ucrCalculator ' 'grpDates ' - Me.grpDates.Controls.Add(Me.cmdRHelp) + Me.grpDates.Controls.Add(Me.cmdYmdHms) + Me.grpDates.Controls.Add(Me.cmdYmdHm) + Me.grpDates.Controls.Add(Me.cmdAsDate) + Me.grpDates.Controls.Add(Me.cmdAsTime) + Me.grpDates.Controls.Add(Me.cmdYmdH) Me.grpDates.Controls.Add(Me.cmdPm) Me.grpDates.Controls.Add(Me.cmdTime) Me.grpDates.Controls.Add(Me.cmdDateTime) @@ -934,7 +943,7 @@ Partial Class ucrCalculator Me.grpDates.Controls.Add(Me.cmdAm) Me.grpDates.Controls.Add(Me.cmdSec) Me.grpDates.Controls.Add(Me.cmdHour) - Me.grpDates.Controls.Add(Me.cmdminutes) + Me.grpDates.Controls.Add(Me.cmdMinutes) Me.grpDates.Controls.Add(Me.cmdDmy) Me.grpDates.Controls.Add(Me.cmdDay) Me.grpDates.Controls.Add(Me.cmdMonth) @@ -945,10 +954,11 @@ Partial Class ucrCalculator Me.grpDates.Controls.Add(Me.cmdMdy) Me.grpDates.Controls.Add(Me.cmdYmd) Me.grpDates.Controls.Add(Me.cmdLeap) + Me.grpDates.Controls.Add(Me.cmdRHelp) Me.grpDates.Location = New System.Drawing.Point(542, 78) Me.grpDates.Name = "grpDates" Me.grpDates.RightToLeft = System.Windows.Forms.RightToLeft.No - Me.grpDates.Size = New System.Drawing.Size(305, 205) + Me.grpDates.Size = New System.Drawing.Size(315, 275) Me.grpDates.TabIndex = 188 Me.grpDates.TabStop = False Me.grpDates.Text = "Dates/Times" @@ -957,7 +967,7 @@ Partial Class ucrCalculator ' Me.cmdRHelp.AutoSize = True Me.cmdRHelp.ContextMenuStrip = Me.ContextMenuStripDate - Me.cmdRHelp.Location = New System.Drawing.Point(186, 164) + Me.cmdRHelp.Location = New System.Drawing.Point(196, 238) Me.cmdRHelp.Name = "cmdRHelp" Me.cmdRHelp.Size = New System.Drawing.Size(113, 38) Me.cmdRHelp.SplitMenuStrip = Me.ContextMenuStripDate @@ -984,210 +994,6 @@ Partial Class ucrCalculator Me.DateHmsToolStripMenuItem.Size = New System.Drawing.Size(138, 24) Me.DateHmsToolStripMenuItem.Text = "hms" ' - 'cmdPm - ' - Me.cmdPm.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdPm.Location = New System.Drawing.Point(5, 162) - Me.cmdPm.Name = "cmdPm" - Me.cmdPm.Size = New System.Drawing.Size(75, 38) - Me.cmdPm.TabIndex = 161 - Me.cmdPm.Text = "pm" - Me.cmdPm.UseVisualStyleBackColor = True - ' - 'cmdTime - ' - Me.cmdTime.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdTime.Location = New System.Drawing.Point(152, 18) - Me.cmdTime.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdTime.Name = "cmdTime" - Me.cmdTime.Size = New System.Drawing.Size(75, 38) - Me.cmdTime.TabIndex = 160 - Me.cmdTime.Text = "time" - Me.cmdTime.UseVisualStyleBackColor = True - ' - 'cmdDateTime - ' - Me.cmdDateTime.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdDateTime.Location = New System.Drawing.Point(78, 18) - Me.cmdDateTime.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdDateTime.Name = "cmdDateTime" - Me.cmdDateTime.Size = New System.Drawing.Size(75, 38) - Me.cmdDateTime.TabIndex = 159 - Me.cmdDateTime.Text = "datetime" - Me.cmdDateTime.UseVisualStyleBackColor = True - ' - 'cmdQuarter - ' - Me.cmdQuarter.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdQuarter.Location = New System.Drawing.Point(78, 162) - Me.cmdQuarter.Name = "cmdQuarter" - Me.cmdQuarter.Size = New System.Drawing.Size(75, 38) - Me.cmdQuarter.TabIndex = 157 - Me.cmdQuarter.Text = "quarter" - Me.cmdQuarter.UseVisualStyleBackColor = True - ' - 'cmdD_In_M - ' - Me.cmdD_In_M.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdD_In_M.Location = New System.Drawing.Point(78, 53) - Me.cmdD_In_M.Name = "cmdD_In_M" - Me.cmdD_In_M.Size = New System.Drawing.Size(75, 38) - Me.cmdD_In_M.TabIndex = 156 - Me.cmdD_In_M.Text = "d_in_m" - Me.cmdD_In_M.UseVisualStyleBackColor = True - ' - 'cmdAm - ' - Me.cmdAm.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdAm.Location = New System.Drawing.Point(227, 127) - Me.cmdAm.Name = "cmdAm" - Me.cmdAm.Size = New System.Drawing.Size(75, 38) - Me.cmdAm.TabIndex = 155 - Me.cmdAm.Text = "am" - Me.cmdAm.UseVisualStyleBackColor = True - ' - 'cmdSec - ' - Me.cmdSec.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdSec.Location = New System.Drawing.Point(152, 127) - Me.cmdSec.Name = "cmdSec" - Me.cmdSec.Size = New System.Drawing.Size(75, 38) - Me.cmdSec.TabIndex = 154 - Me.cmdSec.Text = "sec" - Me.cmdSec.UseVisualStyleBackColor = True - ' - 'cmdHour - ' - Me.cmdHour.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdHour.Location = New System.Drawing.Point(5, 127) - Me.cmdHour.Name = "cmdHour" - Me.cmdHour.Size = New System.Drawing.Size(75, 38) - Me.cmdHour.TabIndex = 153 - Me.cmdHour.Text = "hour" - Me.cmdHour.UseVisualStyleBackColor = True - ' - 'cmdminutes - ' - Me.cmdminutes.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdminutes.Location = New System.Drawing.Point(78, 127) - Me.cmdminutes.Name = "cmdminutes" - Me.cmdminutes.Size = New System.Drawing.Size(75, 38) - Me.cmdminutes.TabIndex = 152 - Me.cmdminutes.Text = "min" - Me.cmdminutes.UseVisualStyleBackColor = True - ' - 'cmdDmy - ' - Me.cmdDmy.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdDmy.Location = New System.Drawing.Point(78, 90) - Me.cmdDmy.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdDmy.Name = "cmdDmy" - Me.cmdDmy.Size = New System.Drawing.Size(75, 38) - Me.cmdDmy.TabIndex = 151 - Me.cmdDmy.Tag = "dmy" - Me.cmdDmy.Text = "dmy" - Me.cmdDmy.UseVisualStyleBackColor = True - ' - 'cmdDay - ' - Me.cmdDay.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdDay.Location = New System.Drawing.Point(5, 53) - Me.cmdDay.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdDay.Name = "cmdDay" - Me.cmdDay.Size = New System.Drawing.Size(75, 38) - Me.cmdDay.TabIndex = 145 - Me.cmdDay.Text = "day" - Me.cmdDay.UseVisualStyleBackColor = True - ' - 'cmdMonth - ' - Me.cmdMonth.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdMonth.Location = New System.Drawing.Point(5, 53) - Me.cmdMonth.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdMonth.Name = "cmdMonth" - Me.cmdMonth.RightToLeft = System.Windows.Forms.RightToLeft.No - Me.cmdMonth.Size = New System.Drawing.Size(75, 38) - Me.cmdMonth.TabIndex = 144 - Me.cmdMonth.Text = "month" - Me.cmdMonth.UseVisualStyleBackColor = True - ' - 'cmdYear - ' - Me.cmdYear.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdYear.Location = New System.Drawing.Point(227, 18) - Me.cmdYear.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdYear.Name = "cmdYear" - Me.cmdYear.Size = New System.Drawing.Size(75, 38) - Me.cmdYear.TabIndex = 143 - Me.cmdYear.Text = "year" - Me.cmdYear.UseVisualStyleBackColor = True - ' - 'cmdDate - ' - Me.cmdDate.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdDate.Location = New System.Drawing.Point(5, 18) - Me.cmdDate.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdDate.Name = "cmdDate" - Me.cmdDate.Size = New System.Drawing.Size(75, 38) - Me.cmdDate.TabIndex = 142 - Me.cmdDate.Text = "date" - Me.cmdDate.UseVisualStyleBackColor = True - ' - 'cmdYday - ' - Me.cmdYday.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdYday.Location = New System.Drawing.Point(227, 53) - Me.cmdYday.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdYday.Name = "cmdYday" - Me.cmdYday.Size = New System.Drawing.Size(75, 38) - Me.cmdYday.TabIndex = 141 - Me.cmdYday.Text = "yday" - Me.cmdYday.UseVisualStyleBackColor = True - ' - 'cmdWday - ' - Me.cmdWday.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdWday.Location = New System.Drawing.Point(152, 53) - Me.cmdWday.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdWday.Name = "cmdWday" - Me.cmdWday.Size = New System.Drawing.Size(75, 38) - Me.cmdWday.TabIndex = 140 - Me.cmdWday.Text = "wday" - Me.cmdWday.UseVisualStyleBackColor = True - ' - 'cmdMdy - ' - Me.cmdMdy.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdMdy.Location = New System.Drawing.Point(152, 90) - Me.cmdMdy.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdMdy.Name = "cmdMdy" - Me.cmdMdy.Size = New System.Drawing.Size(75, 38) - Me.cmdMdy.TabIndex = 139 - Me.cmdMdy.Text = "mdy" - Me.cmdMdy.UseVisualStyleBackColor = True - ' - 'cmdYmd - ' - Me.cmdYmd.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdYmd.Location = New System.Drawing.Point(5, 90) - Me.cmdYmd.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdYmd.Name = "cmdYmd" - Me.cmdYmd.Size = New System.Drawing.Size(75, 38) - Me.cmdYmd.TabIndex = 138 - Me.cmdYmd.Text = "ymd" - Me.cmdYmd.UseVisualStyleBackColor = True - ' - 'cmdLeap - ' - Me.cmdLeap.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdLeap.Location = New System.Drawing.Point(227, 90) - Me.cmdLeap.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdLeap.Name = "cmdLeap" - Me.cmdLeap.Size = New System.Drawing.Size(75, 38) - Me.cmdLeap.TabIndex = 136 - Me.cmdLeap.Text = "leap" - Me.cmdLeap.UseVisualStyleBackColor = True - ' 'ContextMenuStripComplex ' Me.ContextMenuStripComplex.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -7357,6 +7163,260 @@ Partial Class ucrCalculator Me.ucrReceiverForCalculation.TabIndex = 120 Me.ucrReceiverForCalculation.ucrSelector = Nothing ' + 'cmdYmdHms + ' + Me.cmdYmdHms.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdYmdHms.Location = New System.Drawing.Point(6, 91) + Me.cmdYmdHms.Name = "cmdYmdHms" + Me.cmdYmdHms.Size = New System.Drawing.Size(75, 38) + Me.cmdYmdHms.TabIndex = 242 + Me.cmdYmdHms.Text = "ymd.hms" + Me.cmdYmdHms.UseVisualStyleBackColor = True + ' + 'cmdYmdHm + ' + Me.cmdYmdHm.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdYmdHm.Location = New System.Drawing.Point(78, 91) + Me.cmdYmdHm.Name = "cmdYmdHm" + Me.cmdYmdHm.Size = New System.Drawing.Size(75, 38) + Me.cmdYmdHm.TabIndex = 241 + Me.cmdYmdHm.Text = "ymd.hm" + Me.cmdYmdHm.UseVisualStyleBackColor = True + ' + 'cmdAsDate + ' + Me.cmdAsDate.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdAsDate.Location = New System.Drawing.Point(78, 19) + Me.cmdAsDate.Name = "cmdAsDate" + Me.cmdAsDate.Size = New System.Drawing.Size(75, 38) + Me.cmdAsDate.TabIndex = 240 + Me.cmdAsDate.Text = "as.date" + Me.cmdAsDate.UseVisualStyleBackColor = True + ' + 'cmdAsTime + ' + Me.cmdAsTime.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdAsTime.Location = New System.Drawing.Point(233, 55) + Me.cmdAsTime.Name = "cmdAsTime" + Me.cmdAsTime.Size = New System.Drawing.Size(75, 38) + Me.cmdAsTime.TabIndex = 239 + Me.cmdAsTime.Text = "as.time" + Me.cmdAsTime.UseVisualStyleBackColor = True + ' + 'cmdYmdH + ' + Me.cmdYmdH.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdYmdH.Location = New System.Drawing.Point(150, 91) + Me.cmdYmdH.Name = "cmdYmdH" + Me.cmdYmdH.Size = New System.Drawing.Size(86, 38) + Me.cmdYmdH.TabIndex = 238 + Me.cmdYmdH.Text = "ymd.h" + Me.cmdYmdH.UseVisualStyleBackColor = True + ' + 'cmdPm + ' + Me.cmdPm.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdPm.Location = New System.Drawing.Point(6, 198) + Me.cmdPm.Name = "cmdPm" + Me.cmdPm.Size = New System.Drawing.Size(75, 38) + Me.cmdPm.TabIndex = 237 + Me.cmdPm.Text = "pm" + Me.cmdPm.UseVisualStyleBackColor = True + ' + 'cmdTime + ' + Me.cmdTime.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdTime.Location = New System.Drawing.Point(233, 19) + Me.cmdTime.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdTime.Name = "cmdTime" + Me.cmdTime.Size = New System.Drawing.Size(75, 38) + Me.cmdTime.TabIndex = 236 + Me.cmdTime.Text = "time" + Me.cmdTime.UseVisualStyleBackColor = True + ' + 'cmdDateTime + ' + Me.cmdDateTime.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdDateTime.Location = New System.Drawing.Point(150, 19) + Me.cmdDateTime.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdDateTime.Name = "cmdDateTime" + Me.cmdDateTime.Size = New System.Drawing.Size(86, 38) + Me.cmdDateTime.TabIndex = 235 + Me.cmdDateTime.Text = "as.datetime" + Me.cmdDateTime.UseVisualStyleBackColor = True + ' + 'cmdQuarter + ' + Me.cmdQuarter.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdQuarter.Location = New System.Drawing.Point(78, 127) + Me.cmdQuarter.Name = "cmdQuarter" + Me.cmdQuarter.Size = New System.Drawing.Size(75, 38) + Me.cmdQuarter.TabIndex = 234 + Me.cmdQuarter.Text = "quarter" + Me.cmdQuarter.UseVisualStyleBackColor = True + ' + 'cmdD_In_M + ' + Me.cmdD_In_M.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdD_In_M.Location = New System.Drawing.Point(150, 162) + Me.cmdD_In_M.Name = "cmdD_In_M" + Me.cmdD_In_M.Size = New System.Drawing.Size(86, 38) + Me.cmdD_In_M.TabIndex = 233 + Me.cmdD_In_M.Text = "d_in_m" + Me.cmdD_In_M.UseVisualStyleBackColor = True + ' + 'cmdAm + ' + Me.cmdAm.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdAm.Location = New System.Drawing.Point(233, 162) + Me.cmdAm.Name = "cmdAm" + Me.cmdAm.Size = New System.Drawing.Size(75, 38) + Me.cmdAm.TabIndex = 232 + Me.cmdAm.Text = "am" + Me.cmdAm.UseVisualStyleBackColor = True + ' + 'cmdSec + ' + Me.cmdSec.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdSec.Location = New System.Drawing.Point(233, 198) + Me.cmdSec.Name = "cmdSec" + Me.cmdSec.Size = New System.Drawing.Size(75, 38) + Me.cmdSec.TabIndex = 231 + Me.cmdSec.Text = "sec" + Me.cmdSec.UseVisualStyleBackColor = True + ' + 'cmdHour + ' + Me.cmdHour.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdHour.Location = New System.Drawing.Point(78, 198) + Me.cmdHour.Name = "cmdHour" + Me.cmdHour.Size = New System.Drawing.Size(75, 38) + Me.cmdHour.TabIndex = 230 + Me.cmdHour.Text = "hour" + Me.cmdHour.UseVisualStyleBackColor = True + ' + 'cmdMinutes + ' + Me.cmdMinutes.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdMinutes.Location = New System.Drawing.Point(150, 198) + Me.cmdMinutes.Name = "cmdMinutes" + Me.cmdMinutes.Size = New System.Drawing.Size(86, 38) + Me.cmdMinutes.TabIndex = 229 + Me.cmdMinutes.Text = "min" + Me.cmdMinutes.UseVisualStyleBackColor = True + ' + 'cmdDmy + ' + Me.cmdDmy.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdDmy.Location = New System.Drawing.Point(78, 55) + Me.cmdDmy.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdDmy.Name = "cmdDmy" + Me.cmdDmy.Size = New System.Drawing.Size(75, 38) + Me.cmdDmy.TabIndex = 228 + Me.cmdDmy.Tag = "dmy" + Me.cmdDmy.Text = "dmy" + Me.cmdDmy.UseVisualStyleBackColor = True + ' + 'cmdDay + ' + Me.cmdDay.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdDay.Location = New System.Drawing.Point(233, 126) + Me.cmdDay.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdDay.Name = "cmdDay" + Me.cmdDay.Size = New System.Drawing.Size(75, 38) + Me.cmdDay.TabIndex = 227 + Me.cmdDay.Text = "day" + Me.cmdDay.UseVisualStyleBackColor = True + ' + 'cmdMonth + ' + Me.cmdMonth.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdMonth.Location = New System.Drawing.Point(150, 127) + Me.cmdMonth.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdMonth.Name = "cmdMonth" + Me.cmdMonth.RightToLeft = System.Windows.Forms.RightToLeft.No + Me.cmdMonth.Size = New System.Drawing.Size(86, 38) + Me.cmdMonth.TabIndex = 226 + Me.cmdMonth.Text = "month" + Me.cmdMonth.UseVisualStyleBackColor = True + ' + 'cmdYear + ' + Me.cmdYear.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdYear.Location = New System.Drawing.Point(6, 127) + Me.cmdYear.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdYear.Name = "cmdYear" + Me.cmdYear.Size = New System.Drawing.Size(75, 38) + Me.cmdYear.TabIndex = 225 + Me.cmdYear.Text = "year" + Me.cmdYear.UseVisualStyleBackColor = True + ' + 'cmdDate + ' + Me.cmdDate.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdDate.Location = New System.Drawing.Point(6, 19) + Me.cmdDate.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdDate.Name = "cmdDate" + Me.cmdDate.Size = New System.Drawing.Size(75, 38) + Me.cmdDate.TabIndex = 224 + Me.cmdDate.Text = "date" + Me.cmdDate.UseVisualStyleBackColor = True + ' + 'cmdYday + ' + Me.cmdYday.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdYday.Location = New System.Drawing.Point(6, 163) + Me.cmdYday.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdYday.Name = "cmdYday" + Me.cmdYday.Size = New System.Drawing.Size(75, 38) + Me.cmdYday.TabIndex = 223 + Me.cmdYday.Text = "yday" + Me.cmdYday.UseVisualStyleBackColor = True + ' + 'cmdWday + ' + Me.cmdWday.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdWday.Location = New System.Drawing.Point(77, 163) + Me.cmdWday.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdWday.Name = "cmdWday" + Me.cmdWday.Size = New System.Drawing.Size(75, 38) + Me.cmdWday.TabIndex = 222 + Me.cmdWday.Text = "wday" + Me.cmdWday.UseVisualStyleBackColor = True + ' + 'cmdMdy + ' + Me.cmdMdy.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdMdy.Location = New System.Drawing.Point(150, 55) + Me.cmdMdy.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdMdy.Name = "cmdMdy" + Me.cmdMdy.Size = New System.Drawing.Size(86, 38) + Me.cmdMdy.TabIndex = 221 + Me.cmdMdy.Text = "mdy" + Me.cmdMdy.UseVisualStyleBackColor = True + ' + 'cmdYmd + ' + Me.cmdYmd.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdYmd.Location = New System.Drawing.Point(6, 55) + Me.cmdYmd.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdYmd.Name = "cmdYmd" + Me.cmdYmd.Size = New System.Drawing.Size(75, 38) + Me.cmdYmd.TabIndex = 220 + Me.cmdYmd.Text = "ymd" + Me.cmdYmd.UseVisualStyleBackColor = True + ' + 'cmdLeap + ' + Me.cmdLeap.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdLeap.Location = New System.Drawing.Point(234, 91) + Me.cmdLeap.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdLeap.Name = "cmdLeap" + Me.cmdLeap.Size = New System.Drawing.Size(75, 38) + Me.cmdLeap.TabIndex = 219 + Me.cmdLeap.Text = "leap" + Me.cmdLeap.UseVisualStyleBackColor = True + ' 'ucrCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(120.0!, 120.0!) @@ -7374,7 +7434,6 @@ Partial Class ucrCalculator Me.Controls.Add(Me.ucrReceiverForCalculation) Me.Controls.Add(Me.lblExpression) Me.Controls.Add(Me.grpSymbols) - Me.Controls.Add(Me.grpModifier) Me.Controls.Add(Me.grpDates) Me.Controls.Add(Me.grpHydroGOF) Me.Controls.Add(Me.grpFactor) @@ -7389,6 +7448,7 @@ Partial Class ucrCalculator Me.Controls.Add(Me.grpSummary) Me.Controls.Add(Me.grpTransform) Me.Controls.Add(Me.grpLogical) + Me.Controls.Add(Me.grpModifier) Me.Name = "ucrCalculator" Me.Size = New System.Drawing.Size(1123, 572) Me.grpBasic.ResumeLayout(False) @@ -7465,16 +7525,6 @@ Partial Class ucrCalculator Friend WithEvents cmd0 As Button Friend WithEvents cmd1 As Button Friend WithEvents grpDates As GroupBox - Friend WithEvents cmdDmy As Button - Friend WithEvents cmdDay As Button - Friend WithEvents cmdMonth As Button - Friend WithEvents cmdYear As Button - Friend WithEvents cmdDate As Button - Friend WithEvents cmdYday As Button - Friend WithEvents cmdWday As Button - Friend WithEvents cmdMdy As Button - Friend WithEvents cmdYmd As Button - Friend WithEvents cmdLeap As Button Friend WithEvents grpTransform As GroupBox Friend WithEvents cmdCumSum As Button Friend WithEvents cmdCumMin As Button @@ -7670,12 +7720,6 @@ Partial Class ucrCalculator Friend WithEvents cmdLogistic As Button Friend WithEvents cmdLogit As Button Friend WithEvents cmdAtan2 As Button - Friend WithEvents cmdQuarter As Button - Friend WithEvents cmdD_In_M As Button - Friend WithEvents cmdAm As Button - Friend WithEvents cmdSec As Button - Friend WithEvents cmdHour As Button - Friend WithEvents cmdminutes As Button Friend WithEvents grpCircular As GroupBox Friend WithEvents cmdCircMedian As Button Friend WithEvents cmdCircMean As Button @@ -7790,9 +7834,6 @@ Partial Class ucrCalculator Friend WithEvents cmdSsq As Button Friend WithEvents cmdRsr As Button Friend WithEvents ucrSaveResultInto As ucrSave - Friend WithEvents cmdTime As Button - Friend WithEvents cmdDateTime As Button - Friend WithEvents cmdPm As Button Friend WithEvents cmdLenth As Button Friend WithEvents cmdGlue As Button Friend WithEvents cmdTrunck As Button @@ -8027,4 +8068,28 @@ Partial Class ucrCalculator Friend WithEvents MathsCircularToolStripMenuItem As ToolStripMenuItem Friend WithEvents cmdComplexi As Button Friend WithEvents cmdAsComplex As Button + Friend WithEvents cmdYmdHms As Button + Friend WithEvents cmdYmdHm As Button + Friend WithEvents cmdAsDate As Button + Friend WithEvents cmdAsTime As Button + Friend WithEvents cmdYmdH As Button + Friend WithEvents cmdPm As Button + Friend WithEvents cmdTime As Button + Friend WithEvents cmdDateTime As Button + Friend WithEvents cmdQuarter As Button + Friend WithEvents cmdD_In_M As Button + Friend WithEvents cmdAm As Button + Friend WithEvents cmdSec As Button + Friend WithEvents cmdHour As Button + Friend WithEvents cmdMinutes As Button + Friend WithEvents cmdDmy As Button + Friend WithEvents cmdDay As Button + Friend WithEvents cmdMonth As Button + Friend WithEvents cmdYear As Button + Friend WithEvents cmdDate As Button + Friend WithEvents cmdYday As Button + Friend WithEvents cmdWday As Button + Friend WithEvents cmdMdy As Button + Friend WithEvents cmdYmd As Button + Friend WithEvents cmdLeap As Button End Class diff --git a/instat/ucrCalculator.vb b/instat/ucrCalculator.vb index d06fd9b9e64..6d759e7ea0f 100644 --- a/instat/ucrCalculator.vb +++ b/instat/ucrCalculator.vb @@ -1525,7 +1525,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdYear_Click(sender As Object, e As EventArgs) Handles cmdYear.Click + Private Sub cmdYear_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::year(x= )", 1) Else @@ -1533,7 +1533,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdMonth_Click(sender As Object, e As EventArgs) Handles cmdMonth.Click + Private Sub cmdMonth_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::month(x= , label=FALSE, abbr=TRUE)", 25) Else @@ -1541,7 +1541,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdDay_Click(sender As Object, e As EventArgs) Handles cmdDay.Click + Private Sub cmdDay_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::day(x= )", 1) Else @@ -1549,7 +1549,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdWday_Click(sender As Object, e As EventArgs) Handles cmdWday.Click + Private Sub cmdWday_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::wday(x= , label=FALSE, abbr=TRUE)", 25) Else @@ -1557,7 +1557,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdYday_Click(sender As Object, e As EventArgs) Handles cmdYday.Click + Private Sub cmdYday_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::yday(x= )", 1) Else @@ -1565,7 +1565,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdDate_Click(sender As Object, e As EventArgs) Handles cmdDate.Click + Private Sub cmdDate_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::date(x= )", 1) Else @@ -1573,7 +1573,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdLeap_Click(sender As Object, e As EventArgs) Handles cmdLeap.Click + Private Sub cmdLeap_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::leap_year(x= )", 1) Else @@ -1581,7 +1581,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdYmd_Click(sender As Object, e As EventArgs) Handles cmdYmd.Click + Private Sub cmdYmd_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd(x= )", 1) Else @@ -1589,14 +1589,14 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdMdy_Click(sender As Object, e As EventArgs) Handles cmdMdy.Click + Private Sub cmdMdy_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::mdy(x= )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::mdy()", 1) End If End Sub - Private Sub cmdDmy_Click(sender As Object, e As EventArgs) Handles cmdDmy.Click + Private Sub cmdDmy_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::dmy(x= )", 1) Else @@ -1605,42 +1605,42 @@ Public Class ucrCalculator End Sub - Private Sub cmdHour_Click(sender As Object, e As EventArgs) Handles cmdHour.Click + Private Sub cmdHour_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::hour(x = )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::hour()", 1) End If End Sub - Private Sub cmdMinutes_Click(sender As Object, e As EventArgs) Handles cmdminutes.Click + Private Sub cmdMinutes_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::minute(x = )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::minute()", 1) End If End Sub - Private Sub cmdSec_Click(sender As Object, e As EventArgs) Handles cmdSec.Click + Private Sub cmdSec_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::second(x = )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::second()", 1) End If End Sub - Private Sub cmdAm_Click(sender As Object, e As EventArgs) Handles cmdAm.Click + Private Sub cmdAm_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::am(x = )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::am()", 1) End If End Sub - Private Sub cmdD_In_M_Click(sender As Object, e As EventArgs) Handles cmdD_In_M.Click + Private Sub cmdD_In_M_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::days_in_month(x = )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::days_in_month()", 1) End If End Sub - Private Sub cmdQuarter_Click(sender As Object, e As EventArgs) Handles cmdQuarter.Click + Private Sub cmdQuarter_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::quarter(x =, with_year = FALSE, fiscal_start = 1 )", 39) Else @@ -4083,7 +4083,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdDateTime_Click(sender As Object, e As EventArgs) Handles cmdDateTime.Click + Private Sub cmdDateTime_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::as_datetime(x = )", 2) Else @@ -4091,7 +4091,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdTime_Click(sender As Object, e As EventArgs) Handles cmdTime.Click + Private Sub cmdTime_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::hms(seconds = , minutes = , hours = , days = )", 32) Else @@ -4099,7 +4099,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdPm_Click(sender As Object, e As EventArgs) Handles cmdPm.Click + Private Sub cmdPm_Click(sender As Object, e As EventArgs) If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::pm(x = )", 2) Else @@ -5536,4 +5536,24 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition("as.complex( )", 1) End If End Sub + + Private Sub cmdYmdHms_Click(sender As Object, e As EventArgs) + + End Sub + + Private Sub cmdYmdHm_Click(sender As Object, e As EventArgs) + + End Sub + + Private Sub cmdAsDate_Click(sender As Object, e As EventArgs) + + End Sub + + Private Sub cmdAsTime_Click(sender As Object, e As EventArgs) + + End Sub + + Private Sub cmdYmdH_Click(sender As Object, e As EventArgs) + + End Sub End Class From 401c2a90d847bd57d9e525db6cf4ad29c49a82a7 Mon Sep 17 00:00:00 2001 From: JUMA Date: Thu, 28 Mar 2024 16:10:10 +0300 Subject: [PATCH 66/88] chng --- instat/ucrCalculator.vb | 514 +++++++++++++++++++++------------------- 1 file changed, 266 insertions(+), 248 deletions(-) diff --git a/instat/ucrCalculator.vb b/instat/ucrCalculator.vb index 6d759e7ea0f..ea93b2a93db 100644 --- a/instat/ucrCalculator.vb +++ b/instat/ucrCalculator.vb @@ -1,4 +1,4 @@ -'R- Instat +' R- Instat ' Copyright (C) 2015-2017 ' ' This program is free software: you can redistribute it and/or modify @@ -73,35 +73,35 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdRound, "round(x) to round to whole numbers, round(x,2) to round to 2 decimal places, round(x,-2) to round to the nearest 100") ttCalculator.SetToolTip(cmdSiginf, "signif(x,3) to round to 3 significant figures") - ttCalculator.SetToolTip(cmdSortF, "sorts a vector into ascending or descending order. For example sort(c(5,7,4,4,3)) = (3,4,4,5,7)") - ttCalculator.SetToolTip(cmdScale, "centre and scale the data - usually by producing (x - xbar)/s") - ttCalculator.SetToolTip(cmdMASSFractions, "changes decimal data into a character variable with fractions. So 1.5 becomes 3/2, 0.25 becomes 1/4 etc.") - ttCalculator.SetToolTip(cmdDecimals, "the inverse of the fractions key. So 3/2 becomes 1.5, 1/4 becomes 0.25 etc.") - ttCalculator.SetToolTip(cmdLag, "shift a variable down. For example lag(1:5) = (NA,1,2,3,4); lag(1:5,3) = (NA,NA,NA, 1,2)") - ttCalculator.SetToolTip(cmdLead, "shift a variable up. For example lead(1:5) = (2,3,4,5,NA); lead(1:5;3) = (4,5, NA,NA,NA)") - ttCalculator.SetToolTip(cmdDiff, "difference between successive elements. For example diff(c(1,4,3,7)) = (NA 3,-1,4)") - ttCalculator.SetToolTip(cmdRev, "reverse a variable. For example rev(c(1,2,3,4,5)) =(5,4,3,2,1)") - ttCalculator.SetToolTip(cmdPMax, " maximum of a set of variables. For examples pmax(c(1,3,5),c(6,4,2)) = (6,4,5)") - ttCalculator.SetToolTip(cmdPMin, "minimum of a set of variables. For examples pmin(c(1,3,5),c(6,4,2)) = (1,3,2)") - ttCalculator.SetToolTip(cmdCumMax, "cumulative maxima. For example cummax(c(3,2,1,4,0)) = (3,3,3,4,4)") - ttCalculator.SetToolTip(cmdMovMax, "moving (or rolling) maxima. For example rollmax(x=c(3,2,1,4,0) ,3,fill=NA, align=""right"") = (NA,NA, 3,4,4)") - ttCalculator.SetToolTip(cmdCumSum, "cumulative sums. For example cumsum(c(3,2,1,4,0)) = (3,5,6,10,10)") - ttCalculator.SetToolTip(cmdCumProd, "cumulative products. For example cumprod(c(2,3,5,7)) = (2,6,30,210)") - ttCalculator.SetToolTip(cmdMovProd, "moving products Fror example rollapply(c(2,3,5,7,11),width=3,fill=NA, FUN=prod) = (NA,30,105,385,NA)") - ttCalculator.SetToolTip(cmdCumMean, "cumulative means. For example cummean(c(3,2,1,4,0)) = (3,2.5,2,2.5,2)") - ttCalculator.SetToolTip(cmdCumMin, "cumulative minima. For example cummin(c(3,2,1,4,0)) = (3,2.,1,1,0)") - ttCalculator.SetToolTip(cmdMovSum, "moving (or rolling) totals. For example rollsum(c(3,2,1,4,0) ,3,fill=NA, align=""left"") = (6,7,5,NA,NA)") - ttCalculator.SetToolTip(cmdMovMean, "moving (or rolling) mean. For example rollmean(c(3,2,1,6,2) ,3,fill=NA) = (NA,2,3,3,NA)") - ttCalculator.SetToolTip(cmMovMed, "moving (or rolling) medians. For example rollmedian(c(3,2,1,6,2) ,3,fill=NA) = (NA,2,2,2,NA)") - ttCalculator.SetToolTip(cmdMovmin, "moving (or rolling) minima. For example rollapply(c(3,2,1,6,2),width=3,fill=NA, FUN=min) = (NA,1,1,1,NA)") - ttCalculator.SetToolTip(cmdNtile, " use ranks to divide into (almost) equal sized groups. For example ntile(c(15,11,13,12,NA,12),2) = (2,1,2,1,NA,1)") - ttCalculator.SetToolTip(cmdCumdist, "proportion of values less than or equal to the current rank. For example cume_dist(c(2,4,6,8,3)) = (0.2, 0.6, 0.8, 1.0, 0.4)") - ttCalculator.SetToolTip(cmdRowRank, "row numbers as ranks. For example :row_number(c(15,11,13,12,NA,12)) = (5,1,3,2,NA,3)") - ttCalculator.SetToolTip(cmdPercentRank, "rescale of minimum ranks to [0,1]. For example percent_rank(c(15,11,13,12,NA,12)) = (1,0,0.75,0.25,NA,0.25)") - ttCalculator.SetToolTip(cmdDRank, "dense ranks. For example d_rank(c(15,11,13,12,NA,12)) = (4,1,3,2,NA,2)") - ttCalculator.SetToolTip(cmdMRank, " minimum ranks. For example m_rank(c(15,11,13,12,NA,12)) = (5,1,4,2,NA,2)") - ttCalculator.SetToolTip(cmdNafill, "fills missing values at the start, middle and end. For example na.fill(c(NA,2,NA,4,5,NA),fill=""extend"") = (2,2,3,4,5,5); while fill=c(15,""extend"",NA) = (15,2,3,4,5,NA)") - ttCalculator.SetToolTip(cmdNaapprox, "linear interpolation of missing values. For example na.approx(c(5,NA,NA,2,2,NA,4,7,NA),maxgap=1,na.rm=FALSE) = (5,NA,NA,2,2,3,4,7,NA)") + ttCalculator.SetToolTip(cmdSortF, "Sorts a vector into ascending or descending order. For example sort(c(5,7,4,4,3)) = (3,4,4,5,7)") + ttCalculator.SetToolTip(cmdScale, "Centre and scale the data - usually by producing (x - xbar)/s") + ttCalculator.SetToolTip(cmdMASSFractions, "Changes decimal data into a character variable with fractions. So 1.5 becomes 3/2, 0.25 becomes 1/4 etc.") + ttCalculator.SetToolTip(cmdDecimals, "The inverse of the fractions key. So 3/2 becomes 1.5, 1/4 becomes 0.25 etc.") + ttCalculator.SetToolTip(cmdLag, "Shift a variable down. For example lag(1:5) = (NA,1,2,3,4); lag(1:5,3) = (NA,NA,NA, 1,2)") + ttCalculator.SetToolTip(cmdLead, "Shift a variable up. For example lead(1:5) = (2,3,4,5,NA); lead(1:5;3) = (4,5, NA,NA,NA)") + ttCalculator.SetToolTip(cmdDiff, "Difference between successive elements. For example diff(c(1,4,3,7)) = (NA 3,-1,4)") + ttCalculator.SetToolTip(cmdRev, "Reverse a variable. For example rev(c(1,2,3,4,5)) =(5,4,3,2,1)") + ttCalculator.SetToolTip(cmdPMax, " Maximum of a set of variables. For examples pmax(c(1,3,5),c(6,4,2)) = (6,4,5)") + ttCalculator.SetToolTip(cmdPMin, "Minimum of a set of variables. For examples pmin(c(1,3,5),c(6,4,2)) = (1,3,2)") + ttCalculator.SetToolTip(cmdCumMax, "Cumulative maxima. For example cummax(c(3,2,1,4,0)) = (3,3,3,4,4)") + ttCalculator.SetToolTip(cmdMovMax, "Moving (or rolling) maxima. For example rollmax(x=c(3,2,1,4,0) ,3,fill=NA, align=""right"") = (NA,NA, 3,4,4)") + ttCalculator.SetToolTip(cmdCumSum, "Cumulative sums. For example cumsum(c(3,2,1,4,0)) = (3,5,6,10,10)") + ttCalculator.SetToolTip(cmdCumProd, "Cumulative products. For example cumprod(c(2,3,5,7)) = (2,6,30,210)") + ttCalculator.SetToolTip(cmdMovProd, "Moving products Fror example rollapply(c(2,3,5,7,11),width=3,fill=NA, FUN=prod) = (NA,30,105,385,NA)") + ttCalculator.SetToolTip(cmdCumMean, "Cumulative means. For example cummean(c(3,2,1,4,0)) = (3,2.5,2,2.5,2)") + ttCalculator.SetToolTip(cmdCumMin, "Cumulative minima. For example cummin(c(3,2,1,4,0)) = (3,2.,1,1,0)") + ttCalculator.SetToolTip(cmdMovSum, "Moving (or rolling) totals. For example rollsum(c(3,2,1,4,0) ,3,fill=NA, align=""left"") = (6,7,5,NA,NA)") + ttCalculator.SetToolTip(cmdMovMean, "Moving (or rolling) mean. For example rollmean(c(3,2,1,6,2) ,3,fill=NA) = (NA,2,3,3,NA)") + ttCalculator.SetToolTip(cmMovMed, "Moving (or rolling) medians. For example rollmedian(c(3,2,1,6,2) ,3,fill=NA) = (NA,2,2,2,NA)") + ttCalculator.SetToolTip(cmdMovmin, "Moving (or rolling) minima. For example rollapply(c(3,2,1,6,2),width=3,fill=NA, FUN=min) = (NA,1,1,1,NA)") + ttCalculator.SetToolTip(cmdNtile, " Use ranks to divide into (almost) equal sized groups. For example ntile(c(15,11,13,12,NA,12),2) = (2,1,2,1,NA,1)") + ttCalculator.SetToolTip(cmdCumdist, "Proportion of values less than or equal to the current rank. For example cume_dist(c(2,4,6,8,3)) = (0.2, 0.6, 0.8, 1.0, 0.4)") + ttCalculator.SetToolTip(cmdRowRank, "Row numbers as ranks. For example :row_number(c(15,11,13,12,NA,12)) = (5,1,3,2,NA,3)") + ttCalculator.SetToolTip(cmdPercentRank, "Rescale of minimum ranks to [0,1]. For example percent_rank(c(15,11,13,12,NA,12)) = (1,0,0.75,0.25,NA,0.25)") + ttCalculator.SetToolTip(cmdDRank, "Dense ranks. For example d_rank(c(15,11,13,12,NA,12)) = (4,1,3,2,NA,2)") + ttCalculator.SetToolTip(cmdMRank, " Minimum ranks. For example m_rank(c(15,11,13,12,NA,12)) = (5,1,4,2,NA,2)") + ttCalculator.SetToolTip(cmdNafill, "Fills missing values at the start, middle and end. For example na.fill(c(NA,2,NA,4,5,NA),fill=""extend"") = (2,2,3,4,5,5); while fill=c(15,""extend"",NA) = (15,2,3,4,5,NA)") + ttCalculator.SetToolTip(cmdNaapprox, "Linear interpolation of missing values. For example na.approx(c(5,NA,NA,2,2,NA,4,7,NA),maxgap=1,na.rm=FALSE) = (5,NA,NA,2,2,3,4,7,NA)") ttCalculator.SetToolTip(cmdNasplin, "Spline interpolation of missing values. For example na.spline(c(NA,NA,NA,2,2,NA,4,7,NA),maxgap=2,na.rm=FALSE) = (NA,NA,NA,2,2,2.5,4,7,12)") ttCalculator.SetToolTip(cmdNaest, "Missing values as the mean (usually) overall or with a factor. For example na.aggregate(c(NA,NA,NA,2,2,NA,4,7,NA),maxgap=2,na.rm=FALSE) = (NA,NA,NA,2,2,3.75,4,7,3.75)") @@ -135,14 +135,14 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdPf, "F probabilities. For example pf(2,1,10) = 0.8123; pf(2,50,50) = 0.9921") ttCalculator.SetToolTip(cmdQnorm, "qnormal quantiles. For example qnorm(0.05) = -1.6449; qnorm(0.9772, 100,15) = 130") - ttCalculator.SetToolTip(cmdPbirth, "simultaneous birthday probabilities. For example pbirthday(10) = 0.1169 ; pbirthday(50) = 0.97") - ttCalculator.SetToolTip(cmdQbirth, "simultaneous birthday quantiles. For example qbirthday(0.5) = 23, qbirthday(0.99) = 57") - ttCalculator.SetToolTip(cmdPbinom, "binomial probabilities. For example pbinom(3,5,0.4) = 0.0.913") - ttCalculator.SetToolTip(cmdQbinom, " binomial quantiles. For example qbinom(0.9,5,0.4) = 3") + ttCalculator.SetToolTip(cmdPbirth, "Simultaneous birthday probabilities. For example pbirthday(10) = 0.1169 ; pbirthday(50) = 0.97") + ttCalculator.SetToolTip(cmdQbirth, "Simultaneous birthday quantiles. For example qbirthday(0.5) = 23, qbirthday(0.99) = 57") + ttCalculator.SetToolTip(cmdPbinom, "Binomial probabilities. For example pbinom(3,5,0.4) = 0.0.913") + ttCalculator.SetToolTip(cmdQbinom, " Binomial quantiles. For example qbinom(0.9,5,0.4) = 3") ttCalculator.SetToolTip(cmdPpois, "Poisson probabilities. For example ppois(8, 5) = 0.93") ttCalculator.SetToolTip(cmdQpois, "Poisson quantiles. For example qpois(0.9, 5) = 8") - ttCalculator.SetToolTip(cmdPnbin, "negative binomial probabilities. For example pnbinom(4,1,0.4) = 0.922 (geometric); pnbinom(13,5,0.4) = 0.9058") - ttCalculator.SetToolTip(cmdQnbin, "negative binomial quantiles. For example qnbinom(0.9,1,0.4) = 4 (geometric); qnbinom(0.9, 5,0.4) = 13") + ttCalculator.SetToolTip(cmdPnbin, "Negative binomial probabilities. For example pnbinom(4,1,0.4) = 0.922 (geometric); pnbinom(13,5,0.4) = 0.9058") + ttCalculator.SetToolTip(cmdQnbin, "Negative binomial quantiles. For example qnbinom(0.9,1,0.4) = 4 (geometric); qnbinom(0.9, 5,0.4) = 13") ttCalculator.SetToolTip(cmdFact, "factorial. For example factorial(4) = 4*3*2*1 = 24; factorial(3.5) = gamma(4.5) = 11.63") ttCalculator.SetToolTip(cmdLfact, "log factorial. For example lfactorial(400) = 2001") ttCalculator.SetToolTip(cmdChoose, "binomial coefficient. For example choose(7,4) = 7!/(4!*3!) = 35") @@ -178,12 +178,11 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdSin, "sine of angle in radians. For example sin(pi/2) = sin(rad(90)) = 1.") ttCalculator.SetToolTip(cmdAsin, "angle corresponding to a given sine (in the range (0 to pi). For example asin(1) = 1.57 = pi/2.") ttCalculator.SetToolTip(cmdFloor, "integer below the given value. For example floor(3.5)=3; floor(-3.5) = -4.") - ttCalculator.SetToolTip(cmdRad, "change from degrees to radians. For example rad(90) = 2*pi * 90/360 = 1.57 ( = pi/2)") + ttCalculator.SetToolTip(cmdRad, "Change from degrees to radians. For example rad(90) = 2*pi * 90/360 = 1.57 ( = pi/2)") ttCalculator.SetToolTip(cmdLogTen, "logarithm to base 10. For example log10(1000) =3 (=10^3)") ttCalculator.SetToolTip(cmdTan, " tangent of angle in radians. For example tan(pi/4) = sin(pi/4)/cos(pi/4) = tan(rad(45)) = 1") ttCalculator.SetToolTip(cmdAtan, "angle corresponding to a given tangent (in the range 0 to pi). For example atan(1) = 0.7854 (= pi/4); deg(atan(1)) = 45.") ttCalculator.SetToolTip(cmdTrunc, "truncates the values towards 0. So trunc(3.5) = 3, trunc(-3.5)= -3") - '---------------------------------------------------------------------------------------------------- ttCalculator.SetToolTip(cmdUpper, "Change to upper case. For example str_to_upper(""Dr. Foster"") gives ""DR. FOSTER""") ttCalculator.SetToolTip(cmdLower, "Change to lower case. For example str_to_lower(""Dr. Foster"") gives ""dr. foster""") @@ -299,82 +298,69 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdCp, "coefficent of persistence between sim and obs") ttCalculator.SetToolTip(cmdD, "Index of agreement between sim and obs") ttCalculator.SetToolTip(cmdKGE, "Kling-Gupta efficiency between sim and obs") - ttCalculator.SetToolTip(cmdMae, "mean absolute error between sim and obs") - ttCalculator.SetToolTip(cmdMd, "modified index of agreement between sim and obsmNSE") - ttCalculator.SetToolTip(cmdMe, "mean error between sim and obs") - ttCalculator.SetToolTip(cmdmNSE, "modified Nash-Sutcliffe efficiency between sim and obs") - ttCalculator.SetToolTip(cmdMse, "mean squared error between sim and obs") - ttCalculator.SetToolTip(cmdNrmse, "normalized root mean square error between sim and obs") + ttCalculator.SetToolTip(cmdMae, "Mean absolute error between sim and obs") + ttCalculator.SetToolTip(cmdMd, "Modified index of agreement between sim and obsmNSE") + ttCalculator.SetToolTip(cmdMe, "Mean error between sim and obs") + ttCalculator.SetToolTip(cmdmNSE, "Modified Nash-Sutcliffe efficiency between sim and obs") + ttCalculator.SetToolTip(cmdMse, "Mean squared error between sim and obs") + ttCalculator.SetToolTip(cmdNrmse, "Normalized root mean square error between sim and obs") ttCalculator.SetToolTip(cmdNSE, "Nash-Sutcliffe efficiency between sim and obs") - ttCalculator.SetToolTip(cmdPbias, "percent bias between sim and obs") - ttCalculator.SetToolTip(cmdPbiasfdc, "percent bias in the slope of the midsegment of the flow duration curve") - ttCalculator.SetToolTip(cmdRd, "relative index of agreement (d) between sim and obs. (Value is between 0 and 1)") - ttCalculator.SetToolTip(cmdRmse, "root mean square error between sim and obs, so the standard deviation of the model prediction error") - ttCalculator.SetToolTip(cmdRNSE, "relative Nash-Sutcliffe efficiency between sim and obs") - ttCalculator.SetToolTip(cmdRPearson, "correlation between sim and obs") - ttCalculator.SetToolTip(cmdRSD, "ratio of standard deviations between sim and obs") - ttCalculator.SetToolTip(cmdRsr, "ratio of the root mean square error between sim and obs to the standard deviation of obs") - ttCalculator.SetToolTip(cmdSsq, "sum of squared residuals between sim and obs") - ttCalculator.SetToolTip(cmdVE, " volumetric efficiency between sim and obs (Value is between 0 and 1)") - - 'Wakefield Tooltips - ttCalculator.SetToolTip(cmdAge, "Sample of ages, with default from 20 to 35") - ttCalculator.SetToolTip(cmdAnimal, "Sample of animals, with default of 10 from a list of 591 animals!") - ttCalculator.SetToolTip(cmdPet, "Sample of pets. Default is dog, cat, none, bird, horse, with given probabilities") - ttCalculator.SetToolTip(cmdAnswer, " Sample of No or Yes, with defaults of equal probability") - ttCalculator.SetToolTip(cmdCar, "Sample of cars, with datasets mtcars makes as default") - ttCalculator.SetToolTip(cmdChildren, "Sample of number of children, with default 0 to 10 and defined probabilities") - ttCalculator.SetToolTip(cmdCoin, "Sample giving heads or tails with default of equal probability") - ttCalculator.SetToolTip(cmdColor, "Sample by default from the 657 colours in the grDevices package") - ttCalculator.SetToolTip(cmdPrimary, "Sample by default from the colours, red, green, blue, yellow, black, and white. Are those your primary colours?") - ttCalculator.SetToolTip(cmdWakefieldDates, " Sample of dates with default being dates in order, by month, for the past year") - ttCalculator.SetToolTip(cmdDeath, "Sample giving FALSE/TRUE with default being equally likely") - ttCalculator.SetToolTip(cmdDice, "Sample with default being equally likely from a 6 sided dice") - ttCalculator.SetToolTip(cmdDna, "Sample with default being equally likely from Guanine, Adenine, Thymine, Cytosine") - ttCalculator.SetToolTip(cmdDob, "Sample of dates, with default being for 2 years, starting 15 years ago") - ttCalculator.SetToolTip(cmdDummy, "Sample of 0 and 1, with default equally likely") - ttCalculator.SetToolTip(cmdEducation, "Sample of 12 education levels from No education to doctorate with defined probabilities") - ttCalculator.SetToolTip(cmdEmployment, "Sample of 5 employment levels, namely: full-time, part-time, unemployed, retired, student") - ttCalculator.SetToolTip(cmdEye, "Sample of 5 eye colours, namely: brown, blue green, hazel, grey") - ttCalculator.SetToolTip(cmdGrade_Level, "Sample of grade levels from 1 to 12") - ttCalculator.SetToolTip(cmdGrade, "Sample from normal disribution with default mean 88 and sd 4. See also grade_letter and gpa") - ttCalculator.SetToolTip(cmdGrade_Letter, "Sample from normal distribution with default mean 88 snd sd 4, with fixed translation into A+ to F") - ttCalculator.SetToolTip(cmdGpa, "Sample from normal distribution with default mean 88 and sd 4, with fixed translation into gpa of 4 to 0") - ttCalculator.SetToolTip(cmdGroup, "Sample generating 2 groups, with default of random assignment to Control and Treatment, with equal probabilities") - ttCalculator.SetToolTip(cmdHair, "Sample with default of 4 hair colours, brown, black, blonde, red, and defined probabilities") - ttCalculator.SetToolTip(cmdHeight, "Sample from normal distribution with default mean 69, and sd 3.75, min 1, and no specified max, rounded to no decimals") - ttCalculator.SetToolTip(cmdIncome, "Sample from a gamma distribution with mean 40,000 and shape 2. (Multiply the result to change the mean)") - ttCalculator.SetToolTip(cmdInternet_Browser, "Sample from ""Which browser do you use?"" with Chrome, IE, Firefox, Safari, Opera, Android, being the options") - ttCalculator.SetToolTip(cmdIq, "Sample from normal distribution with default of mean 100 and sd 15 - not 10 as provided by the package") - ttCalculator.SetToolTip(cmdLanguage, "Sample of world's languages with default being list of 99 languages, provided, together with their proportions") - ttCalculator.SetToolTip(cmdWakefieldLower, "Sample of single letters, with default being one of a,b,c,d,e") - ttCalculator.SetToolTip(cmdMath, "Sample of integers with default of 1 to 4, and probabilities based on New York grading in maths for Grades 3 to 8 children. (Called level instead if equally likely)") - ttCalculator.SetToolTip(cmdWakefieldMinute, "Sample of minutes as H:M:S time elements. (Tweak command to hours or seconds if needed)") - ttCalculator.SetToolTip(cmdLikert, "Sample from 5-point scale, ranging from strongly agree to strongly disagree, with default of equal probabilities") - ttCalculator.SetToolTip(cmdLorem_ipsum, "Provides random gibberish text, based on Latin") - ttCalculator.SetToolTip(cmdMarital, "Sample with default of 5 categories, Married, Divorced, Widowed, Separated, Never Married, equally likely") - ttCalculator.SetToolTip(cmdMilitary, "Sample with default of 5 categories, Army, etc, and proportions to match US military") - ttCalculator.SetToolTip(cmdWakefield_Month, "Sample of months with default using full names for all months and equal proportions") - ttCalculator.SetToolTip(cmdName, "Sample of names, with default from provided list of 95,025 different gender-neutral names, (so sampled without replacement)") - ttCalculator.SetToolTip(cmdNormal, "Sample from normal distribution, with default being standard normal, (mean 0, sd 1) and no min or max values specified") - ttCalculator.SetToolTip(cmdPolitical, "Sample of political parties with default being 5 categories based on US registered voters") - ttCalculator.SetToolTip(cmdRace, "Sample with default of 8 races (white, to Hawaiaan) and US proportions") - ttCalculator.SetToolTip(cmdReligion, "Sample with default of 8 religions and world ratios of numbers in each") - ttCalculator.SetToolTip(cmdSat, "Sample of SAT scores. Normal distribution and default changed from package values to give mean of 1000 and maximum of 1600") - ttCalculator.SetToolTip(cmdSentence, "Sample of sentences with default supplied list from 2012 presidential debate") - ttCalculator.SetToolTip(cmdGender, "Sample of male, female with default proportions matching gender makeup") - ttCalculator.SetToolTip(cmdSex_Inclusive, "Sample of male, female, intersex, with default proportion of transgender from 2011 report") - ttCalculator.SetToolTip(cmdWakefieldTimes, "Sample of times of day as H:M:S time elements") - ttCalculator.SetToolTip(cmdSmokes, "Logical (TRUE/FALSE) sample with default of 18% smokers") - ttCalculator.SetToolTip(cmdSpeed, "Sample from normal distribution, with default mean 55 and sd 10") - ttCalculator.SetToolTip(cmdState, "Sample with default from the 50 US states in proportion to their 2010 populations") - ttCalculator.SetToolTip(cmdString, "Sample with default of 10 random alphanumeric characters") - ttCalculator.SetToolTip(cmdWakefieldUpper, "Sample of single capital letter, with default being one of A, B, C, D, E") - ttCalculator.SetToolTip(cmdValid, "Logical (TRUE/FALSE) sample with default being equal probability") - ttCalculator.SetToolTip(cmdWakefield_Year, "Sample of years with default from 1996 to current year, with equal probability") - ttCalculator.SetToolTip(cmdLikert7, " Sample from 7-point scale, ranging from strongly agree to strongly disagree, with default of equal probabilities") - - Const strTooltipCmdLength = "number of observations: For example length(c(1,2,3,4,NA)) = 5 " + ttCalculator.SetToolTip(cmdPbias, "Percent bias between sim and obs") + ttCalculator.SetToolTip(cmdPbiasfdc, "Percent bias in the slope of the midsegment of the flow duration curve") + ttCalculator.SetToolTip(cmdRd, "Relative index of agreement (d) between sim and obs. (Value is between 0 and 1)") + ttCalculator.SetToolTip(cmdRmse, "Root mean square error between sim and obs, so the standard deviation of the model prediction error") + ttCalculator.SetToolTip(cmdRNSE, "Relative Nash-Sutcliffe efficiency between sim and obs") + ttCalculator.SetToolTip(cmdRPearson, "Correlation between sim and obs") + ttCalculator.SetToolTip(cmdRSD, "Ratio of standard deviations between sim and obs") + ttCalculator.SetToolTip(cmdRsr, "Ratio of the root mean square error between sim and obs to the standard deviation of obs") + ttCalculator.SetToolTip(cmdSsq, "Sum of squared residuals between sim and obs") + ttCalculator.SetToolTip(cmdVE, " Volumetric efficiency between sim and obs (Value is between 0 and 1)") + + ' circular keyboard tooltips + ttCalculator.SetToolTip(cmdCircular, "Define a variable as circular. Specify whether the data are in radians (default), degrees, or hours.") + ttCalculator.SetToolTip(cmdCircMean, "The circular mean. For example with 1, 2, 3, 6, mean(circular(c(1,2,3,6)) gives 1.51.") + ttCalculator.SetToolTip(cmdCircSd, "The circular standard deviation. This is not the sqrt(circular.var). It is reasonably close to the ordinary sd for data in radians.") + ttCalculator.SetToolTip(cmdCircRho, "The mean resultant length is between 0 and 1. Small values imply large (circular) variation. For 1,2,3,6 rho is 0.4036. With 1,2,3,4,5,6 it is 0.049.") + ttCalculator.SetToolTip(cmdCircRange, "Circular range is the shortest arc containing the data. For example with 1,2,3,6 gives 3.28 (6 is also -0.28 on circle from 0 to 2*pi)") + ttCalculator.SetToolTip(cmdCircVar, "The circular variance is (1 - rho), so between 0 and 1, with small values implying low (circular) variation. For 1,2,3,6 var is 0.5964. With 1,2,3,4,5,6 var is 0.951.") + ttCalculator.SetToolTip(cmdCircQuantiles, "Defined quantiles round the circle. With 0.5 it is the (circular) median, so is 1.5 for 1,2,3,6.") + ttCalculator.SetToolTip(cmdCircMax, "Largest value round the circle. For example, for 1,2,3,6 max is 3.") + ttCalculator.SetToolTip(cmdCircMin, " Smallest value round the circle. For 1,2,3,6 min is 6. (values are from 6 (almost 2 * pi to 3)") + ttCalculator.SetToolTip(cmdCircQ1, "Lower quartile round the circle. For 1,2,3,6, q1 is 0.68") + ttCalculator.SetToolTip(cmdCircQ3, "Upper quartile round the circle. For 1,2,3,6 q3 is 2.25.") + ttCalculator.SetToolTip(cmdMedianHL, " Median using Hodges-Lehmann estimate. For example with 1,2,3,6, medianHL (and median) give 1.5.") + ttCalculator.SetToolTip(cmdCircMedian, "Circular median. For example with 23 and 2 representing hours, median(circular(c(23,2), units=""hours"")) gives 0,5.") + ttCalculator.SetToolTip(cmdAngVar, "The angular variance is twice the circular variance, so between 0 and 2.") + ttCalculator.SetToolTip(cmdA1, "Ratio of Bessel functions for values of kappa parameter. Used in the von Mises (circular normal) distribution kappa = 0.9 gives A1 same as rho value for 1,2,3,6 data.") + ttCalculator.SetToolTip(cmdAngDev, "The angular deviation is square root of the angular variance, so between 0 and sqrt(2).") + + 'Dates/Times keyboard tooltips + ttCalculator.SetToolTip(cmdDate, "Get the date part of a date-time variable") + ttCalculator.SetToolTip(cmdAsDate, "Converts a character or numeric variable into a date. For example as_date(30) or as_date(""19700131"") or as.date(""1970.jan-31"") each give 1970-01-31") + ttCalculator.SetToolTip(cmdDateTime, "Converts a character or numeric variable into a date-time variable. For example as_datetime(30) gives 1970-01-01 00:00:30 UTC") + ttCalculator.SetToolTip(cmdTime, "Converts seconds, minutes, hours into a time variable. For example hms(185) gives 00:03:05, hms(25, 64) gives 01:04:25") + ttCalculator.SetToolTip(cmdYmd, "Makes a date variable from various character or numeric formats in year-month-day order. For example ymd(19840512) gives 1984-05-12") + ttCalculator.SetToolTip(cmdDmy, "Makes a date variable from various formats in day-month-year order. For example dmy(12051984) gives 1984-05-12") + ttCalculator.SetToolTip(cmdMdy, " Makes a date variable for mdy order. For example mdy(5121984) gives 1984-05-12. (Note alternatives of myd, ydm and dym)") + ttCalculator.SetToolTip(cmdAsTime, "Makes a time variable from numeric or character variable. For example: as_hms(185) gives 00:03:05, as_hms(""14:55:10"") gives 14:55:10") + ttCalculator.SetToolTip(cmdYmdHms, "Make a date-time variable from various character or numeric formats") + ttCalculator.SetToolTip(cmdYmdHm, " Make a date-time variable from various formats. For example ymd_hm(202406161201) gives 2024-06-16 12:01:00 UTC") + ttCalculator.SetToolTip(cmdYmdH, "Make a date-time variable from various formats. For example ymd_h(""2024.6:16,12"") gives ""2024-06-16 12:00:00 UTC""") + ttCalculator.SetToolTip(cmdLeap, "True if date is from a leap year and FALSE otherwise. For example leap(1984-05-12) is TRUE") + ttCalculator.SetToolTip(cmdYear, "Extract year from date or date-time. For example year(""1984-5-12"") gives 1984") + ttCalculator.SetToolTip(cmdMonth, "Extract month from a date or date-time variable") + ttCalculator.SetToolTip(cmdDay, "Extract day in month from date or date-time. For example day(""1984-5-12"" gives 12") + ttCalculator.SetToolTip(cmdYday, "Gives the day in the year, and depends on leap year. For example yday(""1984-3-1"") gives 61, while yday(""1986-3-1"") gives 60") + ttCalculator.SetToolTip(cmdWday, "Gives the day of the week from a date, or date-time variable. For example wday(""1984--5-12"", label=TRUE) gives Sat") + ttCalculator.SetToolTip(cmdD_In_M, "Gives the number of days in the month from date, or date-time. For example d_in_m(""1984_2-12"") gives 29 as 1984 is a leap year") + ttCalculator.SetToolTip(cmdAm, "TRUE or FALSE from date-time variable. For example am(""1984-05-12 14:23:45"") is FALSE") + ttCalculator.SetToolTip(cmdPm, "TRUE or FALSE from date-time variable. For example pm(""1984-05-12 14:23:45"") is TRUE") + ttCalculator.SetToolTip(cmdHour, "Extract hour from date-time variable. For example hour(""1984-05-12 14:23:45"") is 14. Also hour(""1984-05-12"") is 0") + ttCalculator.SetToolTip(cmdMinutes, "Extract minute from date-time variable. For example minute(""1984-05-12 14:23:45"") Is 23") + ttCalculator.SetToolTip(cmdSec, "Extract second from date-time variable. For example second(""1984-05-12 14:23:45"") is 45") + ttCalculator.SetToolTip(cmdQuarter, " 3-month period of the year from a date or date-time variable. For example quarter(""1984-05-12"") gives 2") + + Const strTooltipCmdLength = "number Of observations: For example length(c(1,2,3,4,NA)) = 5 " ttCalculator.SetToolTip(cmdLength, strTooltipCmdLength) ttCalculator.SetToolTip(cmdListLength, strTooltipCmdLength) @@ -1525,124 +1511,156 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdYear_Click(sender As Object, e As EventArgs) + Private Sub cmdYear_Click(sender As Object, e As EventArgs) Handles cmdYear.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::year(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::year(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::year()", 1) End If End Sub - Private Sub cmdMonth_Click(sender As Object, e As EventArgs) + Private Sub cmdMonth_Click(sender As Object, e As EventArgs) Handles cmdMonth.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::month(x= , label=FALSE, abbr=TRUE)", 25) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::month(x= , label=FALSE, abbr=TRUE)", 26) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::month()", 1) End If End Sub - Private Sub cmdDay_Click(sender As Object, e As EventArgs) + Private Sub cmdDay_Click(sender As Object, e As EventArgs) Handles cmdDay.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::day(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::day(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::day()", 1) End If End Sub - Private Sub cmdWday_Click(sender As Object, e As EventArgs) + Private Sub cmdWday_Click(sender As Object, e As EventArgs) Handles cmdWday.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::wday(x= , label=FALSE, abbr=TRUE)", 25) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::wday(x= , label=FALSE, abbr=TRUE)", 26) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::wday()", 1) End If End Sub - Private Sub cmdYday_Click(sender As Object, e As EventArgs) + Private Sub cmdYday_Click(sender As Object, e As EventArgs) Handles cmdYday.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::yday(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::yday(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::yday()", 1) End If End Sub - Private Sub cmdDate_Click(sender As Object, e As EventArgs) + Private Sub cmdDate_Click(sender As Object, e As EventArgs) Handles cmdDate.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::date(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::date(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::date()", 1) End If End Sub - Private Sub cmdLeap_Click(sender As Object, e As EventArgs) + Private Sub cmdAsDate_Click(sender As Object, e As EventArgs) Handles cmdAsDate.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::leap_year(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::as_date(x= )", 2) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::as_date()", 1) + End If + End Sub + + Private Sub cmdYmdHms_Click(sender As Object, e As EventArgs) Handles cmdYmdHms.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_hms(x= ) ", 3) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_hms() ", 2) + End If + End Sub + + Private Sub cmdYmdHm_Click(sender As Object, e As EventArgs) Handles cmdYmdHm.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_hm(x= ) ", 3) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_hm() ", 2) + End If + End Sub + + Private Sub cmdYmdH_Click(sender As Object, e As EventArgs) Handles cmdYmdH.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_h(x= ) ", 3) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_h()", 1) + End If + End Sub + + Private Sub cmdLeap_Click(sender As Object, e As EventArgs) Handles cmdLeap.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::leap_year(date= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::leap_year()", 1) End If End Sub - Private Sub cmdYmd_Click(sender As Object, e As EventArgs) + Private Sub cmdYmd_Click(sender As Object, e As EventArgs) Handles cmdYmd.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd()", 1) End If End Sub - Private Sub cmdMdy_Click(sender As Object, e As EventArgs) + Private Sub cmdMdy_Click(sender As Object, e As EventArgs) Handles cmdMdy.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::mdy(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::mdy(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::mdy()", 1) End If End Sub - Private Sub cmdDmy_Click(sender As Object, e As EventArgs) + Private Sub cmdDmy_Click(sender As Object, e As EventArgs) Handles cmdDmy.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::dmy(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::dmy(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::dmy()", 1) End If End Sub - Private Sub cmdHour_Click(sender As Object, e As EventArgs) + Private Sub cmdHour_Click(sender As Object, e As EventArgs) Handles cmdHour.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::hour(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::hour(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::hour()", 1) End If End Sub - Private Sub cmdMinutes_Click(sender As Object, e As EventArgs) + Private Sub cmdMinutes_Click(sender As Object, e As EventArgs) Handles cmdMinutes.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::minute(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::minute(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::minute()", 1) End If End Sub - Private Sub cmdSec_Click(sender As Object, e As EventArgs) + Private Sub cmdSec_Click(sender As Object, e As EventArgs) Handles cmdSec.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::second(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::second(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::second()", 1) End If End Sub - Private Sub cmdAm_Click(sender As Object, e As EventArgs) + Private Sub cmdAm_Click(sender As Object, e As EventArgs) Handles cmdAm.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::am(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::am(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::am()", 1) End If End Sub - Private Sub cmdD_In_M_Click(sender As Object, e As EventArgs) + Private Sub cmdD_In_M_Click(sender As Object, e As EventArgs) Handles cmdD_In_M.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::days_in_month(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::days_in_month(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::days_in_month()", 1) End If End Sub - Private Sub cmdQuarter_Click(sender As Object, e As EventArgs) + Private Sub cmdQuarter_Click(sender As Object, e As EventArgs) Handles cmdQuarter.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::quarter(x =, with_year = FALSE, fiscal_start = 1 )", 39) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::quarter(x= , with_year = FALSE, fiscal_start = 1 )", 40) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::quarter()", 1) End If @@ -2285,21 +2303,20 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldDeathFunction.ToScript, 0) End Sub - Private Sub cmdGrade_Letter_Click(sender As Object, e As EventArgs) Handles cmdGrade_Letter.Click - Dim clsWakefieldgrade_letterFunction As New RFunction + Private Sub cmdDied_Click(sender As Object, e As EventArgs) Handles cmdDied.Click + Dim clsWakefieldDiedFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsWakefieldgrade_letterFunction.SetPackageName("wakefield") - clsWakefieldgrade_letterFunction.SetRCommand("grade_letter") - clsWakefieldgrade_letterFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldgrade_letterFunction.AddParameter("mean", "88", iPosition:=1) - clsWakefieldgrade_letterFunction.AddParameter("sd", "4", iPosition:=2) - clsWakefieldgrade_letterFunction.AddParameter("name", Chr(34) & "Grade_Letter" & Chr(34), iPosition:=3) + clsWakefieldDiedFunction.SetPackageName("wakefield") + clsWakefieldDiedFunction.SetRCommand("died") + clsWakefieldDiedFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldDiedFunction.AddParameter("prob", "NULL", iPosition:=1) + clsWakefieldDiedFunction.AddParameter("name", Chr(34) & "Died" & Chr(34), iPosition:=2) - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldgrade_letterFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldDiedFunction.ToScript, 0) End Sub Private Sub cmdDice_Click(sender As Object, e As EventArgs) Handles cmdDice.Click @@ -2690,7 +2707,7 @@ Public Class ucrCalculator clsWakefieldIQFunction.SetRCommand("iq") clsWakefieldIQFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) clsWakefieldIQFunction.AddParameter("mean", "100", iPosition:=1) - clsWakefieldIQFunction.AddParameter("sd", "15", iPosition:=2) + clsWakefieldIQFunction.AddParameter("sd", "10", iPosition:=2) clsWakefieldIQFunction.AddParameter("min", "0", iPosition:=3) clsWakefieldIQFunction.AddParameter("max", "NULL", iPosition:=4) clsWakefieldIQFunction.AddParameter("digits", "0", iPosition:=5) @@ -2717,6 +2734,22 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLanguageFunction.ToScript, 0) End Sub + Private Sub cmdLevel_Click(sender As Object, e As EventArgs) Handles cmdLevel.Click + Dim clsWakefieldLevelFunction As New RFunction + Dim clsWakefieldNrowFunction As New RFunction + + clsWakefieldNrowFunction.SetRCommand("nrow") + clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) + + clsWakefieldLevelFunction.SetPackageName("wakefield") + clsWakefieldLevelFunction.SetRCommand("level") + clsWakefieldLevelFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldLevelFunction.AddParameter("x", "1:4", iPosition:=1) + clsWakefieldLevelFunction.AddParameter("prob", "NULL", iPosition:=2) + clsWakefieldLevelFunction.AddParameter("name", Chr(34) & "Level" & Chr(34), iPosition:=3) + + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLevelFunction.ToScript, 0) + End Sub Private Sub cmdMath_Click(sender As Object, e As EventArgs) Handles cmdMath.Click Dim clsWakefieldMathFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction @@ -2741,22 +2774,28 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldMathFunction.ToScript, 0) End Sub - Private Sub cmdWakefieldMinute_Click(sender As Object, e As EventArgs) Handles cmdWakefieldMinute.Click - Dim clsWakefieldMinuteFunction As New RFunction + Private Sub cmdEla_Click(sender As Object, e As EventArgs) Handles cmdEla.Click + Dim clsWakefieldElaFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction + Dim clsELAProbFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsWakefieldMinuteFunction.SetPackageName("wakefield") - clsWakefieldMinuteFunction.SetRCommand("minute") - clsWakefieldMinuteFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldMinuteFunction.AddParameter("x", "seq(0, 59, by = 1)/60 ", iPosition:=1) - clsWakefieldMinuteFunction.AddParameter("prob", "NULL", iPosition:=2) - clsWakefieldMinuteFunction.AddParameter("random", "FALSE", iPosition:=3) - clsWakefieldMinuteFunction.AddParameter("name", Chr(34) & "Minute" & Chr(34), iPosition:=4) + clsELAProbFunction.SetRCommand("c") + clsELAProbFunction.AddParameter("0.3161", "0.29829", iPosition:=0, bIncludeArgumentName:=False) + clsELAProbFunction.AddParameter("0.37257", "0.37257", iPosition:=1, bIncludeArgumentName:=False) + clsELAProbFunction.AddParameter("0.2233", "0.2233", iPosition:=2, bIncludeArgumentName:=False) + clsELAProbFunction.AddParameter("0.08803", "0.08803", iPosition:=3, bIncludeArgumentName:=False) + + clsWakefieldElaFunction.SetPackageName("wakefield") + clsWakefieldElaFunction.SetRCommand("ela") + clsWakefieldElaFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldElaFunction.AddParameter("x", "1:4", iPosition:=1) + clsWakefieldElaFunction.AddParameter("prob", clsRFunctionParameter:=clsELAProbFunction, iPosition:=2) + clsWakefieldElaFunction.AddParameter("name", Chr(34) & "ELA" & Chr(34), iPosition:=3) - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldMinuteFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldElaFunction.ToScript, 0) End Sub Private Sub cmdGpa_Click(sender As Object, e As EventArgs) Handles cmdGpa.Click @@ -3049,10 +3088,10 @@ Public Class ucrCalculator clsWakefieldSatFunction.SetPackageName("wakefield") clsWakefieldSatFunction.SetRCommand("sat") clsWakefieldSatFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldSatFunction.AddParameter("mean", "1000", iPosition:=1) - clsWakefieldSatFunction.AddParameter("sd", "150", iPosition:=2) - clsWakefieldSatFunction.AddParameter("min", "400", iPosition:=3) - clsWakefieldSatFunction.AddParameter("max", "1600", iPosition:=4) + clsWakefieldSatFunction.AddParameter("mean", "1500", iPosition:=1) + clsWakefieldSatFunction.AddParameter("sd", "100", iPosition:=2) + clsWakefieldSatFunction.AddParameter("min", "0", iPosition:=3) + clsWakefieldSatFunction.AddParameter("max", "2400", iPosition:=4) clsWakefieldSatFunction.AddParameter("digits", "0", iPosition:=5) clsWakefieldSatFunction.AddParameter("name", Chr(34) & "SAT" & Chr(34), iPosition:=6) @@ -3126,22 +3165,31 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldSexInclusiveFunction.ToScript, 0) End Sub - Private Sub cmdWakefieldTimes_Click(sender As Object, e As EventArgs) Handles cmdWakefieldTimes.Click - Dim clsWakefieldTimestampFunction As New RFunction + Private Sub cmdSex_Click(sender As Object, e As EventArgs) Handles cmdSex.Click + Dim clsWakefieldSexFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction + Dim clsSexListFunction As New RFunction + Dim clsSexProbFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsWakefieldTimestampFunction.SetPackageName("wakefield") - clsWakefieldTimestampFunction.SetRCommand("time_stamp") - clsWakefieldTimestampFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldTimestampFunction.AddParameter("x", "seq(0, 23, by = 1)", iPosition:=1) - clsWakefieldTimestampFunction.AddParameter("prob", "NULL", iPosition:=2) - clsWakefieldTimestampFunction.AddParameter("random", "FALSE", iPosition:=3) - clsWakefieldTimestampFunction.AddParameter("name", Chr(34) & "Time" & Chr(34), iPosition:=4) + clsSexListFunction.SetRCommand("c") + clsSexListFunction.AddParameter("male", Chr(34) & "Male" & Chr(34), iPosition:=0, bIncludeArgumentName:=False) + clsSexListFunction.AddParameter("female", Chr(34) & "Female" & Chr(34), iPosition:=1, bIncludeArgumentName:=False) + + clsSexProbFunction.SetRCommand("c") + clsSexProbFunction.AddParameter("0.51219512195122", "0.51219512195122", iPosition:=0, bIncludeArgumentName:=False) + clsSexProbFunction.AddParameter("0.48780487804878", "0.48780487804878", iPosition:=1, bIncludeArgumentName:=False) - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldTimestampFunction.ToScript, 0) + clsWakefieldSexFunction.SetPackageName("wakefield") + clsWakefieldSexFunction.SetRCommand("sex") + clsWakefieldSexFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldSexFunction.AddParameter("x", clsRFunctionParameter:=clsSexListFunction, iPosition:=1) + clsWakefieldSexFunction.AddParameter("prob", clsRFunctionParameter:=clsSexProbFunction, iPosition:=2) + clsWakefieldSexFunction.AddParameter("name", Chr(34) & "Sex" & Chr(34), iPosition:=3) + + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldSexFunction.ToScript, 0) End Sub Private Sub cmdSmokes_Click(sender As Object, e As EventArgs) Handles cmdSmokes.Click @@ -3219,40 +3267,22 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldStringFunction.ToScript, 0) End Sub - Private Sub cmdWakefield_Upper_Click(sender As Object, e As EventArgs) Handles cmdWakefieldUpper.Click - Dim clsWakefieldUpper_factorFunction As New RFunction + Private Sub cmdWakefield_Upper_Click(sender As Object, e As EventArgs) Handles cmdWakefield_Upper.Click + Dim clsWakefieldUpperFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsWakefieldUpper_factorFunction.SetPackageName("wakefield") - clsWakefieldUpper_factorFunction.SetRCommand("upper_factor") - clsWakefieldUpper_factorFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldUpper_factorFunction.AddParameter("k", "5", iPosition:=1) - clsWakefieldUpper_factorFunction.AddParameter("x", "LETTERS", iPosition:=2) - clsWakefieldUpper_factorFunction.AddParameter("prob", "NULL", iPosition:=3) - clsWakefieldUpper_factorFunction.AddParameter("name", Chr(34) & "Upper" & Chr(34), iPosition:=4) + clsWakefieldUpperFunction.SetPackageName("wakefield") + clsWakefieldUpperFunction.SetRCommand("upper") + clsWakefieldUpperFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldUpperFunction.AddParameter("k", "5", iPosition:=1) + clsWakefieldUpperFunction.AddParameter("x", "LETTERS", iPosition:=2) + clsWakefieldUpperFunction.AddParameter("prob", "NULL", iPosition:=3) + clsWakefieldUpperFunction.AddParameter("name", Chr(34) & "Upper" & Chr(34), iPosition:=4) - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldUpper_factorFunction.ToScript, 0) - End Sub - - Private Sub cmdWakefieldLower_click(sender As Object, e As EventArgs) Handles cmdWakefieldLower.Click - Dim clsWakefieldLower_FactorFunction As New RFunction - Dim clsWakefieldNrowFunction As New RFunction - - clsWakefieldNrowFunction.SetRCommand("nrow") - clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - - clsWakefieldLower_FactorFunction.SetPackageName("wakefield") - clsWakefieldLower_FactorFunction.SetRCommand("lower_factor") - clsWakefieldLower_FactorFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldLower_FactorFunction.AddParameter("k", "5", iPosition:=1) - clsWakefieldLower_FactorFunction.AddParameter("x", "letters", iPosition:=2) - clsWakefieldLower_FactorFunction.AddParameter("prob", "NULL", iPosition:=3) - clsWakefieldLower_FactorFunction.AddParameter("name", Chr(34) & "Lower" & Chr(34), iPosition:=4) - - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLower_FactorFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldUpperFunction.ToScript, 0) End Sub Private Sub cmdValid_Click(sender As Object, e As EventArgs) Handles cmdValid.Click @@ -3290,7 +3320,7 @@ Public Class ucrCalculator Private Sub cmdCircMean_Click(sender As Object, e As EventArgs) Handles cmdCircMean.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular:: mean.circular(x = , na.rm = FALSE, control.circular = list())", 44) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular:: mean.circular(x = , na.rm = TRUE, control.circular = list())", 43) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::mean.circular()", 1) End If @@ -3298,7 +3328,7 @@ Public Class ucrCalculator Private Sub cmdCircMedian_Click(sender As Object, e As EventArgs) Handles cmdCircMedian.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::median.circular(x = , na.rm = FALSE)", 17) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::median.circular(x = , na.rm = TRUE)", 16) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::median.circular()", 1) End If @@ -3306,7 +3336,7 @@ Public Class ucrCalculator Private Sub cmdMedianHL_Click(sender As Object, e As EventArgs) Handles cmdMedianHL.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular(x = , na.rm = FALSE, method = c(HL1,HL2,HL3), prop = NULL)", 55) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular(x = , na.rm = TRUE, method = c(""HL1"",""HL2"",""HL3""), prop = NULL)", 60) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular()", 1) End If @@ -3314,7 +3344,7 @@ Public Class ucrCalculator Private Sub cmdCircRange_Click(sender As Object, e As EventArgs) Handles cmdCircRange.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::range.circular(x = , test = FALSE, na.rm = FALSE, finite = FALSE, control.circular = list(), )", 76) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::range.circular(x = , test = FALSE, na.rm = TRUE, finite = FALSE, control.circular = list(), )", 75) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::range.circular()", 1) End If @@ -3322,7 +3352,7 @@ Public Class ucrCalculator Private Sub cmdCircSd_Click(sender As Object, e As EventArgs) Handles cmdCircSd.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::sd.circular(x = , na.rm = FALSE)", 18) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::sd.circular(x = , na.rm = TRUE)", 17) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::sd.circular()", 1) End If @@ -3330,7 +3360,7 @@ Public Class ucrCalculator Private Sub cmdCircVar_Click(sender As Object, e As EventArgs) Handles cmdCircVar.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::var.circular(x = , na.rm = FALSE)", 18) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::var.circular(x = , na.rm = TRUE)", 17) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::var.circular()", 1) End If @@ -3340,13 +3370,13 @@ Public Class ucrCalculator If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::A1(kappa = )", 2) Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::besselI()", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::A1()", 1) End If End Sub Private Sub cmdAngVar_Click(sender As Object, e As EventArgs) Handles cmdAngVar.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.variance(x = , na.rm = FALSE)", 17) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.variance(x = , na.rm = TRUE)", 16) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.variance()", 1) End If @@ -3354,7 +3384,7 @@ Public Class ucrCalculator Private Sub cmdAngDev_Click(sender As Object, e As EventArgs) Handles cmdAngDev.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.deviation(x = , na.rm = FALSE)", 17) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.deviation(x = , na.rm = TRUE)", 16) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.deviation()", 1) End If @@ -3362,7 +3392,7 @@ Public Class ucrCalculator Private Sub cmdCircQ1_Click(sender As Object, e As EventArgs) Handles cmdCircQ1.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.25, na.rm = FALSE, names = TRUE, type = 7)", 55) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.25, na.rm = TRUE, names = TRUE, type = 7)", 54) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.25)", 16) End If @@ -3370,7 +3400,7 @@ Public Class ucrCalculator Private Sub cmdCircMin_Click(sender As Object, e As EventArgs) Handles cmdCircMin.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0, na.rm = FALSE, names = TRUE, type = 7)", 52) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0, na.rm = TRUE, names = TRUE, type = 7)", 51) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0)", 13) End If @@ -3378,7 +3408,7 @@ Public Class ucrCalculator Private Sub cmdCircMax_Click(sender As Object, e As EventArgs) Handles cmdCircMax.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 1, na.rm = FALSE, names = TRUE, type = 7)", 52) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 1, na.rm = TRUE, names = TRUE, type = 7)", 51) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 1)", 13) End If @@ -3386,7 +3416,7 @@ Public Class ucrCalculator Private Sub cmdCircQ3_Click(sender As Object, e As EventArgs) Handles cmdCircQ3.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.75, na.rm = FALSE, names = TRUE, type = 7)", 55) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.75, na.rm = TRUE, names = TRUE, type = 7)", 54) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.75)", 16) End If @@ -3394,15 +3424,15 @@ Public Class ucrCalculator Private Sub cmdCircQuantiles_Click_1(sender As Object, e As EventArgs) Handles cmdCircQuantiles.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25), na.rm = FALSE, names = TRUE, type = 7)", 66) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25), na.rm = TRUE, names = TRUE, type = 7)", 65) Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25))", 28) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25))", 27) End If End Sub Private Sub cmdCircRho_Click_1(sender As Object, e As EventArgs) Handles cmdCircRho.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::rho.circular(x = , na.rm = FALSE)", 17) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::rho.circular(x = , na.rm = TRUE)", 16) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::rho.circular()", 1) End If @@ -3738,7 +3768,7 @@ Public Class ucrCalculator clsWakefieldLikert7Function.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) clsWakefieldLikert7Function.AddParameter("x", clsRFunctionParameter:=clsLikert7ListFunction, iPosition:=1) clsWakefieldLikert7Function.AddParameter("prob", "NULL", iPosition:=2) - clsWakefieldLikert7Function.AddParameter("name", Chr(34) & "Likert7" & Chr(34), iPosition:=3) + clsWakefieldLikert7Function.AddParameter("name", Chr(34) & "Likert" & Chr(34), iPosition:=3) ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLikert7Function.ToScript, 0) End Sub @@ -4083,7 +4113,7 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdDateTime_Click(sender As Object, e As EventArgs) + Private Sub cmdDateTime_Click(sender As Object, e As EventArgs) Handles cmdDateTime.Click If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::as_datetime(x = )", 2) Else @@ -4091,15 +4121,23 @@ Public Class ucrCalculator End If End Sub - Private Sub cmdTime_Click(sender As Object, e As EventArgs) + Private Sub cmdTime_Click(sender As Object, e As EventArgs) Handles cmdTime.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::hms(seconds = , minutes = , hours = , days = )", 32) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::hms(seconds = , minutes = , hours = , days = )", 33) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::hms()", 1) End If End Sub - Private Sub cmdPm_Click(sender As Object, e As EventArgs) + Private Sub cmdAsTime_Click(sender As Object, e As EventArgs) Handles cmdAsTime.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::as_hms(x= )", 2) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::as_hms()", 1) + End If + End Sub + + Private Sub cmdPm_Click(sender As Object, e As EventArgs) Handles cmdPm.Click If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::pm(x = )", 2) Else @@ -5536,24 +5574,4 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition("as.complex( )", 1) End If End Sub - - Private Sub cmdYmdHms_Click(sender As Object, e As EventArgs) - - End Sub - - Private Sub cmdYmdHm_Click(sender As Object, e As EventArgs) - - End Sub - - Private Sub cmdAsDate_Click(sender As Object, e As EventArgs) - - End Sub - - Private Sub cmdAsTime_Click(sender As Object, e As EventArgs) - - End Sub - - Private Sub cmdYmdH_Click(sender As Object, e As EventArgs) - - End Sub End Class From 451cc94887cf918aaa4ff30eba5cb60f10d91571 Mon Sep 17 00:00:00 2001 From: JUMA Date: Thu, 28 Mar 2024 16:15:51 +0300 Subject: [PATCH 67/88] chng --- instat/ucrCalculator.vb | 457 ++++++++++++++++++---------------------- 1 file changed, 210 insertions(+), 247 deletions(-) diff --git a/instat/ucrCalculator.vb b/instat/ucrCalculator.vb index ea93b2a93db..b89507ec41c 100644 --- a/instat/ucrCalculator.vb +++ b/instat/ucrCalculator.vb @@ -1,4 +1,4 @@ -' R- Instat +'R- Instat ' Copyright (C) 2015-2017 ' ' This program is free software: you can redistribute it and/or modify @@ -73,35 +73,35 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdRound, "round(x) to round to whole numbers, round(x,2) to round to 2 decimal places, round(x,-2) to round to the nearest 100") ttCalculator.SetToolTip(cmdSiginf, "signif(x,3) to round to 3 significant figures") - ttCalculator.SetToolTip(cmdSortF, "Sorts a vector into ascending or descending order. For example sort(c(5,7,4,4,3)) = (3,4,4,5,7)") - ttCalculator.SetToolTip(cmdScale, "Centre and scale the data - usually by producing (x - xbar)/s") - ttCalculator.SetToolTip(cmdMASSFractions, "Changes decimal data into a character variable with fractions. So 1.5 becomes 3/2, 0.25 becomes 1/4 etc.") - ttCalculator.SetToolTip(cmdDecimals, "The inverse of the fractions key. So 3/2 becomes 1.5, 1/4 becomes 0.25 etc.") - ttCalculator.SetToolTip(cmdLag, "Shift a variable down. For example lag(1:5) = (NA,1,2,3,4); lag(1:5,3) = (NA,NA,NA, 1,2)") - ttCalculator.SetToolTip(cmdLead, "Shift a variable up. For example lead(1:5) = (2,3,4,5,NA); lead(1:5;3) = (4,5, NA,NA,NA)") - ttCalculator.SetToolTip(cmdDiff, "Difference between successive elements. For example diff(c(1,4,3,7)) = (NA 3,-1,4)") - ttCalculator.SetToolTip(cmdRev, "Reverse a variable. For example rev(c(1,2,3,4,5)) =(5,4,3,2,1)") - ttCalculator.SetToolTip(cmdPMax, " Maximum of a set of variables. For examples pmax(c(1,3,5),c(6,4,2)) = (6,4,5)") - ttCalculator.SetToolTip(cmdPMin, "Minimum of a set of variables. For examples pmin(c(1,3,5),c(6,4,2)) = (1,3,2)") - ttCalculator.SetToolTip(cmdCumMax, "Cumulative maxima. For example cummax(c(3,2,1,4,0)) = (3,3,3,4,4)") - ttCalculator.SetToolTip(cmdMovMax, "Moving (or rolling) maxima. For example rollmax(x=c(3,2,1,4,0) ,3,fill=NA, align=""right"") = (NA,NA, 3,4,4)") - ttCalculator.SetToolTip(cmdCumSum, "Cumulative sums. For example cumsum(c(3,2,1,4,0)) = (3,5,6,10,10)") - ttCalculator.SetToolTip(cmdCumProd, "Cumulative products. For example cumprod(c(2,3,5,7)) = (2,6,30,210)") - ttCalculator.SetToolTip(cmdMovProd, "Moving products Fror example rollapply(c(2,3,5,7,11),width=3,fill=NA, FUN=prod) = (NA,30,105,385,NA)") - ttCalculator.SetToolTip(cmdCumMean, "Cumulative means. For example cummean(c(3,2,1,4,0)) = (3,2.5,2,2.5,2)") - ttCalculator.SetToolTip(cmdCumMin, "Cumulative minima. For example cummin(c(3,2,1,4,0)) = (3,2.,1,1,0)") - ttCalculator.SetToolTip(cmdMovSum, "Moving (or rolling) totals. For example rollsum(c(3,2,1,4,0) ,3,fill=NA, align=""left"") = (6,7,5,NA,NA)") - ttCalculator.SetToolTip(cmdMovMean, "Moving (or rolling) mean. For example rollmean(c(3,2,1,6,2) ,3,fill=NA) = (NA,2,3,3,NA)") - ttCalculator.SetToolTip(cmMovMed, "Moving (or rolling) medians. For example rollmedian(c(3,2,1,6,2) ,3,fill=NA) = (NA,2,2,2,NA)") - ttCalculator.SetToolTip(cmdMovmin, "Moving (or rolling) minima. For example rollapply(c(3,2,1,6,2),width=3,fill=NA, FUN=min) = (NA,1,1,1,NA)") - ttCalculator.SetToolTip(cmdNtile, " Use ranks to divide into (almost) equal sized groups. For example ntile(c(15,11,13,12,NA,12),2) = (2,1,2,1,NA,1)") - ttCalculator.SetToolTip(cmdCumdist, "Proportion of values less than or equal to the current rank. For example cume_dist(c(2,4,6,8,3)) = (0.2, 0.6, 0.8, 1.0, 0.4)") - ttCalculator.SetToolTip(cmdRowRank, "Row numbers as ranks. For example :row_number(c(15,11,13,12,NA,12)) = (5,1,3,2,NA,3)") - ttCalculator.SetToolTip(cmdPercentRank, "Rescale of minimum ranks to [0,1]. For example percent_rank(c(15,11,13,12,NA,12)) = (1,0,0.75,0.25,NA,0.25)") - ttCalculator.SetToolTip(cmdDRank, "Dense ranks. For example d_rank(c(15,11,13,12,NA,12)) = (4,1,3,2,NA,2)") - ttCalculator.SetToolTip(cmdMRank, " Minimum ranks. For example m_rank(c(15,11,13,12,NA,12)) = (5,1,4,2,NA,2)") - ttCalculator.SetToolTip(cmdNafill, "Fills missing values at the start, middle and end. For example na.fill(c(NA,2,NA,4,5,NA),fill=""extend"") = (2,2,3,4,5,5); while fill=c(15,""extend"",NA) = (15,2,3,4,5,NA)") - ttCalculator.SetToolTip(cmdNaapprox, "Linear interpolation of missing values. For example na.approx(c(5,NA,NA,2,2,NA,4,7,NA),maxgap=1,na.rm=FALSE) = (5,NA,NA,2,2,3,4,7,NA)") + ttCalculator.SetToolTip(cmdSortF, "sorts a vector into ascending or descending order. For example sort(c(5,7,4,4,3)) = (3,4,4,5,7)") + ttCalculator.SetToolTip(cmdScale, "centre and scale the data - usually by producing (x - xbar)/s") + ttCalculator.SetToolTip(cmdMASSFractions, "changes decimal data into a character variable with fractions. So 1.5 becomes 3/2, 0.25 becomes 1/4 etc.") + ttCalculator.SetToolTip(cmdDecimals, "the inverse of the fractions key. So 3/2 becomes 1.5, 1/4 becomes 0.25 etc.") + ttCalculator.SetToolTip(cmdLag, "shift a variable down. For example lag(1:5) = (NA,1,2,3,4); lag(1:5,3) = (NA,NA,NA, 1,2)") + ttCalculator.SetToolTip(cmdLead, "shift a variable up. For example lead(1:5) = (2,3,4,5,NA); lead(1:5;3) = (4,5, NA,NA,NA)") + ttCalculator.SetToolTip(cmdDiff, "difference between successive elements. For example diff(c(1,4,3,7)) = (NA 3,-1,4)") + ttCalculator.SetToolTip(cmdRev, "reverse a variable. For example rev(c(1,2,3,4,5)) =(5,4,3,2,1)") + ttCalculator.SetToolTip(cmdPMax, " maximum of a set of variables. For examples pmax(c(1,3,5),c(6,4,2)) = (6,4,5)") + ttCalculator.SetToolTip(cmdPMin, "minimum of a set of variables. For examples pmin(c(1,3,5),c(6,4,2)) = (1,3,2)") + ttCalculator.SetToolTip(cmdCumMax, "cumulative maxima. For example cummax(c(3,2,1,4,0)) = (3,3,3,4,4)") + ttCalculator.SetToolTip(cmdMovMax, "moving (or rolling) maxima. For example rollmax(x=c(3,2,1,4,0) ,3,fill=NA, align=""right"") = (NA,NA, 3,4,4)") + ttCalculator.SetToolTip(cmdCumSum, "cumulative sums. For example cumsum(c(3,2,1,4,0)) = (3,5,6,10,10)") + ttCalculator.SetToolTip(cmdCumProd, "cumulative products. For example cumprod(c(2,3,5,7)) = (2,6,30,210)") + ttCalculator.SetToolTip(cmdMovProd, "moving products Fror example rollapply(c(2,3,5,7,11),width=3,fill=NA, FUN=prod) = (NA,30,105,385,NA)") + ttCalculator.SetToolTip(cmdCumMean, "cumulative means. For example cummean(c(3,2,1,4,0)) = (3,2.5,2,2.5,2)") + ttCalculator.SetToolTip(cmdCumMin, "cumulative minima. For example cummin(c(3,2,1,4,0)) = (3,2.,1,1,0)") + ttCalculator.SetToolTip(cmdMovSum, "moving (or rolling) totals. For example rollsum(c(3,2,1,4,0) ,3,fill=NA, align=""left"") = (6,7,5,NA,NA)") + ttCalculator.SetToolTip(cmdMovMean, "moving (or rolling) mean. For example rollmean(c(3,2,1,6,2) ,3,fill=NA) = (NA,2,3,3,NA)") + ttCalculator.SetToolTip(cmMovMed, "moving (or rolling) medians. For example rollmedian(c(3,2,1,6,2) ,3,fill=NA) = (NA,2,2,2,NA)") + ttCalculator.SetToolTip(cmdMovmin, "moving (or rolling) minima. For example rollapply(c(3,2,1,6,2),width=3,fill=NA, FUN=min) = (NA,1,1,1,NA)") + ttCalculator.SetToolTip(cmdNtile, " use ranks to divide into (almost) equal sized groups. For example ntile(c(15,11,13,12,NA,12),2) = (2,1,2,1,NA,1)") + ttCalculator.SetToolTip(cmdCumdist, "proportion of values less than or equal to the current rank. For example cume_dist(c(2,4,6,8,3)) = (0.2, 0.6, 0.8, 1.0, 0.4)") + ttCalculator.SetToolTip(cmdRowRank, "row numbers as ranks. For example :row_number(c(15,11,13,12,NA,12)) = (5,1,3,2,NA,3)") + ttCalculator.SetToolTip(cmdPercentRank, "rescale of minimum ranks to [0,1]. For example percent_rank(c(15,11,13,12,NA,12)) = (1,0,0.75,0.25,NA,0.25)") + ttCalculator.SetToolTip(cmdDRank, "dense ranks. For example d_rank(c(15,11,13,12,NA,12)) = (4,1,3,2,NA,2)") + ttCalculator.SetToolTip(cmdMRank, " minimum ranks. For example m_rank(c(15,11,13,12,NA,12)) = (5,1,4,2,NA,2)") + ttCalculator.SetToolTip(cmdNafill, "fills missing values at the start, middle and end. For example na.fill(c(NA,2,NA,4,5,NA),fill=""extend"") = (2,2,3,4,5,5); while fill=c(15,""extend"",NA) = (15,2,3,4,5,NA)") + ttCalculator.SetToolTip(cmdNaapprox, "linear interpolation of missing values. For example na.approx(c(5,NA,NA,2,2,NA,4,7,NA),maxgap=1,na.rm=FALSE) = (5,NA,NA,2,2,3,4,7,NA)") ttCalculator.SetToolTip(cmdNasplin, "Spline interpolation of missing values. For example na.spline(c(NA,NA,NA,2,2,NA,4,7,NA),maxgap=2,na.rm=FALSE) = (NA,NA,NA,2,2,2.5,4,7,12)") ttCalculator.SetToolTip(cmdNaest, "Missing values as the mean (usually) overall or with a factor. For example na.aggregate(c(NA,NA,NA,2,2,NA,4,7,NA),maxgap=2,na.rm=FALSE) = (NA,NA,NA,2,2,3.75,4,7,3.75)") @@ -135,14 +135,14 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdPf, "F probabilities. For example pf(2,1,10) = 0.8123; pf(2,50,50) = 0.9921") ttCalculator.SetToolTip(cmdQnorm, "qnormal quantiles. For example qnorm(0.05) = -1.6449; qnorm(0.9772, 100,15) = 130") - ttCalculator.SetToolTip(cmdPbirth, "Simultaneous birthday probabilities. For example pbirthday(10) = 0.1169 ; pbirthday(50) = 0.97") - ttCalculator.SetToolTip(cmdQbirth, "Simultaneous birthday quantiles. For example qbirthday(0.5) = 23, qbirthday(0.99) = 57") - ttCalculator.SetToolTip(cmdPbinom, "Binomial probabilities. For example pbinom(3,5,0.4) = 0.0.913") - ttCalculator.SetToolTip(cmdQbinom, " Binomial quantiles. For example qbinom(0.9,5,0.4) = 3") + ttCalculator.SetToolTip(cmdPbirth, "simultaneous birthday probabilities. For example pbirthday(10) = 0.1169 ; pbirthday(50) = 0.97") + ttCalculator.SetToolTip(cmdQbirth, "simultaneous birthday quantiles. For example qbirthday(0.5) = 23, qbirthday(0.99) = 57") + ttCalculator.SetToolTip(cmdPbinom, "binomial probabilities. For example pbinom(3,5,0.4) = 0.0.913") + ttCalculator.SetToolTip(cmdQbinom, " binomial quantiles. For example qbinom(0.9,5,0.4) = 3") ttCalculator.SetToolTip(cmdPpois, "Poisson probabilities. For example ppois(8, 5) = 0.93") ttCalculator.SetToolTip(cmdQpois, "Poisson quantiles. For example qpois(0.9, 5) = 8") - ttCalculator.SetToolTip(cmdPnbin, "Negative binomial probabilities. For example pnbinom(4,1,0.4) = 0.922 (geometric); pnbinom(13,5,0.4) = 0.9058") - ttCalculator.SetToolTip(cmdQnbin, "Negative binomial quantiles. For example qnbinom(0.9,1,0.4) = 4 (geometric); qnbinom(0.9, 5,0.4) = 13") + ttCalculator.SetToolTip(cmdPnbin, "negative binomial probabilities. For example pnbinom(4,1,0.4) = 0.922 (geometric); pnbinom(13,5,0.4) = 0.9058") + ttCalculator.SetToolTip(cmdQnbin, "negative binomial quantiles. For example qnbinom(0.9,1,0.4) = 4 (geometric); qnbinom(0.9, 5,0.4) = 13") ttCalculator.SetToolTip(cmdFact, "factorial. For example factorial(4) = 4*3*2*1 = 24; factorial(3.5) = gamma(4.5) = 11.63") ttCalculator.SetToolTip(cmdLfact, "log factorial. For example lfactorial(400) = 2001") ttCalculator.SetToolTip(cmdChoose, "binomial coefficient. For example choose(7,4) = 7!/(4!*3!) = 35") @@ -178,11 +178,12 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdSin, "sine of angle in radians. For example sin(pi/2) = sin(rad(90)) = 1.") ttCalculator.SetToolTip(cmdAsin, "angle corresponding to a given sine (in the range (0 to pi). For example asin(1) = 1.57 = pi/2.") ttCalculator.SetToolTip(cmdFloor, "integer below the given value. For example floor(3.5)=3; floor(-3.5) = -4.") - ttCalculator.SetToolTip(cmdRad, "Change from degrees to radians. For example rad(90) = 2*pi * 90/360 = 1.57 ( = pi/2)") + ttCalculator.SetToolTip(cmdRad, "change from degrees to radians. For example rad(90) = 2*pi * 90/360 = 1.57 ( = pi/2)") ttCalculator.SetToolTip(cmdLogTen, "logarithm to base 10. For example log10(1000) =3 (=10^3)") ttCalculator.SetToolTip(cmdTan, " tangent of angle in radians. For example tan(pi/4) = sin(pi/4)/cos(pi/4) = tan(rad(45)) = 1") ttCalculator.SetToolTip(cmdAtan, "angle corresponding to a given tangent (in the range 0 to pi). For example atan(1) = 0.7854 (= pi/4); deg(atan(1)) = 45.") ttCalculator.SetToolTip(cmdTrunc, "truncates the values towards 0. So trunc(3.5) = 3, trunc(-3.5)= -3") + '---------------------------------------------------------------------------------------------------- ttCalculator.SetToolTip(cmdUpper, "Change to upper case. For example str_to_upper(""Dr. Foster"") gives ""DR. FOSTER""") ttCalculator.SetToolTip(cmdLower, "Change to lower case. For example str_to_lower(""Dr. Foster"") gives ""dr. foster""") @@ -298,69 +299,83 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdCp, "coefficent of persistence between sim and obs") ttCalculator.SetToolTip(cmdD, "Index of agreement between sim and obs") ttCalculator.SetToolTip(cmdKGE, "Kling-Gupta efficiency between sim and obs") - ttCalculator.SetToolTip(cmdMae, "Mean absolute error between sim and obs") - ttCalculator.SetToolTip(cmdMd, "Modified index of agreement between sim and obsmNSE") - ttCalculator.SetToolTip(cmdMe, "Mean error between sim and obs") - ttCalculator.SetToolTip(cmdmNSE, "Modified Nash-Sutcliffe efficiency between sim and obs") - ttCalculator.SetToolTip(cmdMse, "Mean squared error between sim and obs") - ttCalculator.SetToolTip(cmdNrmse, "Normalized root mean square error between sim and obs") + ttCalculator.SetToolTip(cmdMae, "mean absolute error between sim and obs") + ttCalculator.SetToolTip(cmdMd, "modified index of agreement between sim and obsmNSE") + ttCalculator.SetToolTip(cmdMe, "mean error between sim and obs") + ttCalculator.SetToolTip(cmdmNSE, "modified Nash-Sutcliffe efficiency between sim and obs") + ttCalculator.SetToolTip(cmdMse, "mean squared error between sim and obs") + ttCalculator.SetToolTip(cmdNrmse, "normalized root mean square error between sim and obs") ttCalculator.SetToolTip(cmdNSE, "Nash-Sutcliffe efficiency between sim and obs") - ttCalculator.SetToolTip(cmdPbias, "Percent bias between sim and obs") - ttCalculator.SetToolTip(cmdPbiasfdc, "Percent bias in the slope of the midsegment of the flow duration curve") - ttCalculator.SetToolTip(cmdRd, "Relative index of agreement (d) between sim and obs. (Value is between 0 and 1)") - ttCalculator.SetToolTip(cmdRmse, "Root mean square error between sim and obs, so the standard deviation of the model prediction error") - ttCalculator.SetToolTip(cmdRNSE, "Relative Nash-Sutcliffe efficiency between sim and obs") - ttCalculator.SetToolTip(cmdRPearson, "Correlation between sim and obs") - ttCalculator.SetToolTip(cmdRSD, "Ratio of standard deviations between sim and obs") - ttCalculator.SetToolTip(cmdRsr, "Ratio of the root mean square error between sim and obs to the standard deviation of obs") - ttCalculator.SetToolTip(cmdSsq, "Sum of squared residuals between sim and obs") - ttCalculator.SetToolTip(cmdVE, " Volumetric efficiency between sim and obs (Value is between 0 and 1)") - - ' circular keyboard tooltips - ttCalculator.SetToolTip(cmdCircular, "Define a variable as circular. Specify whether the data are in radians (default), degrees, or hours.") - ttCalculator.SetToolTip(cmdCircMean, "The circular mean. For example with 1, 2, 3, 6, mean(circular(c(1,2,3,6)) gives 1.51.") - ttCalculator.SetToolTip(cmdCircSd, "The circular standard deviation. This is not the sqrt(circular.var). It is reasonably close to the ordinary sd for data in radians.") - ttCalculator.SetToolTip(cmdCircRho, "The mean resultant length is between 0 and 1. Small values imply large (circular) variation. For 1,2,3,6 rho is 0.4036. With 1,2,3,4,5,6 it is 0.049.") - ttCalculator.SetToolTip(cmdCircRange, "Circular range is the shortest arc containing the data. For example with 1,2,3,6 gives 3.28 (6 is also -0.28 on circle from 0 to 2*pi)") - ttCalculator.SetToolTip(cmdCircVar, "The circular variance is (1 - rho), so between 0 and 1, with small values implying low (circular) variation. For 1,2,3,6 var is 0.5964. With 1,2,3,4,5,6 var is 0.951.") - ttCalculator.SetToolTip(cmdCircQuantiles, "Defined quantiles round the circle. With 0.5 it is the (circular) median, so is 1.5 for 1,2,3,6.") - ttCalculator.SetToolTip(cmdCircMax, "Largest value round the circle. For example, for 1,2,3,6 max is 3.") - ttCalculator.SetToolTip(cmdCircMin, " Smallest value round the circle. For 1,2,3,6 min is 6. (values are from 6 (almost 2 * pi to 3)") - ttCalculator.SetToolTip(cmdCircQ1, "Lower quartile round the circle. For 1,2,3,6, q1 is 0.68") - ttCalculator.SetToolTip(cmdCircQ3, "Upper quartile round the circle. For 1,2,3,6 q3 is 2.25.") - ttCalculator.SetToolTip(cmdMedianHL, " Median using Hodges-Lehmann estimate. For example with 1,2,3,6, medianHL (and median) give 1.5.") - ttCalculator.SetToolTip(cmdCircMedian, "Circular median. For example with 23 and 2 representing hours, median(circular(c(23,2), units=""hours"")) gives 0,5.") - ttCalculator.SetToolTip(cmdAngVar, "The angular variance is twice the circular variance, so between 0 and 2.") - ttCalculator.SetToolTip(cmdA1, "Ratio of Bessel functions for values of kappa parameter. Used in the von Mises (circular normal) distribution kappa = 0.9 gives A1 same as rho value for 1,2,3,6 data.") - ttCalculator.SetToolTip(cmdAngDev, "The angular deviation is square root of the angular variance, so between 0 and sqrt(2).") - - 'Dates/Times keyboard tooltips - ttCalculator.SetToolTip(cmdDate, "Get the date part of a date-time variable") - ttCalculator.SetToolTip(cmdAsDate, "Converts a character or numeric variable into a date. For example as_date(30) or as_date(""19700131"") or as.date(""1970.jan-31"") each give 1970-01-31") - ttCalculator.SetToolTip(cmdDateTime, "Converts a character or numeric variable into a date-time variable. For example as_datetime(30) gives 1970-01-01 00:00:30 UTC") - ttCalculator.SetToolTip(cmdTime, "Converts seconds, minutes, hours into a time variable. For example hms(185) gives 00:03:05, hms(25, 64) gives 01:04:25") - ttCalculator.SetToolTip(cmdYmd, "Makes a date variable from various character or numeric formats in year-month-day order. For example ymd(19840512) gives 1984-05-12") - ttCalculator.SetToolTip(cmdDmy, "Makes a date variable from various formats in day-month-year order. For example dmy(12051984) gives 1984-05-12") - ttCalculator.SetToolTip(cmdMdy, " Makes a date variable for mdy order. For example mdy(5121984) gives 1984-05-12. (Note alternatives of myd, ydm and dym)") - ttCalculator.SetToolTip(cmdAsTime, "Makes a time variable from numeric or character variable. For example: as_hms(185) gives 00:03:05, as_hms(""14:55:10"") gives 14:55:10") - ttCalculator.SetToolTip(cmdYmdHms, "Make a date-time variable from various character or numeric formats") - ttCalculator.SetToolTip(cmdYmdHm, " Make a date-time variable from various formats. For example ymd_hm(202406161201) gives 2024-06-16 12:01:00 UTC") - ttCalculator.SetToolTip(cmdYmdH, "Make a date-time variable from various formats. For example ymd_h(""2024.6:16,12"") gives ""2024-06-16 12:00:00 UTC""") - ttCalculator.SetToolTip(cmdLeap, "True if date is from a leap year and FALSE otherwise. For example leap(1984-05-12) is TRUE") - ttCalculator.SetToolTip(cmdYear, "Extract year from date or date-time. For example year(""1984-5-12"") gives 1984") - ttCalculator.SetToolTip(cmdMonth, "Extract month from a date or date-time variable") - ttCalculator.SetToolTip(cmdDay, "Extract day in month from date or date-time. For example day(""1984-5-12"" gives 12") - ttCalculator.SetToolTip(cmdYday, "Gives the day in the year, and depends on leap year. For example yday(""1984-3-1"") gives 61, while yday(""1986-3-1"") gives 60") - ttCalculator.SetToolTip(cmdWday, "Gives the day of the week from a date, or date-time variable. For example wday(""1984--5-12"", label=TRUE) gives Sat") - ttCalculator.SetToolTip(cmdD_In_M, "Gives the number of days in the month from date, or date-time. For example d_in_m(""1984_2-12"") gives 29 as 1984 is a leap year") - ttCalculator.SetToolTip(cmdAm, "TRUE or FALSE from date-time variable. For example am(""1984-05-12 14:23:45"") is FALSE") - ttCalculator.SetToolTip(cmdPm, "TRUE or FALSE from date-time variable. For example pm(""1984-05-12 14:23:45"") is TRUE") - ttCalculator.SetToolTip(cmdHour, "Extract hour from date-time variable. For example hour(""1984-05-12 14:23:45"") is 14. Also hour(""1984-05-12"") is 0") - ttCalculator.SetToolTip(cmdMinutes, "Extract minute from date-time variable. For example minute(""1984-05-12 14:23:45"") Is 23") - ttCalculator.SetToolTip(cmdSec, "Extract second from date-time variable. For example second(""1984-05-12 14:23:45"") is 45") - ttCalculator.SetToolTip(cmdQuarter, " 3-month period of the year from a date or date-time variable. For example quarter(""1984-05-12"") gives 2") - - Const strTooltipCmdLength = "number Of observations: For example length(c(1,2,3,4,NA)) = 5 " + ttCalculator.SetToolTip(cmdPbias, "percent bias between sim and obs") + ttCalculator.SetToolTip(cmdPbiasfdc, "percent bias in the slope of the midsegment of the flow duration curve") + ttCalculator.SetToolTip(cmdRd, "relative index of agreement (d) between sim and obs. (Value is between 0 and 1)") + ttCalculator.SetToolTip(cmdRmse, "root mean square error between sim and obs, so the standard deviation of the model prediction error") + ttCalculator.SetToolTip(cmdRNSE, "relative Nash-Sutcliffe efficiency between sim and obs") + ttCalculator.SetToolTip(cmdRPearson, "correlation between sim and obs") + ttCalculator.SetToolTip(cmdRSD, "ratio of standard deviations between sim and obs") + ttCalculator.SetToolTip(cmdRsr, "ratio of the root mean square error between sim and obs to the standard deviation of obs") + ttCalculator.SetToolTip(cmdSsq, "sum of squared residuals between sim and obs") + ttCalculator.SetToolTip(cmdVE, " volumetric efficiency between sim and obs (Value is between 0 and 1)") + + 'Wakefield Tooltips + ttCalculator.SetToolTip(cmdAge, "Sample of ages, with default from 20 to 35") + ttCalculator.SetToolTip(cmdAnimal, "Sample of animals, with default of 10 from a list of 591 animals!") + ttCalculator.SetToolTip(cmdPet, "Sample of pets. Default is dog, cat, none, bird, horse, with given probabilities") + ttCalculator.SetToolTip(cmdAnswer, " Sample of No or Yes, with defaults of equal probability") + ttCalculator.SetToolTip(cmdCar, "Sample of cars, with datasets mtcars makes as default") + ttCalculator.SetToolTip(cmdChildren, "Sample of number of children, with default 0 to 10 and defined probabilities") + ttCalculator.SetToolTip(cmdCoin, "Sample giving heads or tails with default of equal probability") + ttCalculator.SetToolTip(cmdColor, "Sample by default from the 657 colours in the grDevices package") + ttCalculator.SetToolTip(cmdPrimary, "Sample by default from the colours, red, green, blue, yellow, black, and white. Are those your primary colours?") + ttCalculator.SetToolTip(cmdWakefieldDates, " Sample of dates with default being dates in order, by month, for the past year") + ttCalculator.SetToolTip(cmdDeath, "Sample giving FALSE/TRUE with default being equally likely") + ttCalculator.SetToolTip(cmdDice, "Sample with default being equally likely from a 6 sided dice") + ttCalculator.SetToolTip(cmdDna, "Sample with default being equally likely from Guanine, Adenine, Thymine, Cytosine") + ttCalculator.SetToolTip(cmdDob, "Sample of dates, with default being for 2 years, starting 15 years ago") + ttCalculator.SetToolTip(cmdDummy, "Sample of 0 and 1, with default equally likely") + ttCalculator.SetToolTip(cmdEducation, "Sample of 12 education levels from No education to doctorate with defined probabilities") + ttCalculator.SetToolTip(cmdEmployment, "Sample of 5 employment levels, namely: full-time, part-time, unemployed, retired, student") + ttCalculator.SetToolTip(cmdEye, "Sample of 5 eye colours, namely: brown, blue green, hazel, grey") + ttCalculator.SetToolTip(cmdGrade_Level, "Sample of grade levels from 1 to 12") + ttCalculator.SetToolTip(cmdGrade, "Sample from normal disribution with default mean 88 and sd 4. See also grade_letter and gpa") + ttCalculator.SetToolTip(cmdGrade_Letter, "Sample from normal distribution with default mean 88 snd sd 4, with fixed translation into A+ to F") + ttCalculator.SetToolTip(cmdGpa, "Sample from normal distribution with default mean 88 and sd 4, with fixed translation into gpa of 4 to 0") + ttCalculator.SetToolTip(cmdGroup, "Sample generating 2 groups, with default of random assignment to Control and Treatment, with equal probabilities") + ttCalculator.SetToolTip(cmdHair, "Sample with default of 4 hair colours, brown, black, blonde, red, and defined probabilities") + ttCalculator.SetToolTip(cmdHeight, "Sample from normal distribution with default mean 69, and sd 3.75, min 1, and no specified max, rounded to no decimals") + ttCalculator.SetToolTip(cmdIncome, "Sample from a gamma distribution with mean 40,000 and shape 2. (Multiply the result to change the mean)") + ttCalculator.SetToolTip(cmdInternet_Browser, "Sample from ""Which browser do you use?"" with Chrome, IE, Firefox, Safari, Opera, Android, being the options") + ttCalculator.SetToolTip(cmdIq, "Sample from normal distribution with default of mean 100 and sd 15 - not 10 as provided by the package") + ttCalculator.SetToolTip(cmdLanguage, "Sample of world's languages with default being list of 99 languages, provided, together with their proportions") + ttCalculator.SetToolTip(cmdWakefieldLower, "Sample of single letters, with default being one of a,b,c,d,e") + ttCalculator.SetToolTip(cmdMath, "Sample of integers with default of 1 to 4, and probabilities based on New York grading in maths for Grades 3 to 8 children. (Called level instead if equally likely)") + ttCalculator.SetToolTip(cmdWakefieldMinute, "Sample of minutes as H:M:S time elements. (Tweak command to hours or seconds if needed)") + ttCalculator.SetToolTip(cmdLikert, "Sample from 5-point scale, ranging from strongly agree to strongly disagree, with default of equal probabilities") + ttCalculator.SetToolTip(cmdLorem_ipsum, "Provides random gibberish text, based on Latin") + ttCalculator.SetToolTip(cmdMarital, "Sample with default of 5 categories, Married, Divorced, Widowed, Separated, Never Married, equally likely") + ttCalculator.SetToolTip(cmdMilitary, "Sample with default of 5 categories, Army, etc, and proportions to match US military") + ttCalculator.SetToolTip(cmdWakefield_Month, "Sample of months with default using full names for all months and equal proportions") + ttCalculator.SetToolTip(cmdName, "Sample of names, with default from provided list of 95,025 different gender-neutral names, (so sampled without replacement)") + ttCalculator.SetToolTip(cmdNormal, "Sample from normal distribution, with default being standard normal, (mean 0, sd 1) and no min or max values specified") + ttCalculator.SetToolTip(cmdPolitical, "Sample of political parties with default being 5 categories based on US registered voters") + ttCalculator.SetToolTip(cmdRace, "Sample with default of 8 races (white, to Hawaiaan) and US proportions") + ttCalculator.SetToolTip(cmdReligion, "Sample with default of 8 religions and world ratios of numbers in each") + ttCalculator.SetToolTip(cmdSat, "Sample of SAT scores. Normal distribution and default changed from package values to give mean of 1000 and maximum of 1600") + ttCalculator.SetToolTip(cmdSentence, "Sample of sentences with default supplied list from 2012 presidential debate") + ttCalculator.SetToolTip(cmdGender, "Sample of male, female with default proportions matching gender makeup") + ttCalculator.SetToolTip(cmdSex_Inclusive, "Sample of male, female, intersex, with default proportion of transgender from 2011 report") + ttCalculator.SetToolTip(cmdWakefieldTimes, "Sample of times of day as H:M:S time elements") + ttCalculator.SetToolTip(cmdSmokes, "Logical (TRUE/FALSE) sample with default of 18% smokers") + ttCalculator.SetToolTip(cmdSpeed, "Sample from normal distribution, with default mean 55 and sd 10") + ttCalculator.SetToolTip(cmdState, "Sample with default from the 50 US states in proportion to their 2010 populations") + ttCalculator.SetToolTip(cmdString, "Sample with default of 10 random alphanumeric characters") + ttCalculator.SetToolTip(cmdWakefieldUpper, "Sample of single capital letter, with default being one of A, B, C, D, E") + ttCalculator.SetToolTip(cmdValid, "Logical (TRUE/FALSE) sample with default being equal probability") + ttCalculator.SetToolTip(cmdWakefield_Year, "Sample of years with default from 1996 to current year, with equal probability") + ttCalculator.SetToolTip(cmdLikert7, " Sample from 7-point scale, ranging from strongly agree to strongly disagree, with default of equal probabilities") + + + Const strTooltipCmdLength = "number of observations: For example length(c(1,2,3,4,NA)) = 5 " ttCalculator.SetToolTip(cmdLength, strTooltipCmdLength) ttCalculator.SetToolTip(cmdListLength, strTooltipCmdLength) @@ -1513,7 +1528,7 @@ Public Class ucrCalculator Private Sub cmdYear_Click(sender As Object, e As EventArgs) Handles cmdYear.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::year(x= )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::year(x= )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::year()", 1) End If @@ -1521,7 +1536,7 @@ Public Class ucrCalculator Private Sub cmdMonth_Click(sender As Object, e As EventArgs) Handles cmdMonth.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::month(x= , label=FALSE, abbr=TRUE)", 26) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::month(x= , label=FALSE, abbr=TRUE)", 25) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::month()", 1) End If @@ -1529,7 +1544,7 @@ Public Class ucrCalculator Private Sub cmdDay_Click(sender As Object, e As EventArgs) Handles cmdDay.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::day(x= )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::day(x= )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::day()", 1) End If @@ -1537,7 +1552,7 @@ Public Class ucrCalculator Private Sub cmdWday_Click(sender As Object, e As EventArgs) Handles cmdWday.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::wday(x= , label=FALSE, abbr=TRUE)", 26) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::wday(x= , label=FALSE, abbr=TRUE)", 25) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::wday()", 1) End If @@ -1545,7 +1560,7 @@ Public Class ucrCalculator Private Sub cmdYday_Click(sender As Object, e As EventArgs) Handles cmdYday.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::yday(x= )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::yday(x= )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::yday()", 1) End If @@ -1553,47 +1568,15 @@ Public Class ucrCalculator Private Sub cmdDate_Click(sender As Object, e As EventArgs) Handles cmdDate.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::date(x= )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::date(x= )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::date()", 1) End If End Sub - Private Sub cmdAsDate_Click(sender As Object, e As EventArgs) Handles cmdAsDate.Click - If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::as_date(x= )", 2) - Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::as_date()", 1) - End If - End Sub - - Private Sub cmdYmdHms_Click(sender As Object, e As EventArgs) Handles cmdYmdHms.Click - If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_hms(x= ) ", 3) - Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_hms() ", 2) - End If - End Sub - - Private Sub cmdYmdHm_Click(sender As Object, e As EventArgs) Handles cmdYmdHm.Click - If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_hm(x= ) ", 3) - Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_hm() ", 2) - End If - End Sub - - Private Sub cmdYmdH_Click(sender As Object, e As EventArgs) Handles cmdYmdH.Click - If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_h(x= ) ", 3) - Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_h()", 1) - End If - End Sub - Private Sub cmdLeap_Click(sender As Object, e As EventArgs) Handles cmdLeap.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::leap_year(date= )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::leap_year(x= )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::leap_year()", 1) End If @@ -1601,7 +1584,7 @@ Public Class ucrCalculator Private Sub cmdYmd_Click(sender As Object, e As EventArgs) Handles cmdYmd.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd(x= )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd(x= )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd()", 1) End If @@ -1609,14 +1592,14 @@ Public Class ucrCalculator Private Sub cmdMdy_Click(sender As Object, e As EventArgs) Handles cmdMdy.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::mdy(x= )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::mdy(x= )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::mdy()", 1) End If End Sub Private Sub cmdDmy_Click(sender As Object, e As EventArgs) Handles cmdDmy.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::dmy(x= )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::dmy(x= )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::dmy()", 1) End If @@ -1625,42 +1608,42 @@ Public Class ucrCalculator Private Sub cmdHour_Click(sender As Object, e As EventArgs) Handles cmdHour.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::hour(x = )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::hour(x = )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::hour()", 1) End If End Sub Private Sub cmdMinutes_Click(sender As Object, e As EventArgs) Handles cmdMinutes.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::minute(x = )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::minute(x = )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::minute()", 1) End If End Sub Private Sub cmdSec_Click(sender As Object, e As EventArgs) Handles cmdSec.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::second(x = )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::second(x = )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::second()", 1) End If End Sub Private Sub cmdAm_Click(sender As Object, e As EventArgs) Handles cmdAm.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::am(x = )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::am(x = )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::am()", 1) End If End Sub Private Sub cmdD_In_M_Click(sender As Object, e As EventArgs) Handles cmdD_In_M.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::days_in_month(x = )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::days_in_month(x = )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::days_in_month()", 1) End If End Sub Private Sub cmdQuarter_Click(sender As Object, e As EventArgs) Handles cmdQuarter.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::quarter(x= , with_year = FALSE, fiscal_start = 1 )", 40) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::quarter(x =, with_year = FALSE, fiscal_start = 1 )", 39) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::quarter()", 1) End If @@ -2303,20 +2286,21 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldDeathFunction.ToScript, 0) End Sub - Private Sub cmdDied_Click(sender As Object, e As EventArgs) Handles cmdDied.Click - Dim clsWakefieldDiedFunction As New RFunction + Private Sub cmdGrade_Letter_Click(sender As Object, e As EventArgs) Handles cmdGrade_Letter.Click + Dim clsWakefieldgrade_letterFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsWakefieldDiedFunction.SetPackageName("wakefield") - clsWakefieldDiedFunction.SetRCommand("died") - clsWakefieldDiedFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldDiedFunction.AddParameter("prob", "NULL", iPosition:=1) - clsWakefieldDiedFunction.AddParameter("name", Chr(34) & "Died" & Chr(34), iPosition:=2) + clsWakefieldgrade_letterFunction.SetPackageName("wakefield") + clsWakefieldgrade_letterFunction.SetRCommand("grade_letter") + clsWakefieldgrade_letterFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldgrade_letterFunction.AddParameter("mean", "88", iPosition:=1) + clsWakefieldgrade_letterFunction.AddParameter("sd", "4", iPosition:=2) + clsWakefieldgrade_letterFunction.AddParameter("name", Chr(34) & "Grade_Letter" & Chr(34), iPosition:=3) - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldDiedFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldgrade_letterFunction.ToScript, 0) End Sub Private Sub cmdDice_Click(sender As Object, e As EventArgs) Handles cmdDice.Click @@ -2707,7 +2691,7 @@ Public Class ucrCalculator clsWakefieldIQFunction.SetRCommand("iq") clsWakefieldIQFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) clsWakefieldIQFunction.AddParameter("mean", "100", iPosition:=1) - clsWakefieldIQFunction.AddParameter("sd", "10", iPosition:=2) + clsWakefieldIQFunction.AddParameter("sd", "15", iPosition:=2) clsWakefieldIQFunction.AddParameter("min", "0", iPosition:=3) clsWakefieldIQFunction.AddParameter("max", "NULL", iPosition:=4) clsWakefieldIQFunction.AddParameter("digits", "0", iPosition:=5) @@ -2734,22 +2718,6 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLanguageFunction.ToScript, 0) End Sub - Private Sub cmdLevel_Click(sender As Object, e As EventArgs) Handles cmdLevel.Click - Dim clsWakefieldLevelFunction As New RFunction - Dim clsWakefieldNrowFunction As New RFunction - - clsWakefieldNrowFunction.SetRCommand("nrow") - clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - - clsWakefieldLevelFunction.SetPackageName("wakefield") - clsWakefieldLevelFunction.SetRCommand("level") - clsWakefieldLevelFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldLevelFunction.AddParameter("x", "1:4", iPosition:=1) - clsWakefieldLevelFunction.AddParameter("prob", "NULL", iPosition:=2) - clsWakefieldLevelFunction.AddParameter("name", Chr(34) & "Level" & Chr(34), iPosition:=3) - - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLevelFunction.ToScript, 0) - End Sub Private Sub cmdMath_Click(sender As Object, e As EventArgs) Handles cmdMath.Click Dim clsWakefieldMathFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction @@ -2774,28 +2742,22 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldMathFunction.ToScript, 0) End Sub - Private Sub cmdEla_Click(sender As Object, e As EventArgs) Handles cmdEla.Click - Dim clsWakefieldElaFunction As New RFunction + Private Sub cmdWakefieldMinute_Click(sender As Object, e As EventArgs) Handles cmdWakefieldMinute.Click + Dim clsWakefieldMinuteFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction - Dim clsELAProbFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsELAProbFunction.SetRCommand("c") - clsELAProbFunction.AddParameter("0.3161", "0.29829", iPosition:=0, bIncludeArgumentName:=False) - clsELAProbFunction.AddParameter("0.37257", "0.37257", iPosition:=1, bIncludeArgumentName:=False) - clsELAProbFunction.AddParameter("0.2233", "0.2233", iPosition:=2, bIncludeArgumentName:=False) - clsELAProbFunction.AddParameter("0.08803", "0.08803", iPosition:=3, bIncludeArgumentName:=False) - - clsWakefieldElaFunction.SetPackageName("wakefield") - clsWakefieldElaFunction.SetRCommand("ela") - clsWakefieldElaFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldElaFunction.AddParameter("x", "1:4", iPosition:=1) - clsWakefieldElaFunction.AddParameter("prob", clsRFunctionParameter:=clsELAProbFunction, iPosition:=2) - clsWakefieldElaFunction.AddParameter("name", Chr(34) & "ELA" & Chr(34), iPosition:=3) + clsWakefieldMinuteFunction.SetPackageName("wakefield") + clsWakefieldMinuteFunction.SetRCommand("minute") + clsWakefieldMinuteFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldMinuteFunction.AddParameter("x", "seq(0, 59, by = 1)/60 ", iPosition:=1) + clsWakefieldMinuteFunction.AddParameter("prob", "NULL", iPosition:=2) + clsWakefieldMinuteFunction.AddParameter("random", "FALSE", iPosition:=3) + clsWakefieldMinuteFunction.AddParameter("name", Chr(34) & "Minute" & Chr(34), iPosition:=4) - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldElaFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldMinuteFunction.ToScript, 0) End Sub Private Sub cmdGpa_Click(sender As Object, e As EventArgs) Handles cmdGpa.Click @@ -3088,10 +3050,10 @@ Public Class ucrCalculator clsWakefieldSatFunction.SetPackageName("wakefield") clsWakefieldSatFunction.SetRCommand("sat") clsWakefieldSatFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldSatFunction.AddParameter("mean", "1500", iPosition:=1) - clsWakefieldSatFunction.AddParameter("sd", "100", iPosition:=2) - clsWakefieldSatFunction.AddParameter("min", "0", iPosition:=3) - clsWakefieldSatFunction.AddParameter("max", "2400", iPosition:=4) + clsWakefieldSatFunction.AddParameter("mean", "1000", iPosition:=1) + clsWakefieldSatFunction.AddParameter("sd", "150", iPosition:=2) + clsWakefieldSatFunction.AddParameter("min", "400", iPosition:=3) + clsWakefieldSatFunction.AddParameter("max", "1600", iPosition:=4) clsWakefieldSatFunction.AddParameter("digits", "0", iPosition:=5) clsWakefieldSatFunction.AddParameter("name", Chr(34) & "SAT" & Chr(34), iPosition:=6) @@ -3165,31 +3127,22 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldSexInclusiveFunction.ToScript, 0) End Sub - Private Sub cmdSex_Click(sender As Object, e As EventArgs) Handles cmdSex.Click - Dim clsWakefieldSexFunction As New RFunction + Private Sub cmdWakefieldTimes_Click(sender As Object, e As EventArgs) Handles cmdWakefieldTimes.Click + Dim clsWakefieldTimestampFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction - Dim clsSexListFunction As New RFunction - Dim clsSexProbFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsSexListFunction.SetRCommand("c") - clsSexListFunction.AddParameter("male", Chr(34) & "Male" & Chr(34), iPosition:=0, bIncludeArgumentName:=False) - clsSexListFunction.AddParameter("female", Chr(34) & "Female" & Chr(34), iPosition:=1, bIncludeArgumentName:=False) + clsWakefieldTimestampFunction.SetPackageName("wakefield") + clsWakefieldTimestampFunction.SetRCommand("time_stamp") + clsWakefieldTimestampFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldTimestampFunction.AddParameter("x", "seq(0, 23, by = 1)", iPosition:=1) + clsWakefieldTimestampFunction.AddParameter("prob", "NULL", iPosition:=2) + clsWakefieldTimestampFunction.AddParameter("random", "FALSE", iPosition:=3) + clsWakefieldTimestampFunction.AddParameter("name", Chr(34) & "Time" & Chr(34), iPosition:=4) - clsSexProbFunction.SetRCommand("c") - clsSexProbFunction.AddParameter("0.51219512195122", "0.51219512195122", iPosition:=0, bIncludeArgumentName:=False) - clsSexProbFunction.AddParameter("0.48780487804878", "0.48780487804878", iPosition:=1, bIncludeArgumentName:=False) - - clsWakefieldSexFunction.SetPackageName("wakefield") - clsWakefieldSexFunction.SetRCommand("sex") - clsWakefieldSexFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldSexFunction.AddParameter("x", clsRFunctionParameter:=clsSexListFunction, iPosition:=1) - clsWakefieldSexFunction.AddParameter("prob", clsRFunctionParameter:=clsSexProbFunction, iPosition:=2) - clsWakefieldSexFunction.AddParameter("name", Chr(34) & "Sex" & Chr(34), iPosition:=3) - - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldSexFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldTimestampFunction.ToScript, 0) End Sub Private Sub cmdSmokes_Click(sender As Object, e As EventArgs) Handles cmdSmokes.Click @@ -3267,22 +3220,40 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldStringFunction.ToScript, 0) End Sub - Private Sub cmdWakefield_Upper_Click(sender As Object, e As EventArgs) Handles cmdWakefield_Upper.Click - Dim clsWakefieldUpperFunction As New RFunction + Private Sub cmdWakefield_Upper_Click(sender As Object, e As EventArgs) Handles cmdWakefieldUpper.Click + Dim clsWakefieldUpper_factorFunction As New RFunction Dim clsWakefieldNrowFunction As New RFunction clsWakefieldNrowFunction.SetRCommand("nrow") clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) - clsWakefieldUpperFunction.SetPackageName("wakefield") - clsWakefieldUpperFunction.SetRCommand("upper") - clsWakefieldUpperFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) - clsWakefieldUpperFunction.AddParameter("k", "5", iPosition:=1) - clsWakefieldUpperFunction.AddParameter("x", "LETTERS", iPosition:=2) - clsWakefieldUpperFunction.AddParameter("prob", "NULL", iPosition:=3) - clsWakefieldUpperFunction.AddParameter("name", Chr(34) & "Upper" & Chr(34), iPosition:=4) + clsWakefieldUpper_factorFunction.SetPackageName("wakefield") + clsWakefieldUpper_factorFunction.SetRCommand("upper_factor") + clsWakefieldUpper_factorFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldUpper_factorFunction.AddParameter("k", "5", iPosition:=1) + clsWakefieldUpper_factorFunction.AddParameter("x", "LETTERS", iPosition:=2) + clsWakefieldUpper_factorFunction.AddParameter("prob", "NULL", iPosition:=3) + clsWakefieldUpper_factorFunction.AddParameter("name", Chr(34) & "Upper" & Chr(34), iPosition:=4) - ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldUpperFunction.ToScript, 0) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldUpper_factorFunction.ToScript, 0) + End Sub + + Private Sub cmdWakefieldLower_click(sender As Object, e As EventArgs) Handles cmdWakefieldLower.Click + Dim clsWakefieldLower_FactorFunction As New RFunction + Dim clsWakefieldNrowFunction As New RFunction + + clsWakefieldNrowFunction.SetRCommand("nrow") + clsWakefieldNrowFunction.AddParameter("x", ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, iPosition:=0) + + clsWakefieldLower_FactorFunction.SetPackageName("wakefield") + clsWakefieldLower_FactorFunction.SetRCommand("lower_factor") + clsWakefieldLower_FactorFunction.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) + clsWakefieldLower_FactorFunction.AddParameter("k", "5", iPosition:=1) + clsWakefieldLower_FactorFunction.AddParameter("x", "letters", iPosition:=2) + clsWakefieldLower_FactorFunction.AddParameter("prob", "NULL", iPosition:=3) + clsWakefieldLower_FactorFunction.AddParameter("name", Chr(34) & "Lower" & Chr(34), iPosition:=4) + + ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLower_FactorFunction.ToScript, 0) End Sub Private Sub cmdValid_Click(sender As Object, e As EventArgs) Handles cmdValid.Click @@ -3320,7 +3291,7 @@ Public Class ucrCalculator Private Sub cmdCircMean_Click(sender As Object, e As EventArgs) Handles cmdCircMean.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular:: mean.circular(x = , na.rm = TRUE, control.circular = list())", 43) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular:: mean.circular(x = , na.rm = FALSE, control.circular = list())", 44) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::mean.circular()", 1) End If @@ -3328,7 +3299,7 @@ Public Class ucrCalculator Private Sub cmdCircMedian_Click(sender As Object, e As EventArgs) Handles cmdCircMedian.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::median.circular(x = , na.rm = TRUE)", 16) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::median.circular(x = , na.rm = FALSE)", 17) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::median.circular()", 1) End If @@ -3336,7 +3307,7 @@ Public Class ucrCalculator Private Sub cmdMedianHL_Click(sender As Object, e As EventArgs) Handles cmdMedianHL.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular(x = , na.rm = TRUE, method = c(""HL1"",""HL2"",""HL3""), prop = NULL)", 60) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular(x = , na.rm = FALSE, method = c(HL1,HL2,HL3), prop = NULL)", 55) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular()", 1) End If @@ -3344,7 +3315,7 @@ Public Class ucrCalculator Private Sub cmdCircRange_Click(sender As Object, e As EventArgs) Handles cmdCircRange.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::range.circular(x = , test = FALSE, na.rm = TRUE, finite = FALSE, control.circular = list(), )", 75) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::range.circular(x = , test = FALSE, na.rm = FALSE, finite = FALSE, control.circular = list(), )", 76) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::range.circular()", 1) End If @@ -3352,7 +3323,7 @@ Public Class ucrCalculator Private Sub cmdCircSd_Click(sender As Object, e As EventArgs) Handles cmdCircSd.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::sd.circular(x = , na.rm = TRUE)", 17) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::sd.circular(x = , na.rm = FALSE)", 18) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::sd.circular()", 1) End If @@ -3360,7 +3331,7 @@ Public Class ucrCalculator Private Sub cmdCircVar_Click(sender As Object, e As EventArgs) Handles cmdCircVar.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::var.circular(x = , na.rm = TRUE)", 17) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::var.circular(x = , na.rm = FALSE)", 18) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::var.circular()", 1) End If @@ -3370,13 +3341,13 @@ Public Class ucrCalculator If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::A1(kappa = )", 2) Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::A1()", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::besselI()", 1) End If End Sub Private Sub cmdAngVar_Click(sender As Object, e As EventArgs) Handles cmdAngVar.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.variance(x = , na.rm = TRUE)", 16) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.variance(x = , na.rm = FALSE)", 17) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.variance()", 1) End If @@ -3384,7 +3355,7 @@ Public Class ucrCalculator Private Sub cmdAngDev_Click(sender As Object, e As EventArgs) Handles cmdAngDev.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.deviation(x = , na.rm = TRUE)", 16) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.deviation(x = , na.rm = FALSE)", 17) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.deviation()", 1) End If @@ -3392,7 +3363,7 @@ Public Class ucrCalculator Private Sub cmdCircQ1_Click(sender As Object, e As EventArgs) Handles cmdCircQ1.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.25, na.rm = TRUE, names = TRUE, type = 7)", 54) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.25, na.rm = FALSE, names = TRUE, type = 7)", 55) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.25)", 16) End If @@ -3400,7 +3371,7 @@ Public Class ucrCalculator Private Sub cmdCircMin_Click(sender As Object, e As EventArgs) Handles cmdCircMin.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0, na.rm = TRUE, names = TRUE, type = 7)", 51) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0, na.rm = FALSE, names = TRUE, type = 7)", 52) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0)", 13) End If @@ -3408,7 +3379,7 @@ Public Class ucrCalculator Private Sub cmdCircMax_Click(sender As Object, e As EventArgs) Handles cmdCircMax.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 1, na.rm = TRUE, names = TRUE, type = 7)", 51) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 1, na.rm = FALSE, names = TRUE, type = 7)", 52) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 1)", 13) End If @@ -3416,7 +3387,7 @@ Public Class ucrCalculator Private Sub cmdCircQ3_Click(sender As Object, e As EventArgs) Handles cmdCircQ3.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.75, na.rm = TRUE, names = TRUE, type = 7)", 54) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.75, na.rm = FALSE, names = TRUE, type = 7)", 55) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.75)", 16) End If @@ -3424,15 +3395,15 @@ Public Class ucrCalculator Private Sub cmdCircQuantiles_Click_1(sender As Object, e As EventArgs) Handles cmdCircQuantiles.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25), na.rm = TRUE, names = TRUE, type = 7)", 65) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25), na.rm = FALSE, names = TRUE, type = 7)", 66) Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25))", 27) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25))", 28) End If End Sub Private Sub cmdCircRho_Click_1(sender As Object, e As EventArgs) Handles cmdCircRho.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::rho.circular(x = , na.rm = TRUE)", 16) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::rho.circular(x = , na.rm = FALSE)", 17) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::rho.circular()", 1) End If @@ -3768,7 +3739,7 @@ Public Class ucrCalculator clsWakefieldLikert7Function.AddParameter("n", clsRFunctionParameter:=clsWakefieldNrowFunction, iPosition:=0) clsWakefieldLikert7Function.AddParameter("x", clsRFunctionParameter:=clsLikert7ListFunction, iPosition:=1) clsWakefieldLikert7Function.AddParameter("prob", "NULL", iPosition:=2) - clsWakefieldLikert7Function.AddParameter("name", Chr(34) & "Likert" & Chr(34), iPosition:=3) + clsWakefieldLikert7Function.AddParameter("name", Chr(34) & "Likert7" & Chr(34), iPosition:=3) ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsWakefieldLikert7Function.ToScript, 0) End Sub @@ -4123,20 +4094,12 @@ Public Class ucrCalculator Private Sub cmdTime_Click(sender As Object, e As EventArgs) Handles cmdTime.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::hms(seconds = , minutes = , hours = , days = )", 33) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::hms(seconds = , minutes = , hours = , days = )", 32) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::hms()", 1) End If End Sub - Private Sub cmdAsTime_Click(sender As Object, e As EventArgs) Handles cmdAsTime.Click - If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::as_hms(x= )", 2) - Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::as_hms()", 1) - End If - End Sub - Private Sub cmdPm_Click(sender As Object, e As EventArgs) Handles cmdPm.Click If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::pm(x = )", 2) From 9cc20ed0859a6c20beadc599a07e8ca9fbc08e8c Mon Sep 17 00:00:00 2001 From: JUMA Date: Thu, 28 Mar 2024 17:06:18 +0300 Subject: [PATCH 68/88] changes --- instat/ucrCalculator.Designer.vb | 1070 +++++++++++++++--------------- instat/ucrCalculator.vb | 113 +++- 2 files changed, 627 insertions(+), 556 deletions(-) diff --git a/instat/ucrCalculator.Designer.vb b/instat/ucrCalculator.Designer.vb index 4bc4c83985d..da780ed375d 100644 --- a/instat/ucrCalculator.Designer.vb +++ b/instat/ucrCalculator.Designer.vb @@ -62,7 +62,30 @@ Partial Class ucrCalculator Me.cmd0 = New System.Windows.Forms.Button() Me.cmd1 = New System.Windows.Forms.Button() Me.grpDates = New System.Windows.Forms.GroupBox() - Me.cmdRHelp = New instat.ucrSplitButton() + Me.cmdYmdHms = New System.Windows.Forms.Button() + Me.cmdYmdHm = New System.Windows.Forms.Button() + Me.cmdAsDate = New System.Windows.Forms.Button() + Me.cmdAsTime = New System.Windows.Forms.Button() + Me.cmdYmdH = New System.Windows.Forms.Button() + Me.cmdPm = New System.Windows.Forms.Button() + Me.cmdTime = New System.Windows.Forms.Button() + Me.cmdDateTime = New System.Windows.Forms.Button() + Me.cmdQuarter = New System.Windows.Forms.Button() + Me.cmdD_In_M = New System.Windows.Forms.Button() + Me.cmdAm = New System.Windows.Forms.Button() + Me.cmdSec = New System.Windows.Forms.Button() + Me.cmdHour = New System.Windows.Forms.Button() + Me.cmdMinutes = New System.Windows.Forms.Button() + Me.cmdDmy = New System.Windows.Forms.Button() + Me.cmdDay = New System.Windows.Forms.Button() + Me.cmdMonth = New System.Windows.Forms.Button() + Me.cmdYear = New System.Windows.Forms.Button() + Me.cmdDate = New System.Windows.Forms.Button() + Me.cmdYday = New System.Windows.Forms.Button() + Me.cmdWday = New System.Windows.Forms.Button() + Me.cmdMdy = New System.Windows.Forms.Button() + Me.cmdYmd = New System.Windows.Forms.Button() + Me.cmdLeap = New System.Windows.Forms.Button() Me.ContextMenuStripDate = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.DateLubridateToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DateHmsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -100,7 +123,6 @@ Partial Class ucrCalculator Me.cmdGCD = New System.Windows.Forms.Button() Me.cmdGeneratePrimes = New System.Windows.Forms.Button() Me.cmdNthPrime = New System.Windows.Forms.Button() - Me.cmdIntegerRHelp = New instat.ucrSplitButton() Me.ContextMenuStripInteger = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.GmpToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DescToolsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -123,7 +145,6 @@ Partial Class ucrCalculator Me.cmdIsPrime = New System.Windows.Forms.Button() Me.cmdBigZ = New System.Windows.Forms.Button() Me.grpFactor = New System.Windows.Forms.GroupBox() - Me.cmdTransformHelp = New instat.ucrSplitButton() Me.ContextMenuStripFactor = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.FactorForcatsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cmdShuffle = New System.Windows.Forms.Button() @@ -147,7 +168,6 @@ Partial Class ucrCalculator Me.cmdFactor = New System.Windows.Forms.Button() Me.cmdAnon = New System.Windows.Forms.Button() Me.grpHydroGOF = New System.Windows.Forms.GroupBox() - Me.cmdHydroHelp = New instat.ucrSplitButton() Me.ContextMenuStripHydroGOF = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.HydroGOFToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cmdVE = New System.Windows.Forms.Button() @@ -228,7 +248,6 @@ Partial Class ucrCalculator Me.cmdGroup = New System.Windows.Forms.Button() Me.cmdGrade = New System.Windows.Forms.Button() Me.grpMaths = New System.Windows.Forms.GroupBox() - Me.cmdMathsHelp = New instat.ucrSplitButton() Me.ContextMenuStripMaths = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.MathsBaseStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.MathsStatsStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -262,7 +281,6 @@ Partial Class ucrCalculator Me.cmdwhichmax = New System.Windows.Forms.Button() Me.cmdwheremax = New System.Windows.Forms.Button() Me.cmdwhichmin = New System.Windows.Forms.Button() - Me.cmdSummaryRHelp = New instat.ucrSplitButton() Me.ContextMenuStripSummary = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.BaseToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem() Me.StatsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -316,7 +334,6 @@ Partial Class ucrCalculator Me.cmdVar = New System.Windows.Forms.Button() Me.grpProbabilty = New System.Windows.Forms.GroupBox() Me.cmdPascal = New System.Windows.Forms.Button() - Me.cmdProbRHelp = New instat.ucrSplitButton() Me.ContextMenuStripProbability = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.ProbStatsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ProbBaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -365,7 +382,6 @@ Partial Class ucrCalculator Me.cmdDecimals = New System.Windows.Forms.Button() Me.cmdMASSFractions = New System.Windows.Forms.Button() Me.cmdScale = New System.Windows.Forms.Button() - Me.cmdTransformRHelp = New instat.ucrSplitButton() Me.ContextMenuStripTransform = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.BaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DplyrToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -400,7 +416,6 @@ Partial Class ucrCalculator Me.cmdLead = New System.Windows.Forms.Button() Me.cmdLag = New System.Windows.Forms.Button() Me.grpLogical = New System.Windows.Forms.GroupBox() - Me.cmdLogicalHelp = New instat.ucrSplitButton() Me.ContextMenuStripLogical = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.LogBaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.LogDplyrToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -464,7 +479,6 @@ Partial Class ucrCalculator Me.cmdSquishb = New System.Windows.Forms.Button() Me.ttCalculator = New System.Windows.Forms.ToolTip(Me.components) Me.grpCircular = New System.Windows.Forms.GroupBox() - Me.cmdCircularHelp = New instat.ucrSplitButton() Me.ContextMenuStripCircular = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.CircularToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cmdCircular = New System.Windows.Forms.Button() @@ -507,7 +521,6 @@ Partial Class ucrCalculator Me.grpComplex = New System.Windows.Forms.GroupBox() Me.cmdAsComplex = New System.Windows.Forms.Button() Me.cmdComplexi = New System.Windows.Forms.Button() - Me.cmdComplexRHelp = New instat.ucrSplitButton() Me.cmdComplexTanH = New System.Windows.Forms.Button() Me.cmdComplexTan = New System.Windows.Forms.Button() Me.cmdComplexPi = New System.Windows.Forms.Button() @@ -598,30 +611,17 @@ Partial Class ucrCalculator Me.ucrInputCalOptions = New instat.ucrInputComboBox() Me.ucrSelectorForCalculations = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverForCalculation = New instat.ucrReceiverExpression() - Me.cmdYmdHms = New System.Windows.Forms.Button() - Me.cmdYmdHm = New System.Windows.Forms.Button() - Me.cmdAsDate = New System.Windows.Forms.Button() - Me.cmdAsTime = New System.Windows.Forms.Button() - Me.cmdYmdH = New System.Windows.Forms.Button() - Me.cmdPm = New System.Windows.Forms.Button() - Me.cmdTime = New System.Windows.Forms.Button() - Me.cmdDateTime = New System.Windows.Forms.Button() - Me.cmdQuarter = New System.Windows.Forms.Button() - Me.cmdD_In_M = New System.Windows.Forms.Button() - Me.cmdAm = New System.Windows.Forms.Button() - Me.cmdSec = New System.Windows.Forms.Button() - Me.cmdHour = New System.Windows.Forms.Button() - Me.cmdMinutes = New System.Windows.Forms.Button() - Me.cmdDmy = New System.Windows.Forms.Button() - Me.cmdDay = New System.Windows.Forms.Button() - Me.cmdMonth = New System.Windows.Forms.Button() - Me.cmdYear = New System.Windows.Forms.Button() - Me.cmdDate = New System.Windows.Forms.Button() - Me.cmdYday = New System.Windows.Forms.Button() - Me.cmdWday = New System.Windows.Forms.Button() - Me.cmdMdy = New System.Windows.Forms.Button() - Me.cmdYmd = New System.Windows.Forms.Button() - Me.cmdLeap = New System.Windows.Forms.Button() + Me.cmdRHelp = New instat.ucrSplitButton() + Me.cmdHydroHelp = New instat.ucrSplitButton() + Me.cmdTransformHelp = New instat.ucrSplitButton() + Me.cmdCircularHelp = New instat.ucrSplitButton() + Me.cmdMathsHelp = New instat.ucrSplitButton() + Me.cmdProbRHelp = New instat.ucrSplitButton() + Me.cmdIntegerRHelp = New instat.ucrSplitButton() + Me.cmdComplexRHelp = New instat.ucrSplitButton() + Me.cmdSummaryRHelp = New instat.ucrSplitButton() + Me.cmdTransformRHelp = New instat.ucrSplitButton() + Me.cmdLogicalHelp = New instat.ucrSplitButton() Me.grpBasic.SuspendLayout Me.grpDates.SuspendLayout Me.ContextMenuStripDate.SuspendLayout @@ -958,145 +958,387 @@ Partial Class ucrCalculator Me.grpDates.Location = New System.Drawing.Point(542, 78) Me.grpDates.Name = "grpDates" Me.grpDates.RightToLeft = System.Windows.Forms.RightToLeft.No - Me.grpDates.Size = New System.Drawing.Size(315, 275) + Me.grpDates.Size = New System.Drawing.Size(315, 291) Me.grpDates.TabIndex = 188 Me.grpDates.TabStop = False Me.grpDates.Text = "Dates/Times" ' - 'cmdRHelp + 'cmdYmdHms ' - Me.cmdRHelp.AutoSize = True - Me.cmdRHelp.ContextMenuStrip = Me.ContextMenuStripDate - Me.cmdRHelp.Location = New System.Drawing.Point(196, 238) - Me.cmdRHelp.Name = "cmdRHelp" - Me.cmdRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdRHelp.SplitMenuStrip = Me.ContextMenuStripDate - Me.cmdRHelp.TabIndex = 212 - Me.cmdRHelp.Text = "R Help" - Me.cmdRHelp.UseVisualStyleBackColor = True + Me.cmdYmdHms.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdYmdHms.Location = New System.Drawing.Point(6, 91) + Me.cmdYmdHms.Name = "cmdYmdHms" + Me.cmdYmdHms.Size = New System.Drawing.Size(75, 38) + Me.cmdYmdHms.TabIndex = 242 + Me.cmdYmdHms.Text = "ymd.hms" + Me.cmdYmdHms.UseVisualStyleBackColor = True ' - 'ContextMenuStripDate + 'cmdYmdHm ' - Me.ContextMenuStripDate.ImageScalingSize = New System.Drawing.Size(24, 24) - Me.ContextMenuStripDate.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.DateLubridateToolStripMenuItem, Me.DateHmsToolStripMenuItem}) - Me.ContextMenuStripDate.Name = "ContextMenuStrip1" - Me.ContextMenuStripDate.Size = New System.Drawing.Size(139, 52) + Me.cmdYmdHm.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdYmdHm.Location = New System.Drawing.Point(80, 91) + Me.cmdYmdHm.Name = "cmdYmdHm" + Me.cmdYmdHm.Size = New System.Drawing.Size(75, 38) + Me.cmdYmdHm.TabIndex = 241 + Me.cmdYmdHm.Text = "ymd.hm" + Me.cmdYmdHm.UseVisualStyleBackColor = True ' - 'DateLubridateToolStripMenuItem + 'cmdAsDate ' - Me.DateLubridateToolStripMenuItem.Name = "DateLubridateToolStripMenuItem" - Me.DateLubridateToolStripMenuItem.Size = New System.Drawing.Size(138, 24) - Me.DateLubridateToolStripMenuItem.Text = "lubridate" + Me.cmdAsDate.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdAsDate.Location = New System.Drawing.Point(80, 19) + Me.cmdAsDate.Name = "cmdAsDate" + Me.cmdAsDate.Size = New System.Drawing.Size(75, 38) + Me.cmdAsDate.TabIndex = 240 + Me.cmdAsDate.Text = "as.date" + Me.cmdAsDate.UseVisualStyleBackColor = True ' - 'DateHmsToolStripMenuItem + 'cmdAsTime ' - Me.DateHmsToolStripMenuItem.Name = "DateHmsToolStripMenuItem" - Me.DateHmsToolStripMenuItem.Size = New System.Drawing.Size(138, 24) - Me.DateHmsToolStripMenuItem.Text = "hms" + Me.cmdAsTime.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdAsTime.Location = New System.Drawing.Point(239, 55) + Me.cmdAsTime.Name = "cmdAsTime" + Me.cmdAsTime.Size = New System.Drawing.Size(75, 38) + Me.cmdAsTime.TabIndex = 239 + Me.cmdAsTime.Text = "as.time" + Me.cmdAsTime.UseVisualStyleBackColor = True ' - 'ContextMenuStripComplex + 'cmdYmdH ' - Me.ContextMenuStripComplex.ImageScalingSize = New System.Drawing.Size(24, 24) - Me.ContextMenuStripComplex.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ComplexBaseToolStripMenuItem}) - Me.ContextMenuStripComplex.Name = "ContextMenuStrip1" - Me.ContextMenuStripComplex.Size = New System.Drawing.Size(110, 28) + Me.cmdYmdH.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdYmdH.Location = New System.Drawing.Point(154, 91) + Me.cmdYmdH.Name = "cmdYmdH" + Me.cmdYmdH.Size = New System.Drawing.Size(86, 38) + Me.cmdYmdH.TabIndex = 238 + Me.cmdYmdH.Text = "ymd.h" + Me.cmdYmdH.UseVisualStyleBackColor = True ' - 'ComplexBaseToolStripMenuItem + 'cmdPm ' - Me.ComplexBaseToolStripMenuItem.Name = "ComplexBaseToolStripMenuItem" - Me.ComplexBaseToolStripMenuItem.Size = New System.Drawing.Size(109, 24) - Me.ComplexBaseToolStripMenuItem.Text = "base" + Me.cmdPm.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdPm.Location = New System.Drawing.Point(6, 200) + Me.cmdPm.Name = "cmdPm" + Me.cmdPm.Size = New System.Drawing.Size(75, 38) + Me.cmdPm.TabIndex = 237 + Me.cmdPm.Text = "pm" + Me.cmdPm.UseVisualStyleBackColor = True ' - 'grpInteger + 'cmdTime ' - Me.grpInteger.Controls.Add(Me.cmdPrimorial) - Me.grpInteger.Controls.Add(Me.cmdFactorize2) - Me.grpInteger.Controls.Add(Me.cmdLucas) - Me.grpInteger.Controls.Add(Me.cmdFactorize) - Me.grpInteger.Controls.Add(Me.cmdSquare) - Me.grpInteger.Controls.Add(Me.cmdTriangle) - Me.grpInteger.Controls.Add(Me.cmdPadovan) - Me.grpInteger.Controls.Add(Me.cmdAchilles) - Me.grpInteger.Controls.Add(Me.cmdHappy) - Me.grpInteger.Controls.Add(Me.cmdUgly) - Me.grpInteger.Controls.Add(Me.cmdPowerful) - Me.grpInteger.Controls.Add(Me.cmdFrugal) - Me.grpInteger.Controls.Add(Me.cmdPerfect) - Me.grpInteger.Controls.Add(Me.cmdAbundant) - Me.grpInteger.Controls.Add(Me.cmdFibonacci2) - Me.grpInteger.Controls.Add(Me.cmdPalindrome) - Me.grpInteger.Controls.Add(Me.cmdRoman) - Me.grpInteger.Controls.Add(Me.cmdHexmode) - Me.grpInteger.Controls.Add(Me.cmdOctmode) - Me.grpInteger.Controls.Add(Me.cmdKTuple) - Me.grpInteger.Controls.Add(Me.cmdTriplets) - Me.grpInteger.Controls.Add(Me.cmdThird) - Me.grpInteger.Controls.Add(Me.cmdSexy) - Me.grpInteger.Controls.Add(Me.cmdCousin) - Me.grpInteger.Controls.Add(Me.cmdTwin) - Me.grpInteger.Controls.Add(Me.cmdPhi) - Me.grpInteger.Controls.Add(Me.cmdCoprime) - Me.grpInteger.Controls.Add(Me.cmdSCM) - Me.grpInteger.Controls.Add(Me.cmdGCD) - Me.grpInteger.Controls.Add(Me.cmdGeneratePrimes) - Me.grpInteger.Controls.Add(Me.cmdNthPrime) - Me.grpInteger.Controls.Add(Me.cmdIntegerRHelp) - Me.grpInteger.Controls.Add(Me.cmdHex) - Me.grpInteger.Controls.Add(Me.cmdOctal) - Me.grpInteger.Controls.Add(Me.cmdBinary) - Me.grpInteger.Controls.Add(Me.cmdBigQ) - Me.grpInteger.Controls.Add(Me.cmdDigitSum) - Me.grpInteger.Controls.Add(Me.cmdRankPercent) - Me.grpInteger.Controls.Add(Me.cmdDivisors) - Me.grpInteger.Controls.Add(Me.cmdFibonacci) - Me.grpInteger.Controls.Add(Me.cmdNextPrime) - Me.grpInteger.Controls.Add(Me.cmdChoosez) - Me.grpInteger.Controls.Add(Me.cmdFactorial) - Me.grpInteger.Controls.Add(Me.cmdIsPrime) - Me.grpInteger.Controls.Add(Me.cmdBigZ) - Me.grpInteger.Location = New System.Drawing.Point(542, 77) - Me.grpInteger.Name = "grpInteger" - Me.grpInteger.Size = New System.Drawing.Size(385, 397) - Me.grpInteger.TabIndex = 183 - Me.grpInteger.TabStop = False - Me.grpInteger.Text = "Integer" + Me.cmdTime.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdTime.Location = New System.Drawing.Point(239, 19) + Me.cmdTime.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdTime.Name = "cmdTime" + Me.cmdTime.Size = New System.Drawing.Size(75, 38) + Me.cmdTime.TabIndex = 236 + Me.cmdTime.Text = "time" + Me.cmdTime.UseVisualStyleBackColor = True ' - 'cmdPrimorial + 'cmdDateTime ' - Me.cmdPrimorial.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdPrimorial.Location = New System.Drawing.Point(278, 227) - Me.cmdPrimorial.Name = "cmdPrimorial" - Me.cmdPrimorial.Size = New System.Drawing.Size(93, 28) - Me.cmdPrimorial.TabIndex = 47 - Me.cmdPrimorial.Text = "primorial" - Me.cmdPrimorial.UseVisualStyleBackColor = True + Me.cmdDateTime.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdDateTime.Location = New System.Drawing.Point(154, 19) + Me.cmdDateTime.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdDateTime.Name = "cmdDateTime" + Me.cmdDateTime.Size = New System.Drawing.Size(86, 38) + Me.cmdDateTime.TabIndex = 235 + Me.cmdDateTime.Text = "as.datetime" + Me.cmdDateTime.UseVisualStyleBackColor = True ' - 'cmdFactorize2 + 'cmdQuarter ' - Me.cmdFactorize2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFactorize2.Location = New System.Drawing.Point(187, 48) - Me.cmdFactorize2.Name = "cmdFactorize2" - Me.cmdFactorize2.Size = New System.Drawing.Size(93, 28) - Me.cmdFactorize2.TabIndex = 46 - Me.cmdFactorize2.Text = "factorize2" - Me.cmdFactorize2.UseVisualStyleBackColor = True + Me.cmdQuarter.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdQuarter.Location = New System.Drawing.Point(80, 127) + Me.cmdQuarter.Name = "cmdQuarter" + Me.cmdQuarter.Size = New System.Drawing.Size(75, 38) + Me.cmdQuarter.TabIndex = 234 + Me.cmdQuarter.Text = "quarter" + Me.cmdQuarter.UseVisualStyleBackColor = True ' - 'cmdLucas + 'cmdD_In_M ' - Me.cmdLucas.Location = New System.Drawing.Point(93, 77) - Me.cmdLucas.Name = "cmdLucas" - Me.cmdLucas.Size = New System.Drawing.Size(93, 28) - Me.cmdLucas.TabIndex = 45 - Me.cmdLucas.Text = "lucas" - Me.cmdLucas.UseVisualStyleBackColor = True + Me.cmdD_In_M.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdD_In_M.Location = New System.Drawing.Point(154, 164) + Me.cmdD_In_M.Name = "cmdD_In_M" + Me.cmdD_In_M.Size = New System.Drawing.Size(86, 38) + Me.cmdD_In_M.TabIndex = 233 + Me.cmdD_In_M.Text = "d_in_m" + Me.cmdD_In_M.UseVisualStyleBackColor = True ' - 'cmdFactorize + 'cmdAm ' - Me.cmdFactorize.Location = New System.Drawing.Point(93, 48) - Me.cmdFactorize.Name = "cmdFactorize" - Me.cmdFactorize.Size = New System.Drawing.Size(93, 28) - Me.cmdFactorize.TabIndex = 44 - Me.cmdFactorize.Text = "factorize" + Me.cmdAm.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdAm.Location = New System.Drawing.Point(239, 164) + Me.cmdAm.Name = "cmdAm" + Me.cmdAm.Size = New System.Drawing.Size(75, 38) + Me.cmdAm.TabIndex = 232 + Me.cmdAm.Text = "am" + Me.cmdAm.UseVisualStyleBackColor = True + ' + 'cmdSec + ' + Me.cmdSec.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdSec.Location = New System.Drawing.Point(239, 200) + Me.cmdSec.Name = "cmdSec" + Me.cmdSec.Size = New System.Drawing.Size(75, 38) + Me.cmdSec.TabIndex = 231 + Me.cmdSec.Text = "sec" + Me.cmdSec.UseVisualStyleBackColor = True + ' + 'cmdHour + ' + Me.cmdHour.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdHour.Location = New System.Drawing.Point(80, 200) + Me.cmdHour.Name = "cmdHour" + Me.cmdHour.Size = New System.Drawing.Size(75, 38) + Me.cmdHour.TabIndex = 230 + Me.cmdHour.Text = "hour" + Me.cmdHour.UseVisualStyleBackColor = True + ' + 'cmdMinutes + ' + Me.cmdMinutes.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdMinutes.Location = New System.Drawing.Point(154, 200) + Me.cmdMinutes.Name = "cmdMinutes" + Me.cmdMinutes.Size = New System.Drawing.Size(86, 38) + Me.cmdMinutes.TabIndex = 229 + Me.cmdMinutes.Text = "min" + Me.cmdMinutes.UseVisualStyleBackColor = True + ' + 'cmdDmy + ' + Me.cmdDmy.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdDmy.Location = New System.Drawing.Point(80, 55) + Me.cmdDmy.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdDmy.Name = "cmdDmy" + Me.cmdDmy.Size = New System.Drawing.Size(75, 38) + Me.cmdDmy.TabIndex = 228 + Me.cmdDmy.Tag = "dmy" + Me.cmdDmy.Text = "dmy" + Me.cmdDmy.UseVisualStyleBackColor = True + ' + 'cmdDay + ' + Me.cmdDay.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdDay.Location = New System.Drawing.Point(239, 127) + Me.cmdDay.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdDay.Name = "cmdDay" + Me.cmdDay.Size = New System.Drawing.Size(75, 38) + Me.cmdDay.TabIndex = 227 + Me.cmdDay.Text = "day" + Me.cmdDay.UseVisualStyleBackColor = True + ' + 'cmdMonth + ' + Me.cmdMonth.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdMonth.Location = New System.Drawing.Point(154, 127) + Me.cmdMonth.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdMonth.Name = "cmdMonth" + Me.cmdMonth.RightToLeft = System.Windows.Forms.RightToLeft.No + Me.cmdMonth.Size = New System.Drawing.Size(86, 38) + Me.cmdMonth.TabIndex = 226 + Me.cmdMonth.Text = "month" + Me.cmdMonth.UseVisualStyleBackColor = True + ' + 'cmdYear + ' + Me.cmdYear.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdYear.Location = New System.Drawing.Point(6, 127) + Me.cmdYear.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdYear.Name = "cmdYear" + Me.cmdYear.Size = New System.Drawing.Size(75, 38) + Me.cmdYear.TabIndex = 225 + Me.cmdYear.Text = "year" + Me.cmdYear.UseVisualStyleBackColor = True + ' + 'cmdDate + ' + Me.cmdDate.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdDate.Location = New System.Drawing.Point(6, 19) + Me.cmdDate.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdDate.Name = "cmdDate" + Me.cmdDate.Size = New System.Drawing.Size(75, 38) + Me.cmdDate.TabIndex = 224 + Me.cmdDate.Text = "date" + Me.cmdDate.UseVisualStyleBackColor = True + ' + 'cmdYday + ' + Me.cmdYday.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdYday.Location = New System.Drawing.Point(6, 164) + Me.cmdYday.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdYday.Name = "cmdYday" + Me.cmdYday.Size = New System.Drawing.Size(75, 38) + Me.cmdYday.TabIndex = 223 + Me.cmdYday.Text = "yday" + Me.cmdYday.UseVisualStyleBackColor = True + ' + 'cmdWday + ' + Me.cmdWday.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdWday.Location = New System.Drawing.Point(80, 164) + Me.cmdWday.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdWday.Name = "cmdWday" + Me.cmdWday.Size = New System.Drawing.Size(75, 38) + Me.cmdWday.TabIndex = 222 + Me.cmdWday.Text = "wday" + Me.cmdWday.UseVisualStyleBackColor = True + ' + 'cmdMdy + ' + Me.cmdMdy.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdMdy.Location = New System.Drawing.Point(154, 55) + Me.cmdMdy.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdMdy.Name = "cmdMdy" + Me.cmdMdy.Size = New System.Drawing.Size(86, 38) + Me.cmdMdy.TabIndex = 221 + Me.cmdMdy.Text = "mdy" + Me.cmdMdy.UseVisualStyleBackColor = True + ' + 'cmdYmd + ' + Me.cmdYmd.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdYmd.Location = New System.Drawing.Point(6, 55) + Me.cmdYmd.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdYmd.Name = "cmdYmd" + Me.cmdYmd.Size = New System.Drawing.Size(75, 38) + Me.cmdYmd.TabIndex = 220 + Me.cmdYmd.Text = "ymd" + Me.cmdYmd.UseVisualStyleBackColor = True + ' + 'cmdLeap + ' + Me.cmdLeap.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdLeap.Location = New System.Drawing.Point(239, 91) + Me.cmdLeap.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdLeap.Name = "cmdLeap" + Me.cmdLeap.Size = New System.Drawing.Size(75, 38) + Me.cmdLeap.TabIndex = 219 + Me.cmdLeap.Text = "leap" + Me.cmdLeap.UseVisualStyleBackColor = True + ' + 'ContextMenuStripDate + ' + Me.ContextMenuStripDate.ImageScalingSize = New System.Drawing.Size(24, 24) + Me.ContextMenuStripDate.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.DateLubridateToolStripMenuItem, Me.DateHmsToolStripMenuItem}) + Me.ContextMenuStripDate.Name = "ContextMenuStrip1" + Me.ContextMenuStripDate.Size = New System.Drawing.Size(139, 52) + ' + 'DateLubridateToolStripMenuItem + ' + Me.DateLubridateToolStripMenuItem.Name = "DateLubridateToolStripMenuItem" + Me.DateLubridateToolStripMenuItem.Size = New System.Drawing.Size(138, 24) + Me.DateLubridateToolStripMenuItem.Text = "lubridate" + ' + 'DateHmsToolStripMenuItem + ' + Me.DateHmsToolStripMenuItem.Name = "DateHmsToolStripMenuItem" + Me.DateHmsToolStripMenuItem.Size = New System.Drawing.Size(138, 24) + Me.DateHmsToolStripMenuItem.Text = "hms" + ' + 'ContextMenuStripComplex + ' + Me.ContextMenuStripComplex.ImageScalingSize = New System.Drawing.Size(24, 24) + Me.ContextMenuStripComplex.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ComplexBaseToolStripMenuItem}) + Me.ContextMenuStripComplex.Name = "ContextMenuStrip1" + Me.ContextMenuStripComplex.Size = New System.Drawing.Size(110, 28) + ' + 'ComplexBaseToolStripMenuItem + ' + Me.ComplexBaseToolStripMenuItem.Name = "ComplexBaseToolStripMenuItem" + Me.ComplexBaseToolStripMenuItem.Size = New System.Drawing.Size(109, 24) + Me.ComplexBaseToolStripMenuItem.Text = "base" + ' + 'grpInteger + ' + Me.grpInteger.Controls.Add(Me.cmdPrimorial) + Me.grpInteger.Controls.Add(Me.cmdFactorize2) + Me.grpInteger.Controls.Add(Me.cmdLucas) + Me.grpInteger.Controls.Add(Me.cmdFactorize) + Me.grpInteger.Controls.Add(Me.cmdSquare) + Me.grpInteger.Controls.Add(Me.cmdTriangle) + Me.grpInteger.Controls.Add(Me.cmdPadovan) + Me.grpInteger.Controls.Add(Me.cmdAchilles) + Me.grpInteger.Controls.Add(Me.cmdHappy) + Me.grpInteger.Controls.Add(Me.cmdUgly) + Me.grpInteger.Controls.Add(Me.cmdPowerful) + Me.grpInteger.Controls.Add(Me.cmdFrugal) + Me.grpInteger.Controls.Add(Me.cmdPerfect) + Me.grpInteger.Controls.Add(Me.cmdAbundant) + Me.grpInteger.Controls.Add(Me.cmdFibonacci2) + Me.grpInteger.Controls.Add(Me.cmdPalindrome) + Me.grpInteger.Controls.Add(Me.cmdRoman) + Me.grpInteger.Controls.Add(Me.cmdHexmode) + Me.grpInteger.Controls.Add(Me.cmdOctmode) + Me.grpInteger.Controls.Add(Me.cmdKTuple) + Me.grpInteger.Controls.Add(Me.cmdTriplets) + Me.grpInteger.Controls.Add(Me.cmdThird) + Me.grpInteger.Controls.Add(Me.cmdSexy) + Me.grpInteger.Controls.Add(Me.cmdCousin) + Me.grpInteger.Controls.Add(Me.cmdTwin) + Me.grpInteger.Controls.Add(Me.cmdPhi) + Me.grpInteger.Controls.Add(Me.cmdCoprime) + Me.grpInteger.Controls.Add(Me.cmdSCM) + Me.grpInteger.Controls.Add(Me.cmdGCD) + Me.grpInteger.Controls.Add(Me.cmdGeneratePrimes) + Me.grpInteger.Controls.Add(Me.cmdNthPrime) + Me.grpInteger.Controls.Add(Me.cmdIntegerRHelp) + Me.grpInteger.Controls.Add(Me.cmdHex) + Me.grpInteger.Controls.Add(Me.cmdOctal) + Me.grpInteger.Controls.Add(Me.cmdBinary) + Me.grpInteger.Controls.Add(Me.cmdBigQ) + Me.grpInteger.Controls.Add(Me.cmdDigitSum) + Me.grpInteger.Controls.Add(Me.cmdRankPercent) + Me.grpInteger.Controls.Add(Me.cmdDivisors) + Me.grpInteger.Controls.Add(Me.cmdFibonacci) + Me.grpInteger.Controls.Add(Me.cmdNextPrime) + Me.grpInteger.Controls.Add(Me.cmdChoosez) + Me.grpInteger.Controls.Add(Me.cmdFactorial) + Me.grpInteger.Controls.Add(Me.cmdIsPrime) + Me.grpInteger.Controls.Add(Me.cmdBigZ) + Me.grpInteger.Location = New System.Drawing.Point(542, 77) + Me.grpInteger.Name = "grpInteger" + Me.grpInteger.Size = New System.Drawing.Size(385, 397) + Me.grpInteger.TabIndex = 183 + Me.grpInteger.TabStop = False + Me.grpInteger.Text = "Integer" + ' + 'cmdPrimorial + ' + Me.cmdPrimorial.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdPrimorial.Location = New System.Drawing.Point(278, 227) + Me.cmdPrimorial.Name = "cmdPrimorial" + Me.cmdPrimorial.Size = New System.Drawing.Size(93, 28) + Me.cmdPrimorial.TabIndex = 47 + Me.cmdPrimorial.Text = "primorial" + Me.cmdPrimorial.UseVisualStyleBackColor = True + ' + 'cmdFactorize2 + ' + Me.cmdFactorize2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFactorize2.Location = New System.Drawing.Point(187, 48) + Me.cmdFactorize2.Name = "cmdFactorize2" + Me.cmdFactorize2.Size = New System.Drawing.Size(93, 28) + Me.cmdFactorize2.TabIndex = 46 + Me.cmdFactorize2.Text = "factorize2" + Me.cmdFactorize2.UseVisualStyleBackColor = True + ' + 'cmdLucas + ' + Me.cmdLucas.Location = New System.Drawing.Point(93, 77) + Me.cmdLucas.Name = "cmdLucas" + Me.cmdLucas.Size = New System.Drawing.Size(93, 28) + Me.cmdLucas.TabIndex = 45 + Me.cmdLucas.Text = "lucas" + Me.cmdLucas.UseVisualStyleBackColor = True + ' + 'cmdFactorize + ' + Me.cmdFactorize.Location = New System.Drawing.Point(93, 48) + Me.cmdFactorize.Name = "cmdFactorize" + Me.cmdFactorize.Size = New System.Drawing.Size(93, 28) + Me.cmdFactorize.TabIndex = 44 + Me.cmdFactorize.Text = "factorize" Me.cmdFactorize.UseVisualStyleBackColor = True ' 'cmdSquare @@ -1368,18 +1610,6 @@ Partial Class ucrCalculator Me.cmdNthPrime.Text = "nth_prime" Me.cmdNthPrime.UseVisualStyleBackColor = True ' - 'cmdIntegerRHelp - ' - Me.cmdIntegerRHelp.AutoSize = True - Me.cmdIntegerRHelp.ContextMenuStrip = Me.ContextMenuStripInteger - Me.cmdIntegerRHelp.Location = New System.Drawing.Point(262, 354) - Me.cmdIntegerRHelp.Name = "cmdIntegerRHelp" - Me.cmdIntegerRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdIntegerRHelp.SplitMenuStrip = Me.ContextMenuStripInteger - Me.cmdIntegerRHelp.TabIndex = 16 - Me.cmdIntegerRHelp.Text = "R Help" - Me.cmdIntegerRHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripInteger ' Me.ContextMenuStripInteger.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -1585,18 +1815,6 @@ Partial Class ucrCalculator Me.grpFactor.TabStop = False Me.grpFactor.Text = "Factor" ' - 'cmdTransformHelp - ' - Me.cmdTransformHelp.AutoSize = True - Me.cmdTransformHelp.ContextMenuStrip = Me.ContextMenuStripFactor - Me.cmdTransformHelp.Location = New System.Drawing.Point(188, 218) - Me.cmdTransformHelp.Name = "cmdTransformHelp" - Me.cmdTransformHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdTransformHelp.SplitMenuStrip = Me.ContextMenuStripFactor - Me.cmdTransformHelp.TabIndex = 212 - Me.cmdTransformHelp.Text = "R Help" - Me.cmdTransformHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripFactor ' Me.ContextMenuStripFactor.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -1863,18 +2081,6 @@ Partial Class ucrCalculator Me.grpHydroGOF.TabStop = False Me.grpHydroGOF.Text = "hydroGOF " ' - 'cmdHydroHelp - ' - Me.cmdHydroHelp.AutoSize = True - Me.cmdHydroHelp.ContextMenuStrip = Me.ContextMenuStripHydroGOF - Me.cmdHydroHelp.Location = New System.Drawing.Point(113, 298) - Me.cmdHydroHelp.Name = "cmdHydroHelp" - Me.cmdHydroHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdHydroHelp.SplitMenuStrip = Me.ContextMenuStripHydroGOF - Me.cmdHydroHelp.TabIndex = 212 - Me.cmdHydroHelp.Text = "R Help" - Me.cmdHydroHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripHydroGOF ' Me.ContextMenuStripHydroGOF.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -2823,18 +3029,6 @@ Partial Class ucrCalculator Me.grpMaths.TabStop = False Me.grpMaths.Text = "Maths" ' - 'cmdMathsHelp - ' - Me.cmdMathsHelp.AutoSize = True - Me.cmdMathsHelp.ContextMenuStrip = Me.ContextMenuStripMaths - Me.cmdMathsHelp.Location = New System.Drawing.Point(204, 165) - Me.cmdMathsHelp.Name = "cmdMathsHelp" - Me.cmdMathsHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdMathsHelp.SplitMenuStrip = Me.ContextMenuStripMaths - Me.cmdMathsHelp.TabIndex = 211 - Me.cmdMathsHelp.Text = "R Help" - Me.cmdMathsHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripMaths ' Me.ContextMenuStripMaths.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -3213,18 +3407,6 @@ Partial Class ucrCalculator Me.cmdwhichmin.Text = "which.min" Me.cmdwhichmin.UseVisualStyleBackColor = True ' - 'cmdSummaryRHelp - ' - Me.cmdSummaryRHelp.AutoSize = True - Me.cmdSummaryRHelp.ContextMenuStrip = Me.ContextMenuStripSummary - Me.cmdSummaryRHelp.Location = New System.Drawing.Point(228, 238) - Me.cmdSummaryRHelp.Name = "cmdSummaryRHelp" - Me.cmdSummaryRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdSummaryRHelp.SplitMenuStrip = Me.ContextMenuStripSummary - Me.cmdSummaryRHelp.TabIndex = 185 - Me.cmdSummaryRHelp.Text = "R Help" - Me.cmdSummaryRHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripSummary ' Me.ContextMenuStripSummary.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -3847,18 +4029,6 @@ Partial Class ucrCalculator Me.cmdPascal.Text = "pascal" Me.cmdPascal.UseVisualStyleBackColor = True ' - 'cmdProbRHelp - ' - Me.cmdProbRHelp.AutoSize = True - Me.cmdProbRHelp.ContextMenuStrip = Me.ContextMenuStripProbability - Me.cmdProbRHelp.Location = New System.Drawing.Point(269, 239) - Me.cmdProbRHelp.Name = "cmdProbRHelp" - Me.cmdProbRHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdProbRHelp.SplitMenuStrip = Me.ContextMenuStripProbability - Me.cmdProbRHelp.TabIndex = 212 - Me.cmdProbRHelp.Text = "R Help" - Me.cmdProbRHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripProbability ' Me.ContextMenuStripProbability.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -4449,18 +4619,6 @@ Partial Class ucrCalculator Me.cmdScale.Text = "scale" Me.cmdScale.UseVisualStyleBackColor = True ' - 'cmdTransformRHelp - ' - Me.cmdTransformRHelp.AutoSize = True - Me.cmdTransformRHelp.ContextMenuStrip = Me.ContextMenuStripTransform - Me.cmdTransformRHelp.Location = New System.Drawing.Point(267, 245) - Me.cmdTransformRHelp.Name = "cmdTransformRHelp" - Me.cmdTransformRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdTransformRHelp.SplitMenuStrip = Me.ContextMenuStripTransform - Me.cmdTransformRHelp.TabIndex = 204 - Me.cmdTransformRHelp.Text = "R Help" - Me.cmdTransformRHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripTransform ' Me.ContextMenuStripTransform.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -4816,18 +4974,6 @@ Partial Class ucrCalculator Me.grpLogical.TabStop = False Me.grpLogical.Text = "Logical and Symbols" ' - 'cmdLogicalHelp - ' - Me.cmdLogicalHelp.AutoSize = True - Me.cmdLogicalHelp.ContextMenuStrip = Me.ContextMenuStripLogical - Me.cmdLogicalHelp.Location = New System.Drawing.Point(207, 234) - Me.cmdLogicalHelp.Name = "cmdLogicalHelp" - Me.cmdLogicalHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdLogicalHelp.SplitMenuStrip = Me.ContextMenuStripLogical - Me.cmdLogicalHelp.TabIndex = 212 - Me.cmdLogicalHelp.Text = "R Help" - Me.cmdLogicalHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripLogical ' Me.ContextMenuStripLogical.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -5575,18 +5721,6 @@ Partial Class ucrCalculator Me.grpCircular.TabStop = False Me.grpCircular.Text = "Circular" ' - 'cmdCircularHelp - ' - Me.cmdCircularHelp.AutoSize = True - Me.cmdCircularHelp.ContextMenuStrip = Me.ContextMenuStripCircular - Me.cmdCircularHelp.Location = New System.Drawing.Point(197, 178) - Me.cmdCircularHelp.Name = "cmdCircularHelp" - Me.cmdCircularHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdCircularHelp.SplitMenuStrip = Me.ContextMenuStripCircular - Me.cmdCircularHelp.TabIndex = 212 - Me.cmdCircularHelp.Text = "R Help" - Me.cmdCircularHelp.UseVisualStyleBackColor = True - ' 'ContextMenuStripCircular ' Me.ContextMenuStripCircular.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -6082,18 +6216,6 @@ Partial Class ucrCalculator Me.cmdComplexi.Text = "i" Me.cmdComplexi.UseVisualStyleBackColor = True ' - 'cmdComplexRHelp - ' - Me.cmdComplexRHelp.AutoSize = True - Me.cmdComplexRHelp.ContextMenuStrip = Me.ContextMenuStripComplex - Me.cmdComplexRHelp.Location = New System.Drawing.Point(228, 212) - Me.cmdComplexRHelp.Name = "cmdComplexRHelp" - Me.cmdComplexRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdComplexRHelp.SplitMenuStrip = Me.ContextMenuStripComplex - Me.cmdComplexRHelp.TabIndex = 209 - Me.cmdComplexRHelp.Text = "R Help" - Me.cmdComplexRHelp.UseVisualStyleBackColor = True - ' 'cmdComplexTanH ' Me.cmdComplexTanH.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) @@ -6654,7 +6776,7 @@ Partial Class ucrCalculator ' Me.cmdListSQRT.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdListSQRT.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdListSQRT.Location = New System.Drawing.Point(307, 53) + Me.cmdListSQRT.Location = New System.Drawing.Point(307, 52) Me.cmdListSQRT.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdListSQRT.Name = "cmdListSQRT" Me.cmdListSQRT.Size = New System.Drawing.Size(73, 38) @@ -7124,304 +7246,183 @@ Partial Class ucrCalculator Me.ucrTryCalculator.Name = "ucrTryCalculator" Me.ucrTryCalculator.RunCommandAsMultipleLines = False Me.ucrTryCalculator.Size = New System.Drawing.Size(495, 46) - Me.ucrTryCalculator.TabIndex = 194 - ' - 'ucrInputCalOptions - ' - Me.ucrInputCalOptions.AddQuotesIfUnrecognised = True - Me.ucrInputCalOptions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputCalOptions.GetSetSelectedIndex = -1 - Me.ucrInputCalOptions.IsReadOnly = False - Me.ucrInputCalOptions.Location = New System.Drawing.Point(282, 52) - Me.ucrInputCalOptions.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.ucrInputCalOptions.Name = "ucrInputCalOptions" - Me.ucrInputCalOptions.Size = New System.Drawing.Size(172, 28) - Me.ucrInputCalOptions.TabIndex = 180 - ' - 'ucrSelectorForCalculations - ' - Me.ucrSelectorForCalculations.AutoSize = True - Me.ucrSelectorForCalculations.bDropUnusedFilterLevels = False - Me.ucrSelectorForCalculations.bShowHiddenColumns = False - Me.ucrSelectorForCalculations.bUseCurrentFilter = True - Me.ucrSelectorForCalculations.Location = New System.Drawing.Point(0, 80) - Me.ucrSelectorForCalculations.Margin = New System.Windows.Forms.Padding(0) - Me.ucrSelectorForCalculations.Name = "ucrSelectorForCalculations" - Me.ucrSelectorForCalculations.Size = New System.Drawing.Size(267, 228) - Me.ucrSelectorForCalculations.TabIndex = 173 - ' - 'ucrReceiverForCalculation - ' - Me.ucrReceiverForCalculation.AutoSize = True - Me.ucrReceiverForCalculation.frmParent = Nothing - Me.ucrReceiverForCalculation.Location = New System.Drawing.Point(88, 8) - Me.ucrReceiverForCalculation.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.ucrReceiverForCalculation.Name = "ucrReceiverForCalculation" - Me.ucrReceiverForCalculation.Selector = Nothing - Me.ucrReceiverForCalculation.Size = New System.Drawing.Size(488, 37) - Me.ucrReceiverForCalculation.strNcFilePath = "" - Me.ucrReceiverForCalculation.TabIndex = 120 - Me.ucrReceiverForCalculation.ucrSelector = Nothing - ' - 'cmdYmdHms - ' - Me.cmdYmdHms.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdYmdHms.Location = New System.Drawing.Point(6, 91) - Me.cmdYmdHms.Name = "cmdYmdHms" - Me.cmdYmdHms.Size = New System.Drawing.Size(75, 38) - Me.cmdYmdHms.TabIndex = 242 - Me.cmdYmdHms.Text = "ymd.hms" - Me.cmdYmdHms.UseVisualStyleBackColor = True - ' - 'cmdYmdHm - ' - Me.cmdYmdHm.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdYmdHm.Location = New System.Drawing.Point(78, 91) - Me.cmdYmdHm.Name = "cmdYmdHm" - Me.cmdYmdHm.Size = New System.Drawing.Size(75, 38) - Me.cmdYmdHm.TabIndex = 241 - Me.cmdYmdHm.Text = "ymd.hm" - Me.cmdYmdHm.UseVisualStyleBackColor = True - ' - 'cmdAsDate - ' - Me.cmdAsDate.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdAsDate.Location = New System.Drawing.Point(78, 19) - Me.cmdAsDate.Name = "cmdAsDate" - Me.cmdAsDate.Size = New System.Drawing.Size(75, 38) - Me.cmdAsDate.TabIndex = 240 - Me.cmdAsDate.Text = "as.date" - Me.cmdAsDate.UseVisualStyleBackColor = True - ' - 'cmdAsTime - ' - Me.cmdAsTime.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdAsTime.Location = New System.Drawing.Point(233, 55) - Me.cmdAsTime.Name = "cmdAsTime" - Me.cmdAsTime.Size = New System.Drawing.Size(75, 38) - Me.cmdAsTime.TabIndex = 239 - Me.cmdAsTime.Text = "as.time" - Me.cmdAsTime.UseVisualStyleBackColor = True - ' - 'cmdYmdH - ' - Me.cmdYmdH.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdYmdH.Location = New System.Drawing.Point(150, 91) - Me.cmdYmdH.Name = "cmdYmdH" - Me.cmdYmdH.Size = New System.Drawing.Size(86, 38) - Me.cmdYmdH.TabIndex = 238 - Me.cmdYmdH.Text = "ymd.h" - Me.cmdYmdH.UseVisualStyleBackColor = True - ' - 'cmdPm - ' - Me.cmdPm.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdPm.Location = New System.Drawing.Point(6, 198) - Me.cmdPm.Name = "cmdPm" - Me.cmdPm.Size = New System.Drawing.Size(75, 38) - Me.cmdPm.TabIndex = 237 - Me.cmdPm.Text = "pm" - Me.cmdPm.UseVisualStyleBackColor = True - ' - 'cmdTime - ' - Me.cmdTime.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdTime.Location = New System.Drawing.Point(233, 19) - Me.cmdTime.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdTime.Name = "cmdTime" - Me.cmdTime.Size = New System.Drawing.Size(75, 38) - Me.cmdTime.TabIndex = 236 - Me.cmdTime.Text = "time" - Me.cmdTime.UseVisualStyleBackColor = True - ' - 'cmdDateTime - ' - Me.cmdDateTime.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdDateTime.Location = New System.Drawing.Point(150, 19) - Me.cmdDateTime.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdDateTime.Name = "cmdDateTime" - Me.cmdDateTime.Size = New System.Drawing.Size(86, 38) - Me.cmdDateTime.TabIndex = 235 - Me.cmdDateTime.Text = "as.datetime" - Me.cmdDateTime.UseVisualStyleBackColor = True - ' - 'cmdQuarter - ' - Me.cmdQuarter.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdQuarter.Location = New System.Drawing.Point(78, 127) - Me.cmdQuarter.Name = "cmdQuarter" - Me.cmdQuarter.Size = New System.Drawing.Size(75, 38) - Me.cmdQuarter.TabIndex = 234 - Me.cmdQuarter.Text = "quarter" - Me.cmdQuarter.UseVisualStyleBackColor = True - ' - 'cmdD_In_M - ' - Me.cmdD_In_M.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdD_In_M.Location = New System.Drawing.Point(150, 162) - Me.cmdD_In_M.Name = "cmdD_In_M" - Me.cmdD_In_M.Size = New System.Drawing.Size(86, 38) - Me.cmdD_In_M.TabIndex = 233 - Me.cmdD_In_M.Text = "d_in_m" - Me.cmdD_In_M.UseVisualStyleBackColor = True + Me.ucrTryCalculator.TabIndex = 194 ' - 'cmdAm + 'ucrInputCalOptions ' - Me.cmdAm.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdAm.Location = New System.Drawing.Point(233, 162) - Me.cmdAm.Name = "cmdAm" - Me.cmdAm.Size = New System.Drawing.Size(75, 38) - Me.cmdAm.TabIndex = 232 - Me.cmdAm.Text = "am" - Me.cmdAm.UseVisualStyleBackColor = True + Me.ucrInputCalOptions.AddQuotesIfUnrecognised = True + Me.ucrInputCalOptions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputCalOptions.GetSetSelectedIndex = -1 + Me.ucrInputCalOptions.IsReadOnly = False + Me.ucrInputCalOptions.Location = New System.Drawing.Point(282, 52) + Me.ucrInputCalOptions.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.ucrInputCalOptions.Name = "ucrInputCalOptions" + Me.ucrInputCalOptions.Size = New System.Drawing.Size(172, 28) + Me.ucrInputCalOptions.TabIndex = 180 ' - 'cmdSec + 'ucrSelectorForCalculations ' - Me.cmdSec.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdSec.Location = New System.Drawing.Point(233, 198) - Me.cmdSec.Name = "cmdSec" - Me.cmdSec.Size = New System.Drawing.Size(75, 38) - Me.cmdSec.TabIndex = 231 - Me.cmdSec.Text = "sec" - Me.cmdSec.UseVisualStyleBackColor = True + Me.ucrSelectorForCalculations.AutoSize = True + Me.ucrSelectorForCalculations.bDropUnusedFilterLevels = False + Me.ucrSelectorForCalculations.bShowHiddenColumns = False + Me.ucrSelectorForCalculations.bUseCurrentFilter = True + Me.ucrSelectorForCalculations.Location = New System.Drawing.Point(0, 80) + Me.ucrSelectorForCalculations.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorForCalculations.Name = "ucrSelectorForCalculations" + Me.ucrSelectorForCalculations.Size = New System.Drawing.Size(267, 228) + Me.ucrSelectorForCalculations.TabIndex = 173 ' - 'cmdHour + 'ucrReceiverForCalculation ' - Me.cmdHour.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdHour.Location = New System.Drawing.Point(78, 198) - Me.cmdHour.Name = "cmdHour" - Me.cmdHour.Size = New System.Drawing.Size(75, 38) - Me.cmdHour.TabIndex = 230 - Me.cmdHour.Text = "hour" - Me.cmdHour.UseVisualStyleBackColor = True + Me.ucrReceiverForCalculation.AutoSize = True + Me.ucrReceiverForCalculation.frmParent = Nothing + Me.ucrReceiverForCalculation.Location = New System.Drawing.Point(88, 8) + Me.ucrReceiverForCalculation.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.ucrReceiverForCalculation.Name = "ucrReceiverForCalculation" + Me.ucrReceiverForCalculation.Selector = Nothing + Me.ucrReceiverForCalculation.Size = New System.Drawing.Size(488, 37) + Me.ucrReceiverForCalculation.strNcFilePath = "" + Me.ucrReceiverForCalculation.TabIndex = 120 + Me.ucrReceiverForCalculation.ucrSelector = Nothing ' - 'cmdMinutes + 'cmdRHelp ' - Me.cmdMinutes.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdMinutes.Location = New System.Drawing.Point(150, 198) - Me.cmdMinutes.Name = "cmdMinutes" - Me.cmdMinutes.Size = New System.Drawing.Size(86, 38) - Me.cmdMinutes.TabIndex = 229 - Me.cmdMinutes.Text = "min" - Me.cmdMinutes.UseVisualStyleBackColor = True + Me.cmdRHelp.AutoSize = True + Me.cmdRHelp.ContextMenuStrip = Me.ContextMenuStripDate + Me.cmdRHelp.Location = New System.Drawing.Point(194, 248) + Me.cmdRHelp.Name = "cmdRHelp" + Me.cmdRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdRHelp.SplitMenuStrip = Me.ContextMenuStripDate + Me.cmdRHelp.TabIndex = 212 + Me.cmdRHelp.Text = "R Help" + Me.cmdRHelp.UseVisualStyleBackColor = True ' - 'cmdDmy + 'cmdHydroHelp ' - Me.cmdDmy.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdDmy.Location = New System.Drawing.Point(78, 55) - Me.cmdDmy.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdDmy.Name = "cmdDmy" - Me.cmdDmy.Size = New System.Drawing.Size(75, 38) - Me.cmdDmy.TabIndex = 228 - Me.cmdDmy.Tag = "dmy" - Me.cmdDmy.Text = "dmy" - Me.cmdDmy.UseVisualStyleBackColor = True + Me.cmdHydroHelp.AutoSize = True + Me.cmdHydroHelp.ContextMenuStrip = Me.ContextMenuStripHydroGOF + Me.cmdHydroHelp.Location = New System.Drawing.Point(113, 298) + Me.cmdHydroHelp.Name = "cmdHydroHelp" + Me.cmdHydroHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdHydroHelp.SplitMenuStrip = Me.ContextMenuStripHydroGOF + Me.cmdHydroHelp.TabIndex = 212 + Me.cmdHydroHelp.Text = "R Help" + Me.cmdHydroHelp.UseVisualStyleBackColor = True ' - 'cmdDay + 'cmdTransformHelp ' - Me.cmdDay.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdDay.Location = New System.Drawing.Point(233, 126) - Me.cmdDay.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdDay.Name = "cmdDay" - Me.cmdDay.Size = New System.Drawing.Size(75, 38) - Me.cmdDay.TabIndex = 227 - Me.cmdDay.Text = "day" - Me.cmdDay.UseVisualStyleBackColor = True + Me.cmdTransformHelp.AutoSize = True + Me.cmdTransformHelp.ContextMenuStrip = Me.ContextMenuStripFactor + Me.cmdTransformHelp.Location = New System.Drawing.Point(188, 218) + Me.cmdTransformHelp.Name = "cmdTransformHelp" + Me.cmdTransformHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdTransformHelp.SplitMenuStrip = Me.ContextMenuStripFactor + Me.cmdTransformHelp.TabIndex = 212 + Me.cmdTransformHelp.Text = "R Help" + Me.cmdTransformHelp.UseVisualStyleBackColor = True ' - 'cmdMonth + 'cmdCircularHelp ' - Me.cmdMonth.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdMonth.Location = New System.Drawing.Point(150, 127) - Me.cmdMonth.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdMonth.Name = "cmdMonth" - Me.cmdMonth.RightToLeft = System.Windows.Forms.RightToLeft.No - Me.cmdMonth.Size = New System.Drawing.Size(86, 38) - Me.cmdMonth.TabIndex = 226 - Me.cmdMonth.Text = "month" - Me.cmdMonth.UseVisualStyleBackColor = True + Me.cmdCircularHelp.AutoSize = True + Me.cmdCircularHelp.ContextMenuStrip = Me.ContextMenuStripCircular + Me.cmdCircularHelp.Location = New System.Drawing.Point(197, 178) + Me.cmdCircularHelp.Name = "cmdCircularHelp" + Me.cmdCircularHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdCircularHelp.SplitMenuStrip = Me.ContextMenuStripCircular + Me.cmdCircularHelp.TabIndex = 212 + Me.cmdCircularHelp.Text = "R Help" + Me.cmdCircularHelp.UseVisualStyleBackColor = True ' - 'cmdYear + 'cmdMathsHelp ' - Me.cmdYear.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdYear.Location = New System.Drawing.Point(6, 127) - Me.cmdYear.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdYear.Name = "cmdYear" - Me.cmdYear.Size = New System.Drawing.Size(75, 38) - Me.cmdYear.TabIndex = 225 - Me.cmdYear.Text = "year" - Me.cmdYear.UseVisualStyleBackColor = True + Me.cmdMathsHelp.AutoSize = True + Me.cmdMathsHelp.ContextMenuStrip = Me.ContextMenuStripMaths + Me.cmdMathsHelp.Location = New System.Drawing.Point(204, 165) + Me.cmdMathsHelp.Name = "cmdMathsHelp" + Me.cmdMathsHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdMathsHelp.SplitMenuStrip = Me.ContextMenuStripMaths + Me.cmdMathsHelp.TabIndex = 211 + Me.cmdMathsHelp.Text = "R Help" + Me.cmdMathsHelp.UseVisualStyleBackColor = True ' - 'cmdDate + 'cmdProbRHelp ' - Me.cmdDate.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdDate.Location = New System.Drawing.Point(6, 19) - Me.cmdDate.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdDate.Name = "cmdDate" - Me.cmdDate.Size = New System.Drawing.Size(75, 38) - Me.cmdDate.TabIndex = 224 - Me.cmdDate.Text = "date" - Me.cmdDate.UseVisualStyleBackColor = True + Me.cmdProbRHelp.AutoSize = True + Me.cmdProbRHelp.ContextMenuStrip = Me.ContextMenuStripProbability + Me.cmdProbRHelp.Location = New System.Drawing.Point(269, 239) + Me.cmdProbRHelp.Name = "cmdProbRHelp" + Me.cmdProbRHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdProbRHelp.SplitMenuStrip = Me.ContextMenuStripProbability + Me.cmdProbRHelp.TabIndex = 212 + Me.cmdProbRHelp.Text = "R Help" + Me.cmdProbRHelp.UseVisualStyleBackColor = True ' - 'cmdYday + 'cmdIntegerRHelp ' - Me.cmdYday.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdYday.Location = New System.Drawing.Point(6, 163) - Me.cmdYday.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdYday.Name = "cmdYday" - Me.cmdYday.Size = New System.Drawing.Size(75, 38) - Me.cmdYday.TabIndex = 223 - Me.cmdYday.Text = "yday" - Me.cmdYday.UseVisualStyleBackColor = True + Me.cmdIntegerRHelp.AutoSize = True + Me.cmdIntegerRHelp.ContextMenuStrip = Me.ContextMenuStripInteger + Me.cmdIntegerRHelp.Location = New System.Drawing.Point(262, 354) + Me.cmdIntegerRHelp.Name = "cmdIntegerRHelp" + Me.cmdIntegerRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdIntegerRHelp.SplitMenuStrip = Me.ContextMenuStripInteger + Me.cmdIntegerRHelp.TabIndex = 16 + Me.cmdIntegerRHelp.Text = "R Help" + Me.cmdIntegerRHelp.UseVisualStyleBackColor = True ' - 'cmdWday + 'cmdComplexRHelp ' - Me.cmdWday.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdWday.Location = New System.Drawing.Point(77, 163) - Me.cmdWday.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdWday.Name = "cmdWday" - Me.cmdWday.Size = New System.Drawing.Size(75, 38) - Me.cmdWday.TabIndex = 222 - Me.cmdWday.Text = "wday" - Me.cmdWday.UseVisualStyleBackColor = True + Me.cmdComplexRHelp.AutoSize = True + Me.cmdComplexRHelp.ContextMenuStrip = Me.ContextMenuStripComplex + Me.cmdComplexRHelp.Location = New System.Drawing.Point(228, 212) + Me.cmdComplexRHelp.Name = "cmdComplexRHelp" + Me.cmdComplexRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdComplexRHelp.SplitMenuStrip = Me.ContextMenuStripComplex + Me.cmdComplexRHelp.TabIndex = 209 + Me.cmdComplexRHelp.Text = "R Help" + Me.cmdComplexRHelp.UseVisualStyleBackColor = True ' - 'cmdMdy + 'cmdSummaryRHelp ' - Me.cmdMdy.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdMdy.Location = New System.Drawing.Point(150, 55) - Me.cmdMdy.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdMdy.Name = "cmdMdy" - Me.cmdMdy.Size = New System.Drawing.Size(86, 38) - Me.cmdMdy.TabIndex = 221 - Me.cmdMdy.Text = "mdy" - Me.cmdMdy.UseVisualStyleBackColor = True + Me.cmdSummaryRHelp.AutoSize = True + Me.cmdSummaryRHelp.ContextMenuStrip = Me.ContextMenuStripSummary + Me.cmdSummaryRHelp.Location = New System.Drawing.Point(228, 238) + Me.cmdSummaryRHelp.Name = "cmdSummaryRHelp" + Me.cmdSummaryRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdSummaryRHelp.SplitMenuStrip = Me.ContextMenuStripSummary + Me.cmdSummaryRHelp.TabIndex = 185 + Me.cmdSummaryRHelp.Text = "R Help" + Me.cmdSummaryRHelp.UseVisualStyleBackColor = True ' - 'cmdYmd + 'cmdTransformRHelp ' - Me.cmdYmd.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdYmd.Location = New System.Drawing.Point(6, 55) - Me.cmdYmd.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdYmd.Name = "cmdYmd" - Me.cmdYmd.Size = New System.Drawing.Size(75, 38) - Me.cmdYmd.TabIndex = 220 - Me.cmdYmd.Text = "ymd" - Me.cmdYmd.UseVisualStyleBackColor = True + Me.cmdTransformRHelp.AutoSize = True + Me.cmdTransformRHelp.ContextMenuStrip = Me.ContextMenuStripTransform + Me.cmdTransformRHelp.Location = New System.Drawing.Point(267, 245) + Me.cmdTransformRHelp.Name = "cmdTransformRHelp" + Me.cmdTransformRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdTransformRHelp.SplitMenuStrip = Me.ContextMenuStripTransform + Me.cmdTransformRHelp.TabIndex = 204 + Me.cmdTransformRHelp.Text = "R Help" + Me.cmdTransformRHelp.UseVisualStyleBackColor = True ' - 'cmdLeap + 'cmdLogicalHelp ' - Me.cmdLeap.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdLeap.Location = New System.Drawing.Point(234, 91) - Me.cmdLeap.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdLeap.Name = "cmdLeap" - Me.cmdLeap.Size = New System.Drawing.Size(75, 38) - Me.cmdLeap.TabIndex = 219 - Me.cmdLeap.Text = "leap" - Me.cmdLeap.UseVisualStyleBackColor = True + Me.cmdLogicalHelp.AutoSize = True + Me.cmdLogicalHelp.ContextMenuStrip = Me.ContextMenuStripLogical + Me.cmdLogicalHelp.Location = New System.Drawing.Point(207, 234) + Me.cmdLogicalHelp.Name = "cmdLogicalHelp" + Me.cmdLogicalHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdLogicalHelp.SplitMenuStrip = Me.ContextMenuStripLogical + Me.cmdLogicalHelp.TabIndex = 212 + Me.cmdLogicalHelp.Text = "R Help" + Me.cmdLogicalHelp.UseVisualStyleBackColor = True ' 'ucrCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(120.0!, 120.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True + Me.Controls.Add(Me.grpList) Me.Controls.Add(Me.cmdRhelpList) Me.Controls.Add(Me.cmdWakefieldHelp) Me.Controls.Add(Me.cmdStringRHelp) @@ -7437,7 +7438,6 @@ Partial Class ucrCalculator Me.Controls.Add(Me.grpDates) Me.Controls.Add(Me.grpHydroGOF) Me.Controls.Add(Me.grpFactor) - Me.Controls.Add(Me.grpList) Me.Controls.Add(Me.grpWakefield) Me.Controls.Add(Me.grpCircular) Me.Controls.Add(Me.grpMaths) diff --git a/instat/ucrCalculator.vb b/instat/ucrCalculator.vb index b89507ec41c..48c9c4819ac 100644 --- a/instat/ucrCalculator.vb +++ b/instat/ucrCalculator.vb @@ -374,6 +374,31 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdWakefield_Year, "Sample of years with default from 1996 to current year, with equal probability") ttCalculator.SetToolTip(cmdLikert7, " Sample from 7-point scale, ranging from strongly agree to strongly disagree, with default of equal probabilities") + 'Dates/Times keyboard tooltips + ttCalculator.SetToolTip(cmdDate, "Get the date part of a date-time variable") + ttCalculator.SetToolTip(cmdAsDate, "Converts a character or numeric variable into a date. For example as_date(30) or as_date(""19700131"") or as.date(""1970.jan-31"") each give 1970-01-31") + ttCalculator.SetToolTip(cmdDateTime, "Converts a character or numeric variable into a date-time variable. For example as_datetime(30) gives 1970-01-01 00:00:30 UTC") + ttCalculator.SetToolTip(cmdTime, "Converts seconds, minutes, hours into a time variable. For example hms(185) gives 00:03:05, hms(25, 64) gives 01:04:25") + ttCalculator.SetToolTip(cmdYmd, "Makes a date variable from various character or numeric formats in year-month-day order. For example ymd(19840512) gives 1984-05-12") + ttCalculator.SetToolTip(cmdDmy, "Makes a date variable from various formats in day-month-year order. For example dmy(12051984) gives 1984-05-12") + ttCalculator.SetToolTip(cmdMdy, " Makes a date variable for mdy order. For example mdy(5121984) gives 1984-05-12. (Note alternatives of myd, ydm and dym)") + ttCalculator.SetToolTip(cmdAsTime, "Makes a time variable from numeric or character variable. For example: as_hms(185) gives 00:03:05, as_hms(""14:55:10"") gives 14:55:10") + ttCalculator.SetToolTip(cmdYmdHms, "Make a date-time variable from various character or numeric formats") + ttCalculator.SetToolTip(cmdYmdHm, " Make a date-time variable from various formats. For example ymd_hm(202406161201) gives 2024-06-16 12:01:00 UTC") + ttCalculator.SetToolTip(cmdYmdH, "Make a date-time variable from various formats. For example ymd_h(""2024.6:16,12"") gives ""2024-06-16 12:00:00 UTC""") + ttCalculator.SetToolTip(cmdLeap, "True if date is from a leap year and FALSE otherwise. For example leap(1984-05-12) is TRUE") + ttCalculator.SetToolTip(cmdYear, "Extract year from date or date-time. For example year(""1984-5-12"") gives 1984") + ttCalculator.SetToolTip(cmdMonth, "Extract month from a date or date-time variable") + ttCalculator.SetToolTip(cmdDay, "Extract day in month from date or date-time. For example day(""1984-5-12"" gives 12") + ttCalculator.SetToolTip(cmdYday, "Gives the day in the year, and depends on leap year. For example yday(""1984-3-1"") gives 61, while yday(""1986-3-1"") gives 60") + ttCalculator.SetToolTip(cmdWday, "Gives the day of the week from a date, or date-time variable. For example wday(""1984--5-12"", label=TRUE) gives Sat") + ttCalculator.SetToolTip(cmdD_In_M, "Gives the number of days in the month from date, or date-time. For example d_in_m(""1984_2-12"") gives 29 as 1984 is a leap year") + ttCalculator.SetToolTip(cmdAm, "TRUE or FALSE from date-time variable. For example am(""1984-05-12 14:23:45"") is FALSE") + ttCalculator.SetToolTip(cmdPm, "TRUE or FALSE from date-time variable. For example pm(""1984-05-12 14:23:45"") is TRUE") + ttCalculator.SetToolTip(cmdHour, "Extract hour from date-time variable. For example hour(""1984-05-12 14:23:45"") is 14. Also hour(""1984-05-12"") is 0") + ttCalculator.SetToolTip(cmdMinutes, "Extract minute from date-time variable. For example minute(""1984-05-12 14:23:45"") Is 23") + ttCalculator.SetToolTip(cmdSec, "Extract second from date-time variable. For example second(""1984-05-12 14:23:45"") is 45") + ttCalculator.SetToolTip(cmdQuarter, " 3-month period of the year from a date or date-time variable. For example quarter(""1984-05-12"") gives 2") Const strTooltipCmdLength = "number of observations: For example length(c(1,2,3,4,NA)) = 5 " ttCalculator.SetToolTip(cmdLength, strTooltipCmdLength) @@ -1528,7 +1553,7 @@ Public Class ucrCalculator Private Sub cmdYear_Click(sender As Object, e As EventArgs) Handles cmdYear.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::year(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::year(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::year()", 1) End If @@ -1536,7 +1561,7 @@ Public Class ucrCalculator Private Sub cmdMonth_Click(sender As Object, e As EventArgs) Handles cmdMonth.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::month(x= , label=FALSE, abbr=TRUE)", 25) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::month(x= , label=FALSE, abbr=TRUE)", 26) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::month()", 1) End If @@ -1544,7 +1569,7 @@ Public Class ucrCalculator Private Sub cmdDay_Click(sender As Object, e As EventArgs) Handles cmdDay.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::day(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::day(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::day()", 1) End If @@ -1552,7 +1577,7 @@ Public Class ucrCalculator Private Sub cmdWday_Click(sender As Object, e As EventArgs) Handles cmdWday.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::wday(x= , label=FALSE, abbr=TRUE)", 25) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::wday(x= , label=FALSE, abbr=TRUE)", 26) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::wday()", 1) End If @@ -1560,7 +1585,7 @@ Public Class ucrCalculator Private Sub cmdYday_Click(sender As Object, e As EventArgs) Handles cmdYday.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::yday(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::yday(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::yday()", 1) End If @@ -1568,15 +1593,47 @@ Public Class ucrCalculator Private Sub cmdDate_Click(sender As Object, e As EventArgs) Handles cmdDate.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::date(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::date(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::date()", 1) End If End Sub + Private Sub cmdAsDate_Click(sender As Object, e As EventArgs) Handles cmdAsDate.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::as_date(x= )", 2) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::as_date()", 1) + End If + End Sub + + Private Sub cmdYmdHms_Click(sender As Object, e As EventArgs) Handles cmdYmdHms.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_hms(x= ) ", 3) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_hms() ", 2) + End If + End Sub + + Private Sub cmdYmdHm_Click(sender As Object, e As EventArgs) Handles cmdYmdHm.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_hm(x= ) ", 3) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_hm() ", 2) + End If + End Sub + + Private Sub cmdYmdH_Click(sender As Object, e As EventArgs) Handles cmdYmdH.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_h(x= ) ", 3) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd_h()", 1) + End If + End Sub + Private Sub cmdLeap_Click(sender As Object, e As EventArgs) Handles cmdLeap.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::leap_year(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::leap_year(date= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::leap_year()", 1) End If @@ -1584,7 +1641,7 @@ Public Class ucrCalculator Private Sub cmdYmd_Click(sender As Object, e As EventArgs) Handles cmdYmd.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::ymd()", 1) End If @@ -1592,58 +1649,71 @@ Public Class ucrCalculator Private Sub cmdMdy_Click(sender As Object, e As EventArgs) Handles cmdMdy.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::mdy(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::mdy(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::mdy()", 1) End If End Sub + Private Sub cmdDmy_Click(sender As Object, e As EventArgs) Handles cmdDmy.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::dmy(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::dmy(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::dmy()", 1) End If End Sub - Private Sub cmdHour_Click(sender As Object, e As EventArgs) Handles cmdHour.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::hour(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::hour(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::hour()", 1) End If End Sub + Private Sub cmdMinutes_Click(sender As Object, e As EventArgs) Handles cmdMinutes.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::minute(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::minute(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::minute()", 1) End If End Sub + Private Sub cmdSec_Click(sender As Object, e As EventArgs) Handles cmdSec.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::second(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::second(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::second()", 1) End If End Sub + Private Sub cmdAm_Click(sender As Object, e As EventArgs) Handles cmdAm.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::am(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::am(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::am()", 1) End If End Sub + + Private Sub cmdPm_Click(sender As Object, e As EventArgs) Handles cmdPm.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::pm(x = )", 2) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::pm()", 1) + End If + End Sub + Private Sub cmdD_In_M_Click(sender As Object, e As EventArgs) Handles cmdD_In_M.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::days_in_month(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::days_in_month(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::days_in_month()", 1) End If End Sub + Private Sub cmdQuarter_Click(sender As Object, e As EventArgs) Handles cmdQuarter.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::quarter(x =, with_year = FALSE, fiscal_start = 1 )", 39) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::quarter(x= , with_year = FALSE, fiscal_start = 1 )", 40) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::quarter()", 1) End If @@ -1652,6 +1722,7 @@ Public Class ucrCalculator Private Sub cmdBrackets_Click(sender As Object, e As EventArgs) Handles cmdBrackets.Click ucrReceiverForCalculation.AddToReceiverAtCursorPosition("( )", 1) End Sub + Private Sub cmdOpeningBracket_Click(sender As Object, e As EventArgs) Handles cmdOpeningBracket.Click ucrReceiverForCalculation.AddToReceiverAtCursorPosition("(") End Sub @@ -4094,17 +4165,17 @@ Public Class ucrCalculator Private Sub cmdTime_Click(sender As Object, e As EventArgs) Handles cmdTime.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::hms(seconds = , minutes = , hours = , days = )", 32) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::hms(seconds = , minutes = , hours = , days = )", 33) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::hms()", 1) End If End Sub - Private Sub cmdPm_Click(sender As Object, e As EventArgs) Handles cmdPm.Click + Private Sub cmdAsTime_Click(sender As Object, e As EventArgs) Handles cmdAsTime.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::pm(x = )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::as_hms(x= )", 2) Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("lubridate::pm()", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("hms::as_hms()", 1) End If End Sub From 28e7f6008b70f3e2bf1468109cfa284561838c5b Mon Sep 17 00:00:00 2001 From: JUMA Date: Thu, 28 Mar 2024 17:52:59 +0300 Subject: [PATCH 69/88] changes --- instat/ucrCalculator.Designer.vb | 206 +++++++++++++++---------------- instat/ucrCalculator.vb | 48 ++++--- 2 files changed, 136 insertions(+), 118 deletions(-) diff --git a/instat/ucrCalculator.Designer.vb b/instat/ucrCalculator.Designer.vb index da780ed375d..65671a93f4d 100644 --- a/instat/ucrCalculator.Designer.vb +++ b/instat/ucrCalculator.Designer.vb @@ -611,9 +611,6 @@ Partial Class ucrCalculator Me.ucrInputCalOptions = New instat.ucrInputComboBox() Me.ucrSelectorForCalculations = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverForCalculation = New instat.ucrReceiverExpression() - Me.cmdRHelp = New instat.ucrSplitButton() - Me.cmdHydroHelp = New instat.ucrSplitButton() - Me.cmdTransformHelp = New instat.ucrSplitButton() Me.cmdCircularHelp = New instat.ucrSplitButton() Me.cmdMathsHelp = New instat.ucrSplitButton() Me.cmdProbRHelp = New instat.ucrSplitButton() @@ -622,42 +619,45 @@ Partial Class ucrCalculator Me.cmdSummaryRHelp = New instat.ucrSplitButton() Me.cmdTransformRHelp = New instat.ucrSplitButton() Me.cmdLogicalHelp = New instat.ucrSplitButton() - Me.grpBasic.SuspendLayout - Me.grpDates.SuspendLayout - Me.ContextMenuStripDate.SuspendLayout - Me.ContextMenuStripComplex.SuspendLayout - Me.grpInteger.SuspendLayout - Me.ContextMenuStripInteger.SuspendLayout - Me.grpFactor.SuspendLayout - Me.ContextMenuStripFactor.SuspendLayout - Me.grpHydroGOF.SuspendLayout - Me.ContextMenuStripHydroGOF.SuspendLayout - Me.grpWakefield.SuspendLayout - Me.grpMaths.SuspendLayout - Me.ContextMenuStripMaths.SuspendLayout - Me.grpSummary.SuspendLayout - Me.ContextMenuStripSummary.SuspendLayout - Me.grpFrequencies.SuspendLayout - Me.grpProbabilty.SuspendLayout - Me.ContextMenuStripProbability.SuspendLayout - Me.grpRandom.SuspendLayout - Me.grpTransform.SuspendLayout - Me.ContextMenuStripTransform.SuspendLayout - Me.grpLogical.SuspendLayout - Me.ContextMenuStripLogical.SuspendLayout - Me.grpTestString.SuspendLayout - Me.grpCircular.SuspendLayout - Me.ContextMenuStripCircular.SuspendLayout - Me.grpModifier.SuspendLayout - Me.grpSymbols.SuspendLayout - Me.grpComplex.SuspendLayout - Me.ContextMenuStripTxtString.SuspendLayout - Me.ContextMenuStripWakefield.SuspendLayout - Me.ContextMenuStripList.SuspendLayout - Me.grpList.SuspendLayout - Me.GroupBox1.SuspendLayout - Me.grpMathBloc.SuspendLayout - Me.SuspendLayout + Me.cmdRHelp = New instat.ucrSplitButton() + Me.cmdHydroHelp = New instat.ucrSplitButton() + Me.cmdTransformHelp = New instat.ucrSplitButton() + Me.grpBasic.SuspendLayout() + Me.grpDates.SuspendLayout() + Me.ContextMenuStripDate.SuspendLayout() + Me.ContextMenuStripComplex.SuspendLayout() + Me.grpInteger.SuspendLayout() + Me.ContextMenuStripInteger.SuspendLayout() + Me.grpFactor.SuspendLayout() + Me.ContextMenuStripFactor.SuspendLayout() + Me.grpHydroGOF.SuspendLayout() + Me.ContextMenuStripHydroGOF.SuspendLayout() + Me.grpWakefield.SuspendLayout() + Me.grpMaths.SuspendLayout() + Me.ContextMenuStripMaths.SuspendLayout() + Me.grpSummary.SuspendLayout() + Me.ContextMenuStripSummary.SuspendLayout() + Me.grpFrequencies.SuspendLayout() + Me.grpProbabilty.SuspendLayout() + Me.ContextMenuStripProbability.SuspendLayout() + Me.grpRandom.SuspendLayout() + Me.grpTransform.SuspendLayout() + Me.ContextMenuStripTransform.SuspendLayout() + Me.grpLogical.SuspendLayout() + Me.ContextMenuStripLogical.SuspendLayout() + Me.grpTestString.SuspendLayout() + Me.grpCircular.SuspendLayout() + Me.ContextMenuStripCircular.SuspendLayout() + Me.grpModifier.SuspendLayout() + Me.grpSymbols.SuspendLayout() + Me.grpComplex.SuspendLayout() + Me.ContextMenuStripTxtString.SuspendLayout() + Me.ContextMenuStripWakefield.SuspendLayout() + Me.ContextMenuStripList.SuspendLayout() + Me.grpList.SuspendLayout() + Me.GroupBox1.SuspendLayout() + Me.grpMathBloc.SuspendLayout() + Me.SuspendLayout() ' 'lblExpression ' @@ -5759,7 +5759,7 @@ Partial Class ucrCalculator 'cmdCircMax ' Me.cmdCircMax.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdCircMax.Location = New System.Drawing.Point(223, 138) + Me.cmdCircMax.Location = New System.Drawing.Point(224, 139) Me.cmdCircMax.Margin = New System.Windows.Forms.Padding(2) Me.cmdCircMax.Name = "cmdCircMax" Me.cmdCircMax.Size = New System.Drawing.Size(82, 40) @@ -5781,7 +5781,7 @@ Partial Class ucrCalculator 'cmdAngVar ' Me.cmdAngVar.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdAngVar.Location = New System.Drawing.Point(77, 100) + Me.cmdAngVar.Location = New System.Drawing.Point(76, 100) Me.cmdAngVar.Margin = New System.Windows.Forms.Padding(2) Me.cmdAngVar.Name = "cmdAngVar" Me.cmdAngVar.Size = New System.Drawing.Size(75, 40) @@ -5792,7 +5792,7 @@ Partial Class ucrCalculator 'cmdCircRho ' Me.cmdCircRho.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdCircRho.Location = New System.Drawing.Point(223, 100) + Me.cmdCircRho.Location = New System.Drawing.Point(224, 100) Me.cmdCircRho.Margin = New System.Windows.Forms.Padding(2) Me.cmdCircRho.Name = "cmdCircRho" Me.cmdCircRho.Size = New System.Drawing.Size(82, 40) @@ -5803,7 +5803,7 @@ Partial Class ucrCalculator 'cmdCircQ3 ' Me.cmdCircQ3.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdCircQ3.Location = New System.Drawing.Point(150, 138) + Me.cmdCircQ3.Location = New System.Drawing.Point(150, 139) Me.cmdCircQ3.Margin = New System.Windows.Forms.Padding(2) Me.cmdCircQ3.Name = "cmdCircQ3" Me.cmdCircQ3.Size = New System.Drawing.Size(75, 40) @@ -5814,7 +5814,7 @@ Partial Class ucrCalculator 'cmdCircQ1 ' Me.cmdCircQ1.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdCircQ1.Location = New System.Drawing.Point(77, 138) + Me.cmdCircQ1.Location = New System.Drawing.Point(76, 139) Me.cmdCircQ1.Margin = New System.Windows.Forms.Padding(2) Me.cmdCircQ1.Name = "cmdCircQ1" Me.cmdCircQ1.Size = New System.Drawing.Size(75, 40) @@ -5825,7 +5825,7 @@ Partial Class ucrCalculator 'cmdCircMin ' Me.cmdCircMin.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdCircMin.Location = New System.Drawing.Point(2, 138) + Me.cmdCircMin.Location = New System.Drawing.Point(2, 139) Me.cmdCircMin.Margin = New System.Windows.Forms.Padding(2) Me.cmdCircMin.Name = "cmdCircMin" Me.cmdCircMin.Size = New System.Drawing.Size(75, 40) @@ -5836,7 +5836,7 @@ Partial Class ucrCalculator 'cmdAngDev ' Me.cmdAngDev.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdAngDev.Location = New System.Drawing.Point(150, 62) + Me.cmdAngDev.Location = New System.Drawing.Point(150, 61) Me.cmdAngDev.Margin = New System.Windows.Forms.Padding(2) Me.cmdAngDev.Name = "cmdAngDev" Me.cmdAngDev.Size = New System.Drawing.Size(75, 40) @@ -5847,7 +5847,7 @@ Partial Class ucrCalculator 'cmdCircVar ' Me.cmdCircVar.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdCircVar.Location = New System.Drawing.Point(223, 62) + Me.cmdCircVar.Location = New System.Drawing.Point(224, 61) Me.cmdCircVar.Margin = New System.Windows.Forms.Padding(2) Me.cmdCircVar.Name = "cmdCircVar" Me.cmdCircVar.Size = New System.Drawing.Size(82, 40) @@ -5858,7 +5858,7 @@ Partial Class ucrCalculator 'cmdCircSd ' Me.cmdCircSd.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdCircSd.Location = New System.Drawing.Point(77, 62) + Me.cmdCircSd.Location = New System.Drawing.Point(76, 61) Me.cmdCircSd.Margin = New System.Windows.Forms.Padding(2) Me.cmdCircSd.Name = "cmdCircSd" Me.cmdCircSd.Size = New System.Drawing.Size(75, 40) @@ -5869,7 +5869,7 @@ Partial Class ucrCalculator 'cmdCircRange ' Me.cmdCircRange.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdCircRange.Location = New System.Drawing.Point(2, 62) + Me.cmdCircRange.Location = New System.Drawing.Point(2, 61) Me.cmdCircRange.Margin = New System.Windows.Forms.Padding(2) Me.cmdCircRange.Name = "cmdCircRange" Me.cmdCircRange.Size = New System.Drawing.Size(75, 40) @@ -5880,7 +5880,7 @@ Partial Class ucrCalculator 'cmdMedianHL ' Me.cmdMedianHL.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdMedianHL.Location = New System.Drawing.Point(223, 22) + Me.cmdMedianHL.Location = New System.Drawing.Point(224, 22) Me.cmdMedianHL.Margin = New System.Windows.Forms.Padding(2) Me.cmdMedianHL.Name = "cmdMedianHL" Me.cmdMedianHL.Size = New System.Drawing.Size(82, 40) @@ -5902,7 +5902,7 @@ Partial Class ucrCalculator 'cmdCircMean ' Me.cmdCircMean.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdCircMean.Location = New System.Drawing.Point(77, 22) + Me.cmdCircMean.Location = New System.Drawing.Point(76, 22) Me.cmdCircMean.Margin = New System.Windows.Forms.Padding(2) Me.cmdCircMean.Name = "cmdCircMean" Me.cmdCircMean.Size = New System.Drawing.Size(75, 40) @@ -7285,42 +7285,6 @@ Partial Class ucrCalculator Me.ucrReceiverForCalculation.TabIndex = 120 Me.ucrReceiverForCalculation.ucrSelector = Nothing ' - 'cmdRHelp - ' - Me.cmdRHelp.AutoSize = True - Me.cmdRHelp.ContextMenuStrip = Me.ContextMenuStripDate - Me.cmdRHelp.Location = New System.Drawing.Point(194, 248) - Me.cmdRHelp.Name = "cmdRHelp" - Me.cmdRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdRHelp.SplitMenuStrip = Me.ContextMenuStripDate - Me.cmdRHelp.TabIndex = 212 - Me.cmdRHelp.Text = "R Help" - Me.cmdRHelp.UseVisualStyleBackColor = True - ' - 'cmdHydroHelp - ' - Me.cmdHydroHelp.AutoSize = True - Me.cmdHydroHelp.ContextMenuStrip = Me.ContextMenuStripHydroGOF - Me.cmdHydroHelp.Location = New System.Drawing.Point(113, 298) - Me.cmdHydroHelp.Name = "cmdHydroHelp" - Me.cmdHydroHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdHydroHelp.SplitMenuStrip = Me.ContextMenuStripHydroGOF - Me.cmdHydroHelp.TabIndex = 212 - Me.cmdHydroHelp.Text = "R Help" - Me.cmdHydroHelp.UseVisualStyleBackColor = True - ' - 'cmdTransformHelp - ' - Me.cmdTransformHelp.AutoSize = True - Me.cmdTransformHelp.ContextMenuStrip = Me.ContextMenuStripFactor - Me.cmdTransformHelp.Location = New System.Drawing.Point(188, 218) - Me.cmdTransformHelp.Name = "cmdTransformHelp" - Me.cmdTransformHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdTransformHelp.SplitMenuStrip = Me.ContextMenuStripFactor - Me.cmdTransformHelp.TabIndex = 212 - Me.cmdTransformHelp.Text = "R Help" - Me.cmdTransformHelp.UseVisualStyleBackColor = True - ' 'cmdCircularHelp ' Me.cmdCircularHelp.AutoSize = True @@ -7417,6 +7381,42 @@ Partial Class ucrCalculator Me.cmdLogicalHelp.Text = "R Help" Me.cmdLogicalHelp.UseVisualStyleBackColor = True ' + 'cmdRHelp + ' + Me.cmdRHelp.AutoSize = True + Me.cmdRHelp.ContextMenuStrip = Me.ContextMenuStripDate + Me.cmdRHelp.Location = New System.Drawing.Point(194, 248) + Me.cmdRHelp.Name = "cmdRHelp" + Me.cmdRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdRHelp.SplitMenuStrip = Me.ContextMenuStripDate + Me.cmdRHelp.TabIndex = 212 + Me.cmdRHelp.Text = "R Help" + Me.cmdRHelp.UseVisualStyleBackColor = True + ' + 'cmdHydroHelp + ' + Me.cmdHydroHelp.AutoSize = True + Me.cmdHydroHelp.ContextMenuStrip = Me.ContextMenuStripHydroGOF + Me.cmdHydroHelp.Location = New System.Drawing.Point(113, 298) + Me.cmdHydroHelp.Name = "cmdHydroHelp" + Me.cmdHydroHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdHydroHelp.SplitMenuStrip = Me.ContextMenuStripHydroGOF + Me.cmdHydroHelp.TabIndex = 212 + Me.cmdHydroHelp.Text = "R Help" + Me.cmdHydroHelp.UseVisualStyleBackColor = True + ' + 'cmdTransformHelp + ' + Me.cmdTransformHelp.AutoSize = True + Me.cmdTransformHelp.ContextMenuStrip = Me.ContextMenuStripFactor + Me.cmdTransformHelp.Location = New System.Drawing.Point(188, 218) + Me.cmdTransformHelp.Name = "cmdTransformHelp" + Me.cmdTransformHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdTransformHelp.SplitMenuStrip = Me.ContextMenuStripFactor + Me.cmdTransformHelp.TabIndex = 212 + Me.cmdTransformHelp.Text = "R Help" + Me.cmdTransformHelp.UseVisualStyleBackColor = True + ' 'ucrCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(120.0!, 120.0!) @@ -7435,10 +7435,6 @@ Partial Class ucrCalculator Me.Controls.Add(Me.ucrReceiverForCalculation) Me.Controls.Add(Me.lblExpression) Me.Controls.Add(Me.grpSymbols) - Me.Controls.Add(Me.grpDates) - Me.Controls.Add(Me.grpHydroGOF) - Me.Controls.Add(Me.grpFactor) - Me.Controls.Add(Me.grpWakefield) Me.Controls.Add(Me.grpCircular) Me.Controls.Add(Me.grpMaths) Me.Controls.Add(Me.grpProbabilty) @@ -7449,48 +7445,52 @@ Partial Class ucrCalculator Me.Controls.Add(Me.grpTransform) Me.Controls.Add(Me.grpLogical) Me.Controls.Add(Me.grpModifier) + Me.Controls.Add(Me.grpDates) + Me.Controls.Add(Me.grpHydroGOF) + Me.Controls.Add(Me.grpFactor) + Me.Controls.Add(Me.grpWakefield) Me.Name = "ucrCalculator" Me.Size = New System.Drawing.Size(1123, 572) Me.grpBasic.ResumeLayout(False) Me.grpDates.ResumeLayout(False) - Me.grpDates.PerformLayout + Me.grpDates.PerformLayout() Me.ContextMenuStripDate.ResumeLayout(False) Me.ContextMenuStripComplex.ResumeLayout(False) Me.grpInteger.ResumeLayout(False) - Me.grpInteger.PerformLayout + Me.grpInteger.PerformLayout() Me.ContextMenuStripInteger.ResumeLayout(False) Me.grpFactor.ResumeLayout(False) - Me.grpFactor.PerformLayout + Me.grpFactor.PerformLayout() Me.ContextMenuStripFactor.ResumeLayout(False) Me.grpHydroGOF.ResumeLayout(False) - Me.grpHydroGOF.PerformLayout + Me.grpHydroGOF.PerformLayout() Me.ContextMenuStripHydroGOF.ResumeLayout(False) Me.grpWakefield.ResumeLayout(False) Me.grpMaths.ResumeLayout(False) - Me.grpMaths.PerformLayout + Me.grpMaths.PerformLayout() Me.ContextMenuStripMaths.ResumeLayout(False) Me.grpSummary.ResumeLayout(False) - Me.grpSummary.PerformLayout + Me.grpSummary.PerformLayout() Me.ContextMenuStripSummary.ResumeLayout(False) Me.grpFrequencies.ResumeLayout(False) Me.grpProbabilty.ResumeLayout(False) - Me.grpProbabilty.PerformLayout + Me.grpProbabilty.PerformLayout() Me.ContextMenuStripProbability.ResumeLayout(False) Me.grpRandom.ResumeLayout(False) Me.grpTransform.ResumeLayout(False) - Me.grpTransform.PerformLayout + Me.grpTransform.PerformLayout() Me.ContextMenuStripTransform.ResumeLayout(False) Me.grpLogical.ResumeLayout(False) - Me.grpLogical.PerformLayout + Me.grpLogical.PerformLayout() Me.ContextMenuStripLogical.ResumeLayout(False) Me.grpTestString.ResumeLayout(False) Me.grpCircular.ResumeLayout(False) - Me.grpCircular.PerformLayout + Me.grpCircular.PerformLayout() Me.ContextMenuStripCircular.ResumeLayout(False) Me.grpModifier.ResumeLayout(False) Me.grpSymbols.ResumeLayout(False) Me.grpComplex.ResumeLayout(False) - Me.grpComplex.PerformLayout + Me.grpComplex.PerformLayout() Me.ContextMenuStripTxtString.ResumeLayout(False) Me.ContextMenuStripWakefield.ResumeLayout(False) Me.ContextMenuStripList.ResumeLayout(False) @@ -7498,7 +7498,7 @@ Partial Class ucrCalculator Me.GroupBox1.ResumeLayout(False) Me.grpMathBloc.ResumeLayout(False) Me.ResumeLayout(False) - Me.PerformLayout + Me.PerformLayout() End Sub diff --git a/instat/ucrCalculator.vb b/instat/ucrCalculator.vb index 48c9c4819ac..cd75f67e5bf 100644 --- a/instat/ucrCalculator.vb +++ b/instat/ucrCalculator.vb @@ -374,6 +374,24 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdWakefield_Year, "Sample of years with default from 1996 to current year, with equal probability") ttCalculator.SetToolTip(cmdLikert7, " Sample from 7-point scale, ranging from strongly agree to strongly disagree, with default of equal probabilities") + ' circular keyboard tooltips + ttCalculator.SetToolTip(cmdCircular, "Define a variable as circular. Specify whether the data are in radians (default), degrees, or hours") + ttCalculator.SetToolTip(cmdCircMean, "The circular mean. For example with 1, 2, 3, 6, mean(circular(c(1,2,3,6)) gives 1.51") + ttCalculator.SetToolTip(cmdCircSd, "The circular standard deviation. This is not the sqrt(circular.var). It is reasonably close to the ordinary sd for data in radians") + ttCalculator.SetToolTip(cmdCircRho, "The mean resultant length is between 0 and 1. Small values imply large (circular) variation. For 1,2,3,6 rho is 0.4036. With 1,2,3,4,5,6 it is 0.049") + ttCalculator.SetToolTip(cmdCircRange, "Circular range is the shortest arc containing the data. For example with 1,2,3,6 gives 3.28 (6 is also -0.28 on circle from 0 to 2*pi)") + ttCalculator.SetToolTip(cmdCircVar, "The circular variance is (1 - rho), so between 0 and 1, with small values implying low (circular) variation. For 1,2,3,6 var is 0.5964. With 1,2,3,4,5,6 var is 0.951") + ttCalculator.SetToolTip(cmdCircQuantiles, "Defined quantiles round the circle. With 0.5 it is the (circular) median, so is 1.5 for 1,2,3,6") + ttCalculator.SetToolTip(cmdCircMax, "Largest value round the circle. For example, for 1,2,3,6 max is 3") + ttCalculator.SetToolTip(cmdCircMin, " Smallest value round the circle. For 1,2,3,6 min is 6. (values are from 6 (almost 2 * pi to 3)") + ttCalculator.SetToolTip(cmdCircQ1, "Lower quartile round the circle. For 1,2,3,6, q1 is 0.68") + ttCalculator.SetToolTip(cmdCircQ3, "Upper quartile round the circle. For 1,2,3,6 q3 is 2.25") + ttCalculator.SetToolTip(cmdMedianHL, " Median using Hodges-Lehmann estimate. For example with 1,2,3,6, medianHL (and median) give 1.5") + ttCalculator.SetToolTip(cmdCircMedian, "Circular median. For example with 23 and 2 representing hours, median(circular(c(23,2), units=""hours"")) gives 0,5") + ttCalculator.SetToolTip(cmdAngVar, "The angular variance is twice the circular variance, so between 0 and 2") + ttCalculator.SetToolTip(cmdA1, "Ratio of Bessel functions for values of kappa parameter. Used in the von Mises (circular normal) distribution kappa = 0.9 gives A1 same as rho value for 1,2,3,6 data") + ttCalculator.SetToolTip(cmdAngDev, "The angular deviation is square root of the angular variance, so between 0 and sqrt(2)") + 'Dates/Times keyboard tooltips ttCalculator.SetToolTip(cmdDate, "Get the date part of a date-time variable") ttCalculator.SetToolTip(cmdAsDate, "Converts a character or numeric variable into a date. For example as_date(30) or as_date(""19700131"") or as.date(""1970.jan-31"") each give 1970-01-31") @@ -3362,7 +3380,7 @@ Public Class ucrCalculator Private Sub cmdCircMean_Click(sender As Object, e As EventArgs) Handles cmdCircMean.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular:: mean.circular(x = , na.rm = FALSE, control.circular = list())", 44) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular:: mean.circular(x = , na.rm = TRUE, control.circular = list())", 43) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::mean.circular()", 1) End If @@ -3370,7 +3388,7 @@ Public Class ucrCalculator Private Sub cmdCircMedian_Click(sender As Object, e As EventArgs) Handles cmdCircMedian.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::median.circular(x = , na.rm = FALSE)", 17) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::median.circular(x = , na.rm = TRUE)", 16) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::median.circular()", 1) End If @@ -3378,7 +3396,7 @@ Public Class ucrCalculator Private Sub cmdMedianHL_Click(sender As Object, e As EventArgs) Handles cmdMedianHL.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular(x = , na.rm = FALSE, method = c(HL1,HL2,HL3), prop = NULL)", 55) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular(x = , na.rm = TRUE, method = c(HL1,HL2,HL3), prop = NULL)", 54) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular()", 1) End If @@ -3386,7 +3404,7 @@ Public Class ucrCalculator Private Sub cmdCircRange_Click(sender As Object, e As EventArgs) Handles cmdCircRange.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::range.circular(x = , test = FALSE, na.rm = FALSE, finite = FALSE, control.circular = list(), )", 76) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::range.circular(x = , test = FALSE, na.rm = TRUE, finite = FALSE, control.circular = list(), )", 75) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::range.circular()", 1) End If @@ -3394,7 +3412,7 @@ Public Class ucrCalculator Private Sub cmdCircSd_Click(sender As Object, e As EventArgs) Handles cmdCircSd.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::sd.circular(x = , na.rm = FALSE)", 18) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::sd.circular(x = , na.rm = TRUE)", 17) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::sd.circular()", 1) End If @@ -3402,7 +3420,7 @@ Public Class ucrCalculator Private Sub cmdCircVar_Click(sender As Object, e As EventArgs) Handles cmdCircVar.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::var.circular(x = , na.rm = FALSE)", 18) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::var.circular(x = , na.rm = TRUE)", 17) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::var.circular()", 1) End If @@ -3412,13 +3430,13 @@ Public Class ucrCalculator If chkShowParameters.Checked Then ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::A1(kappa = )", 2) Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::besselI()", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::A1()", 1) End If End Sub Private Sub cmdAngVar_Click(sender As Object, e As EventArgs) Handles cmdAngVar.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.variance(x = , na.rm = FALSE)", 17) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.variance(x = , na.rm = TRUE)", 16) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.variance()", 1) End If @@ -3426,7 +3444,7 @@ Public Class ucrCalculator Private Sub cmdAngDev_Click(sender As Object, e As EventArgs) Handles cmdAngDev.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.deviation(x = , na.rm = FALSE)", 17) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.deviation(x = , na.rm = TRUE)", 16) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::angular.deviation()", 1) End If @@ -3434,7 +3452,7 @@ Public Class ucrCalculator Private Sub cmdCircQ1_Click(sender As Object, e As EventArgs) Handles cmdCircQ1.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.25, na.rm = FALSE, names = TRUE, type = 7)", 55) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.25, na.rm = TRUE, names = TRUE, type = 7)", 54) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.25)", 16) End If @@ -3442,7 +3460,7 @@ Public Class ucrCalculator Private Sub cmdCircMin_Click(sender As Object, e As EventArgs) Handles cmdCircMin.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0, na.rm = FALSE, names = TRUE, type = 7)", 52) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0, na.rm = TRUE, names = TRUE, type = 7)", 51) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0)", 13) End If @@ -3450,7 +3468,7 @@ Public Class ucrCalculator Private Sub cmdCircMax_Click(sender As Object, e As EventArgs) Handles cmdCircMax.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 1, na.rm = FALSE, names = TRUE, type = 7)", 52) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 1, na.rm = TRUE, names = TRUE, type = 7)", 51) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 1)", 13) End If @@ -3458,7 +3476,7 @@ Public Class ucrCalculator Private Sub cmdCircQ3_Click(sender As Object, e As EventArgs) Handles cmdCircQ3.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.75, na.rm = FALSE, names = TRUE, type = 7)", 55) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.75, na.rm = TRUE, names = TRUE, type = 7)", 54) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = 0.75)", 16) End If @@ -3466,7 +3484,7 @@ Public Class ucrCalculator Private Sub cmdCircQuantiles_Click_1(sender As Object, e As EventArgs) Handles cmdCircQuantiles.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25), na.rm = FALSE, names = TRUE, type = 7)", 66) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25), na.rm = TRUE, names = TRUE, type = 7)", 65) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::quantile.circular(x = , probs = seq(0, 1, 0.25))", 28) End If @@ -3474,7 +3492,7 @@ Public Class ucrCalculator Private Sub cmdCircRho_Click_1(sender As Object, e As EventArgs) Handles cmdCircRho.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::rho.circular(x = , na.rm = FALSE)", 17) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::rho.circular(x = , na.rm = TRUE)", 16) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::rho.circular()", 1) End If From 4c3ad54e119235b723a967ef962adf0bd24c5cb3 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Thu, 28 Mar 2024 17:06:48 +0100 Subject: [PATCH 70/88] Change made --- instat/dlgEvapotranspiration.vb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/instat/dlgEvapotranspiration.vb b/instat/dlgEvapotranspiration.vb index 13e70ffc238..45452879aa7 100644 --- a/instat/dlgEvapotranspiration.vb +++ b/instat/dlgEvapotranspiration.vb @@ -226,8 +226,6 @@ Public Class dlgEvapotranspiration clsReadInputsFunction.AddParameter("varnames", clsRFunctionParameter:=clsVarnamesVectorPMFunction, iPosition:=0) clsReadInputsFunction.AddParameter("climatedata", clsRFunctionParameter:=clsDataFunctionPMFunction, iPosition:=1) clsReadInputsFunction.AddParameter("missing_method", Chr(34) & "monthly average" & Chr(34), iPosition:=8) - clsReadInputsFunction.AddParameter("varnames", clsRFunctionParameter:=clsVarnamesVectorPTFunction, iPosition:=10) - clsReadInputsFunction.AddParameter("climatedata", clsRFunctionParameter:=clsDataFunctionPTFunction, iPosition:=11) clsReadInputsFunction.SetAssignTo("temp_data") clsVarnamesVectorPTFunction.SetRCommand("c") @@ -295,6 +293,8 @@ Public Class dlgEvapotranspiration ucrBase.clsRsyntax.ClearCodes() ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperator) ucrBase.clsRsyntax.AddToBeforeCodes(clsListFunction, iPosition:=1) + + Constants() End Sub Private Sub SetRCodeForControls(bReset As Boolean) @@ -316,7 +316,6 @@ Public Class dlgEvapotranspiration ucrReceiverTmin.SetRCode(clsDataFunctionPMFunction, bReset) ucrReceiverHumidityMax.SetRCode(clsDataFunctionPMFunction, bReset) ucrReceiverHumidityMin.SetRCode(clsDataFunctionPMFunction, bReset) - ucrReceiverWindSpeed.SetRCode(clsDataFunctionPMFunction, bReset) ucrInputTimeStep.SetRCode(clsETPenmanMonteithFunction, bReset) ucrInputCrop.SetRCode(clsETPenmanMonteithFunction, bReset) ucrChkWind.SetRCode(clsETPenmanMonteithFunction, bReset) @@ -324,6 +323,7 @@ Public Class dlgEvapotranspiration ucrPnlMethod.SetRCode(clsBaseOperator, bReset) ucrNudAlpha.SetRCode(clsETPriestleyTaylorFunction, bReset) If bReset Then + ucrReceiverWindSpeed.SetRCode(clsDataFunctionPMFunction, bReset) ucrInputSolar.SetRCode(clsETPenmanMonteithFunction, bReset) End If End Sub @@ -488,9 +488,9 @@ Public Class dlgEvapotranspiration Private Sub ucrReceiverWindSpeed_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverWindSpeed.ControlValueChanged, ucrChkWind.ControlValueChanged If ucrChkWind.Checked AndAlso Not ucrReceiverWindSpeed.IsEmpty Then - clsVarnamesVectorPMFunction.AddParameter("u2", Chr(34) & "u2" & Chr(34), bIncludeArgumentName:=False) + clsVarnamesVectorPMFunction.AddParameter("x", Chr(34) & "u2" & Chr(34), bIncludeArgumentName:=False) Else - clsVarnamesVectorPMFunction.RemoveParameterByName("u2") + clsVarnamesVectorPMFunction.RemoveParameterByName("x") ucrReceiverHumidityMax.SetMeAsReceiver() End If End Sub @@ -610,7 +610,7 @@ Public Class dlgEvapotranspiration Solar() End Sub - Private Sub ucrPnlMethod_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlMethod.ControlContentsChanged, ucrNewColName.ControlContentsChanged, ucrReceiverDate.ControlContentsChanged, ucrReceiverTmax.ControlContentsChanged, ucrReceiverTmin.ControlContentsChanged, ucrReceiverHumidityMax.ControlContentsChanged, ucrReceiverHumidityMin.ControlContentsChanged, ucrReceiverRadiation.ControlContentsChanged, ucrReceiverWindSpeed.ControlContentsChanged, ucrInputTimeStep.ControlContentsChanged, ucrChkWind.ControlContentsChanged, ucrChkWind.ControlContentsChanged + Private Sub ucrPnlMethod_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlMethod.ControlContentsChanged, ucrNewColName.ControlContentsChanged, ucrReceiverDate.ControlContentsChanged, ucrReceiverTmax.ControlContentsChanged, ucrReceiverTmin.ControlContentsChanged, ucrReceiverHumidityMax.ControlContentsChanged, ucrReceiverHumidityMin.ControlContentsChanged, ucrReceiverRadiation.ControlContentsChanged, ucrReceiverWindSpeed.ControlContentsChanged, ucrInputTimeStep.ControlContentsChanged, ucrChkWind.ControlContentsChanged TestOKEnabled() End Sub End Class From c03010ab2f28fd1e6d92a027b2020a0fa39de883 Mon Sep 17 00:00:00 2001 From: JUMA Date: Thu, 28 Mar 2024 19:14:59 +0300 Subject: [PATCH 71/88] changes --- instat/ucrCalculator.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/ucrCalculator.vb b/instat/ucrCalculator.vb index cd75f67e5bf..00edde45fee 100644 --- a/instat/ucrCalculator.vb +++ b/instat/ucrCalculator.vb @@ -3396,7 +3396,7 @@ Public Class ucrCalculator Private Sub cmdMedianHL_Click(sender As Object, e As EventArgs) Handles cmdMedianHL.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular(x = , na.rm = TRUE, method = c(HL1,HL2,HL3), prop = NULL)", 54) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular(x = , na.rm = TRUE, method = c(""HL1"",""HL2"",""HL3""), prop = NULL)", 60) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("circular::medianHL.circular()", 1) End If From 7be7e6f681592a27e989c21a775f5aae2095f007 Mon Sep 17 00:00:00 2001 From: JUMA Date: Tue, 2 Apr 2024 17:09:44 +0300 Subject: [PATCH 72/88] chng --- instat/ucrCalculator.Designer.vb | 390 +++++++++++++++---------------- instat/ucrCalculator.vb | 135 +++++++---- 2 files changed, 290 insertions(+), 235 deletions(-) diff --git a/instat/ucrCalculator.Designer.vb b/instat/ucrCalculator.Designer.vb index 65671a93f4d..841b380b668 100644 --- a/instat/ucrCalculator.Designer.vb +++ b/instat/ucrCalculator.Designer.vb @@ -86,6 +86,7 @@ Partial Class ucrCalculator Me.cmdMdy = New System.Windows.Forms.Button() Me.cmdYmd = New System.Windows.Forms.Button() Me.cmdLeap = New System.Windows.Forms.Button() + Me.cmdRHelp = New instat.ucrSplitButton() Me.ContextMenuStripDate = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.DateLubridateToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DateHmsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -123,6 +124,7 @@ Partial Class ucrCalculator Me.cmdGCD = New System.Windows.Forms.Button() Me.cmdGeneratePrimes = New System.Windows.Forms.Button() Me.cmdNthPrime = New System.Windows.Forms.Button() + Me.cmdIntegerRHelp = New instat.ucrSplitButton() Me.ContextMenuStripInteger = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.GmpToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DescToolsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -145,6 +147,7 @@ Partial Class ucrCalculator Me.cmdIsPrime = New System.Windows.Forms.Button() Me.cmdBigZ = New System.Windows.Forms.Button() Me.grpFactor = New System.Windows.Forms.GroupBox() + Me.cmdTransformHelp = New instat.ucrSplitButton() Me.ContextMenuStripFactor = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.FactorForcatsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cmdShuffle = New System.Windows.Forms.Button() @@ -168,6 +171,7 @@ Partial Class ucrCalculator Me.cmdFactor = New System.Windows.Forms.Button() Me.cmdAnon = New System.Windows.Forms.Button() Me.grpHydroGOF = New System.Windows.Forms.GroupBox() + Me.cmdHydroHelp = New instat.ucrSplitButton() Me.ContextMenuStripHydroGOF = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.HydroGOFToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cmdVE = New System.Windows.Forms.Button() @@ -248,6 +252,7 @@ Partial Class ucrCalculator Me.cmdGroup = New System.Windows.Forms.Button() Me.cmdGrade = New System.Windows.Forms.Button() Me.grpMaths = New System.Windows.Forms.GroupBox() + Me.cmdMathsHelp = New instat.ucrSplitButton() Me.ContextMenuStripMaths = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.MathsBaseStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.MathsStatsStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -281,6 +286,7 @@ Partial Class ucrCalculator Me.cmdwhichmax = New System.Windows.Forms.Button() Me.cmdwheremax = New System.Windows.Forms.Button() Me.cmdwhichmin = New System.Windows.Forms.Button() + Me.cmdSummaryRHelp = New instat.ucrSplitButton() Me.ContextMenuStripSummary = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.BaseToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem() Me.StatsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -334,6 +340,7 @@ Partial Class ucrCalculator Me.cmdVar = New System.Windows.Forms.Button() Me.grpProbabilty = New System.Windows.Forms.GroupBox() Me.cmdPascal = New System.Windows.Forms.Button() + Me.cmdProbRHelp = New instat.ucrSplitButton() Me.ContextMenuStripProbability = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.ProbStatsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ProbBaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -382,6 +389,7 @@ Partial Class ucrCalculator Me.cmdDecimals = New System.Windows.Forms.Button() Me.cmdMASSFractions = New System.Windows.Forms.Button() Me.cmdScale = New System.Windows.Forms.Button() + Me.cmdTransformRHelp = New instat.ucrSplitButton() Me.ContextMenuStripTransform = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.BaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DplyrToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -416,6 +424,7 @@ Partial Class ucrCalculator Me.cmdLead = New System.Windows.Forms.Button() Me.cmdLag = New System.Windows.Forms.Button() Me.grpLogical = New System.Windows.Forms.GroupBox() + Me.cmdLogicalHelp = New instat.ucrSplitButton() Me.ContextMenuStripLogical = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.LogBaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.LogDplyrToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -479,6 +488,7 @@ Partial Class ucrCalculator Me.cmdSquishb = New System.Windows.Forms.Button() Me.ttCalculator = New System.Windows.Forms.ToolTip(Me.components) Me.grpCircular = New System.Windows.Forms.GroupBox() + Me.cmdCircularHelp = New instat.ucrSplitButton() Me.ContextMenuStripCircular = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.CircularToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cmdCircular = New System.Windows.Forms.Button() @@ -521,6 +531,7 @@ Partial Class ucrCalculator Me.grpComplex = New System.Windows.Forms.GroupBox() Me.cmdAsComplex = New System.Windows.Forms.Button() Me.cmdComplexi = New System.Windows.Forms.Button() + Me.cmdComplexRHelp = New instat.ucrSplitButton() Me.cmdComplexTanH = New System.Windows.Forms.Button() Me.cmdComplexTan = New System.Windows.Forms.Button() Me.cmdComplexPi = New System.Windows.Forms.Button() @@ -611,53 +622,42 @@ Partial Class ucrCalculator Me.ucrInputCalOptions = New instat.ucrInputComboBox() Me.ucrSelectorForCalculations = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverForCalculation = New instat.ucrReceiverExpression() - Me.cmdCircularHelp = New instat.ucrSplitButton() - Me.cmdMathsHelp = New instat.ucrSplitButton() - Me.cmdProbRHelp = New instat.ucrSplitButton() - Me.cmdIntegerRHelp = New instat.ucrSplitButton() - Me.cmdComplexRHelp = New instat.ucrSplitButton() - Me.cmdSummaryRHelp = New instat.ucrSplitButton() - Me.cmdTransformRHelp = New instat.ucrSplitButton() - Me.cmdLogicalHelp = New instat.ucrSplitButton() - Me.cmdRHelp = New instat.ucrSplitButton() - Me.cmdHydroHelp = New instat.ucrSplitButton() - Me.cmdTransformHelp = New instat.ucrSplitButton() - Me.grpBasic.SuspendLayout() - Me.grpDates.SuspendLayout() - Me.ContextMenuStripDate.SuspendLayout() - Me.ContextMenuStripComplex.SuspendLayout() - Me.grpInteger.SuspendLayout() - Me.ContextMenuStripInteger.SuspendLayout() - Me.grpFactor.SuspendLayout() - Me.ContextMenuStripFactor.SuspendLayout() - Me.grpHydroGOF.SuspendLayout() - Me.ContextMenuStripHydroGOF.SuspendLayout() - Me.grpWakefield.SuspendLayout() - Me.grpMaths.SuspendLayout() - Me.ContextMenuStripMaths.SuspendLayout() - Me.grpSummary.SuspendLayout() - Me.ContextMenuStripSummary.SuspendLayout() - Me.grpFrequencies.SuspendLayout() - Me.grpProbabilty.SuspendLayout() - Me.ContextMenuStripProbability.SuspendLayout() - Me.grpRandom.SuspendLayout() - Me.grpTransform.SuspendLayout() - Me.ContextMenuStripTransform.SuspendLayout() - Me.grpLogical.SuspendLayout() - Me.ContextMenuStripLogical.SuspendLayout() - Me.grpTestString.SuspendLayout() - Me.grpCircular.SuspendLayout() - Me.ContextMenuStripCircular.SuspendLayout() - Me.grpModifier.SuspendLayout() - Me.grpSymbols.SuspendLayout() - Me.grpComplex.SuspendLayout() - Me.ContextMenuStripTxtString.SuspendLayout() - Me.ContextMenuStripWakefield.SuspendLayout() - Me.ContextMenuStripList.SuspendLayout() - Me.grpList.SuspendLayout() - Me.GroupBox1.SuspendLayout() - Me.grpMathBloc.SuspendLayout() - Me.SuspendLayout() + Me.grpBasic.SuspendLayout + Me.grpDates.SuspendLayout + Me.ContextMenuStripDate.SuspendLayout + Me.ContextMenuStripComplex.SuspendLayout + Me.grpInteger.SuspendLayout + Me.ContextMenuStripInteger.SuspendLayout + Me.grpFactor.SuspendLayout + Me.ContextMenuStripFactor.SuspendLayout + Me.grpHydroGOF.SuspendLayout + Me.ContextMenuStripHydroGOF.SuspendLayout + Me.grpWakefield.SuspendLayout + Me.grpMaths.SuspendLayout + Me.ContextMenuStripMaths.SuspendLayout + Me.grpSummary.SuspendLayout + Me.ContextMenuStripSummary.SuspendLayout + Me.grpFrequencies.SuspendLayout + Me.grpProbabilty.SuspendLayout + Me.ContextMenuStripProbability.SuspendLayout + Me.grpRandom.SuspendLayout + Me.grpTransform.SuspendLayout + Me.ContextMenuStripTransform.SuspendLayout + Me.grpLogical.SuspendLayout + Me.ContextMenuStripLogical.SuspendLayout + Me.grpTestString.SuspendLayout + Me.grpCircular.SuspendLayout + Me.ContextMenuStripCircular.SuspendLayout + Me.grpModifier.SuspendLayout + Me.grpSymbols.SuspendLayout + Me.grpComplex.SuspendLayout + Me.ContextMenuStripTxtString.SuspendLayout + Me.ContextMenuStripWakefield.SuspendLayout + Me.ContextMenuStripList.SuspendLayout + Me.grpList.SuspendLayout + Me.GroupBox1.SuspendLayout + Me.grpMathBloc.SuspendLayout + Me.SuspendLayout ' 'lblExpression ' @@ -1217,6 +1217,18 @@ Partial Class ucrCalculator Me.cmdLeap.Text = "leap" Me.cmdLeap.UseVisualStyleBackColor = True ' + 'cmdRHelp + ' + Me.cmdRHelp.AutoSize = True + Me.cmdRHelp.ContextMenuStrip = Me.ContextMenuStripDate + Me.cmdRHelp.Location = New System.Drawing.Point(194, 248) + Me.cmdRHelp.Name = "cmdRHelp" + Me.cmdRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdRHelp.SplitMenuStrip = Me.ContextMenuStripDate + Me.cmdRHelp.TabIndex = 212 + Me.cmdRHelp.Text = "R Help" + Me.cmdRHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripDate ' Me.ContextMenuStripDate.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -1610,6 +1622,18 @@ Partial Class ucrCalculator Me.cmdNthPrime.Text = "nth_prime" Me.cmdNthPrime.UseVisualStyleBackColor = True ' + 'cmdIntegerRHelp + ' + Me.cmdIntegerRHelp.AutoSize = True + Me.cmdIntegerRHelp.ContextMenuStrip = Me.ContextMenuStripInteger + Me.cmdIntegerRHelp.Location = New System.Drawing.Point(262, 354) + Me.cmdIntegerRHelp.Name = "cmdIntegerRHelp" + Me.cmdIntegerRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdIntegerRHelp.SplitMenuStrip = Me.ContextMenuStripInteger + Me.cmdIntegerRHelp.TabIndex = 16 + Me.cmdIntegerRHelp.Text = "R Help" + Me.cmdIntegerRHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripInteger ' Me.ContextMenuStripInteger.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -1815,6 +1839,18 @@ Partial Class ucrCalculator Me.grpFactor.TabStop = False Me.grpFactor.Text = "Factor" ' + 'cmdTransformHelp + ' + Me.cmdTransformHelp.AutoSize = True + Me.cmdTransformHelp.ContextMenuStrip = Me.ContextMenuStripFactor + Me.cmdTransformHelp.Location = New System.Drawing.Point(188, 218) + Me.cmdTransformHelp.Name = "cmdTransformHelp" + Me.cmdTransformHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdTransformHelp.SplitMenuStrip = Me.ContextMenuStripFactor + Me.cmdTransformHelp.TabIndex = 212 + Me.cmdTransformHelp.Text = "R Help" + Me.cmdTransformHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripFactor ' Me.ContextMenuStripFactor.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -2081,6 +2117,18 @@ Partial Class ucrCalculator Me.grpHydroGOF.TabStop = False Me.grpHydroGOF.Text = "hydroGOF " ' + 'cmdHydroHelp + ' + Me.cmdHydroHelp.AutoSize = True + Me.cmdHydroHelp.ContextMenuStrip = Me.ContextMenuStripHydroGOF + Me.cmdHydroHelp.Location = New System.Drawing.Point(113, 298) + Me.cmdHydroHelp.Name = "cmdHydroHelp" + Me.cmdHydroHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdHydroHelp.SplitMenuStrip = Me.ContextMenuStripHydroGOF + Me.cmdHydroHelp.TabIndex = 212 + Me.cmdHydroHelp.Text = "R Help" + Me.cmdHydroHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripHydroGOF ' Me.ContextMenuStripHydroGOF.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -3029,6 +3077,18 @@ Partial Class ucrCalculator Me.grpMaths.TabStop = False Me.grpMaths.Text = "Maths" ' + 'cmdMathsHelp + ' + Me.cmdMathsHelp.AutoSize = True + Me.cmdMathsHelp.ContextMenuStrip = Me.ContextMenuStripMaths + Me.cmdMathsHelp.Location = New System.Drawing.Point(204, 165) + Me.cmdMathsHelp.Name = "cmdMathsHelp" + Me.cmdMathsHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdMathsHelp.SplitMenuStrip = Me.ContextMenuStripMaths + Me.cmdMathsHelp.TabIndex = 211 + Me.cmdMathsHelp.Text = "R Help" + Me.cmdMathsHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripMaths ' Me.ContextMenuStripMaths.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -3323,7 +3383,6 @@ Partial Class ucrCalculator Me.grpSummary.Controls.Add(Me.cmdwheremax) Me.grpSummary.Controls.Add(Me.cmdwhichmin) Me.grpSummary.Controls.Add(Me.cmdSummaryRHelp) - Me.grpSummary.Controls.Add(Me.grpFrequencies) Me.grpSummary.Controls.Add(Me.cmdKurtosis) Me.grpSummary.Controls.Add(Me.cmdMode1) Me.grpSummary.Controls.Add(Me.cmdMode) @@ -3352,6 +3411,7 @@ Partial Class ucrCalculator Me.grpSummary.Controls.Add(Me.cmdLength) Me.grpSummary.Controls.Add(Me.cmdSum) Me.grpSummary.Controls.Add(Me.cmdVar) + Me.grpSummary.Controls.Add(Me.grpFrequencies) Me.grpSummary.Location = New System.Drawing.Point(542, 78) Me.grpSummary.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.grpSummary.Name = "grpSummary" @@ -3407,6 +3467,18 @@ Partial Class ucrCalculator Me.cmdwhichmin.Text = "which.min" Me.cmdwhichmin.UseVisualStyleBackColor = True ' + 'cmdSummaryRHelp + ' + Me.cmdSummaryRHelp.AutoSize = True + Me.cmdSummaryRHelp.ContextMenuStrip = Me.ContextMenuStripSummary + Me.cmdSummaryRHelp.Location = New System.Drawing.Point(228, 238) + Me.cmdSummaryRHelp.Name = "cmdSummaryRHelp" + Me.cmdSummaryRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdSummaryRHelp.SplitMenuStrip = Me.ContextMenuStripSummary + Me.cmdSummaryRHelp.TabIndex = 185 + Me.cmdSummaryRHelp.Text = "R Help" + Me.cmdSummaryRHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripSummary ' Me.ContextMenuStripSummary.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -4029,6 +4101,18 @@ Partial Class ucrCalculator Me.cmdPascal.Text = "pascal" Me.cmdPascal.UseVisualStyleBackColor = True ' + 'cmdProbRHelp + ' + Me.cmdProbRHelp.AutoSize = True + Me.cmdProbRHelp.ContextMenuStrip = Me.ContextMenuStripProbability + Me.cmdProbRHelp.Location = New System.Drawing.Point(269, 239) + Me.cmdProbRHelp.Name = "cmdProbRHelp" + Me.cmdProbRHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdProbRHelp.SplitMenuStrip = Me.ContextMenuStripProbability + Me.cmdProbRHelp.TabIndex = 212 + Me.cmdProbRHelp.Text = "R Help" + Me.cmdProbRHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripProbability ' Me.ContextMenuStripProbability.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -4619,6 +4703,18 @@ Partial Class ucrCalculator Me.cmdScale.Text = "scale" Me.cmdScale.UseVisualStyleBackColor = True ' + 'cmdTransformRHelp + ' + Me.cmdTransformRHelp.AutoSize = True + Me.cmdTransformRHelp.ContextMenuStrip = Me.ContextMenuStripTransform + Me.cmdTransformRHelp.Location = New System.Drawing.Point(267, 245) + Me.cmdTransformRHelp.Name = "cmdTransformRHelp" + Me.cmdTransformRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdTransformRHelp.SplitMenuStrip = Me.ContextMenuStripTransform + Me.cmdTransformRHelp.TabIndex = 204 + Me.cmdTransformRHelp.Text = "R Help" + Me.cmdTransformRHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripTransform ' Me.ContextMenuStripTransform.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -4974,6 +5070,18 @@ Partial Class ucrCalculator Me.grpLogical.TabStop = False Me.grpLogical.Text = "Logical and Symbols" ' + 'cmdLogicalHelp + ' + Me.cmdLogicalHelp.AutoSize = True + Me.cmdLogicalHelp.ContextMenuStrip = Me.ContextMenuStripLogical + Me.cmdLogicalHelp.Location = New System.Drawing.Point(207, 234) + Me.cmdLogicalHelp.Name = "cmdLogicalHelp" + Me.cmdLogicalHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdLogicalHelp.SplitMenuStrip = Me.ContextMenuStripLogical + Me.cmdLogicalHelp.TabIndex = 212 + Me.cmdLogicalHelp.Text = "R Help" + Me.cmdLogicalHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripLogical ' Me.ContextMenuStripLogical.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -5721,6 +5829,18 @@ Partial Class ucrCalculator Me.grpCircular.TabStop = False Me.grpCircular.Text = "Circular" ' + 'cmdCircularHelp + ' + Me.cmdCircularHelp.AutoSize = True + Me.cmdCircularHelp.ContextMenuStrip = Me.ContextMenuStripCircular + Me.cmdCircularHelp.Location = New System.Drawing.Point(197, 178) + Me.cmdCircularHelp.Name = "cmdCircularHelp" + Me.cmdCircularHelp.Size = New System.Drawing.Size(108, 38) + Me.cmdCircularHelp.SplitMenuStrip = Me.ContextMenuStripCircular + Me.cmdCircularHelp.TabIndex = 212 + Me.cmdCircularHelp.Text = "R Help" + Me.cmdCircularHelp.UseVisualStyleBackColor = True + ' 'ContextMenuStripCircular ' Me.ContextMenuStripCircular.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -6208,14 +6328,26 @@ Partial Class ucrCalculator ' Me.cmdComplexi.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexi.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexi.Location = New System.Drawing.Point(111, 202) + Me.cmdComplexi.Location = New System.Drawing.Point(30, 240) Me.cmdComplexi.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexi.Name = "cmdComplexi" - Me.cmdComplexi.Size = New System.Drawing.Size(88, 38) + Me.cmdComplexi.Size = New System.Drawing.Size(82, 38) Me.cmdComplexi.TabIndex = 210 Me.cmdComplexi.Text = "i" Me.cmdComplexi.UseVisualStyleBackColor = True ' + 'cmdComplexRHelp + ' + Me.cmdComplexRHelp.AutoSize = True + Me.cmdComplexRHelp.ContextMenuStrip = Me.ContextMenuStripComplex + Me.cmdComplexRHelp.Location = New System.Drawing.Point(237, 240) + Me.cmdComplexRHelp.Name = "cmdComplexRHelp" + Me.cmdComplexRHelp.Size = New System.Drawing.Size(113, 38) + Me.cmdComplexRHelp.SplitMenuStrip = Me.ContextMenuStripComplex + Me.cmdComplexRHelp.TabIndex = 209 + Me.cmdComplexRHelp.Text = "R Help" + Me.cmdComplexRHelp.UseVisualStyleBackColor = True + ' 'cmdComplexTanH ' Me.cmdComplexTanH.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) @@ -6244,10 +6376,10 @@ Partial Class ucrCalculator ' Me.cmdComplexPi.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexPi.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexPi.Location = New System.Drawing.Point(31, 202) + Me.cmdComplexPi.Location = New System.Drawing.Point(279, 164) Me.cmdComplexPi.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexPi.Name = "cmdComplexPi" - Me.cmdComplexPi.Size = New System.Drawing.Size(81, 38) + Me.cmdComplexPi.Size = New System.Drawing.Size(78, 38) Me.cmdComplexPi.TabIndex = 206 Me.cmdComplexPi.Text = "pi" Me.cmdComplexPi.UseVisualStyleBackColor = True @@ -6280,7 +6412,7 @@ Partial Class ucrCalculator ' Me.cmdComplexSignif.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexSignif.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexSignif.Location = New System.Drawing.Point(198, 165) + Me.cmdComplexSignif.Location = New System.Drawing.Point(198, 203) Me.cmdComplexSignif.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexSignif.Name = "cmdComplexSignif" Me.cmdComplexSignif.Size = New System.Drawing.Size(82, 38) @@ -6352,7 +6484,7 @@ Partial Class ucrCalculator ' Me.cmdComplexRound.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexRound.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexRound.Location = New System.Drawing.Point(111, 165) + Me.cmdComplexRound.Location = New System.Drawing.Point(111, 203) Me.cmdComplexRound.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexRound.Name = "cmdComplexRound" Me.cmdComplexRound.Size = New System.Drawing.Size(88, 38) @@ -6364,7 +6496,7 @@ Partial Class ucrCalculator ' Me.cmdComplexLog.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexLog.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexLog.Location = New System.Drawing.Point(279, 165) + Me.cmdComplexLog.Location = New System.Drawing.Point(279, 203) Me.cmdComplexLog.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexLog.Name = "cmdComplexLog" Me.cmdComplexLog.Size = New System.Drawing.Size(79, 38) @@ -6376,7 +6508,7 @@ Partial Class ucrCalculator ' Me.cmdComplexSqrt.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexSqrt.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexSqrt.Location = New System.Drawing.Point(30, 165) + Me.cmdComplexSqrt.Location = New System.Drawing.Point(30, 203) Me.cmdComplexSqrt.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexSqrt.Name = "cmdComplexSqrt" Me.cmdComplexSqrt.Size = New System.Drawing.Size(82, 38) @@ -7285,144 +7417,11 @@ Partial Class ucrCalculator Me.ucrReceiverForCalculation.TabIndex = 120 Me.ucrReceiverForCalculation.ucrSelector = Nothing ' - 'cmdCircularHelp - ' - Me.cmdCircularHelp.AutoSize = True - Me.cmdCircularHelp.ContextMenuStrip = Me.ContextMenuStripCircular - Me.cmdCircularHelp.Location = New System.Drawing.Point(197, 178) - Me.cmdCircularHelp.Name = "cmdCircularHelp" - Me.cmdCircularHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdCircularHelp.SplitMenuStrip = Me.ContextMenuStripCircular - Me.cmdCircularHelp.TabIndex = 212 - Me.cmdCircularHelp.Text = "R Help" - Me.cmdCircularHelp.UseVisualStyleBackColor = True - ' - 'cmdMathsHelp - ' - Me.cmdMathsHelp.AutoSize = True - Me.cmdMathsHelp.ContextMenuStrip = Me.ContextMenuStripMaths - Me.cmdMathsHelp.Location = New System.Drawing.Point(204, 165) - Me.cmdMathsHelp.Name = "cmdMathsHelp" - Me.cmdMathsHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdMathsHelp.SplitMenuStrip = Me.ContextMenuStripMaths - Me.cmdMathsHelp.TabIndex = 211 - Me.cmdMathsHelp.Text = "R Help" - Me.cmdMathsHelp.UseVisualStyleBackColor = True - ' - 'cmdProbRHelp - ' - Me.cmdProbRHelp.AutoSize = True - Me.cmdProbRHelp.ContextMenuStrip = Me.ContextMenuStripProbability - Me.cmdProbRHelp.Location = New System.Drawing.Point(269, 239) - Me.cmdProbRHelp.Name = "cmdProbRHelp" - Me.cmdProbRHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdProbRHelp.SplitMenuStrip = Me.ContextMenuStripProbability - Me.cmdProbRHelp.TabIndex = 212 - Me.cmdProbRHelp.Text = "R Help" - Me.cmdProbRHelp.UseVisualStyleBackColor = True - ' - 'cmdIntegerRHelp - ' - Me.cmdIntegerRHelp.AutoSize = True - Me.cmdIntegerRHelp.ContextMenuStrip = Me.ContextMenuStripInteger - Me.cmdIntegerRHelp.Location = New System.Drawing.Point(262, 354) - Me.cmdIntegerRHelp.Name = "cmdIntegerRHelp" - Me.cmdIntegerRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdIntegerRHelp.SplitMenuStrip = Me.ContextMenuStripInteger - Me.cmdIntegerRHelp.TabIndex = 16 - Me.cmdIntegerRHelp.Text = "R Help" - Me.cmdIntegerRHelp.UseVisualStyleBackColor = True - ' - 'cmdComplexRHelp - ' - Me.cmdComplexRHelp.AutoSize = True - Me.cmdComplexRHelp.ContextMenuStrip = Me.ContextMenuStripComplex - Me.cmdComplexRHelp.Location = New System.Drawing.Point(228, 212) - Me.cmdComplexRHelp.Name = "cmdComplexRHelp" - Me.cmdComplexRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdComplexRHelp.SplitMenuStrip = Me.ContextMenuStripComplex - Me.cmdComplexRHelp.TabIndex = 209 - Me.cmdComplexRHelp.Text = "R Help" - Me.cmdComplexRHelp.UseVisualStyleBackColor = True - ' - 'cmdSummaryRHelp - ' - Me.cmdSummaryRHelp.AutoSize = True - Me.cmdSummaryRHelp.ContextMenuStrip = Me.ContextMenuStripSummary - Me.cmdSummaryRHelp.Location = New System.Drawing.Point(228, 238) - Me.cmdSummaryRHelp.Name = "cmdSummaryRHelp" - Me.cmdSummaryRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdSummaryRHelp.SplitMenuStrip = Me.ContextMenuStripSummary - Me.cmdSummaryRHelp.TabIndex = 185 - Me.cmdSummaryRHelp.Text = "R Help" - Me.cmdSummaryRHelp.UseVisualStyleBackColor = True - ' - 'cmdTransformRHelp - ' - Me.cmdTransformRHelp.AutoSize = True - Me.cmdTransformRHelp.ContextMenuStrip = Me.ContextMenuStripTransform - Me.cmdTransformRHelp.Location = New System.Drawing.Point(267, 245) - Me.cmdTransformRHelp.Name = "cmdTransformRHelp" - Me.cmdTransformRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdTransformRHelp.SplitMenuStrip = Me.ContextMenuStripTransform - Me.cmdTransformRHelp.TabIndex = 204 - Me.cmdTransformRHelp.Text = "R Help" - Me.cmdTransformRHelp.UseVisualStyleBackColor = True - ' - 'cmdLogicalHelp - ' - Me.cmdLogicalHelp.AutoSize = True - Me.cmdLogicalHelp.ContextMenuStrip = Me.ContextMenuStripLogical - Me.cmdLogicalHelp.Location = New System.Drawing.Point(207, 234) - Me.cmdLogicalHelp.Name = "cmdLogicalHelp" - Me.cmdLogicalHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdLogicalHelp.SplitMenuStrip = Me.ContextMenuStripLogical - Me.cmdLogicalHelp.TabIndex = 212 - Me.cmdLogicalHelp.Text = "R Help" - Me.cmdLogicalHelp.UseVisualStyleBackColor = True - ' - 'cmdRHelp - ' - Me.cmdRHelp.AutoSize = True - Me.cmdRHelp.ContextMenuStrip = Me.ContextMenuStripDate - Me.cmdRHelp.Location = New System.Drawing.Point(194, 248) - Me.cmdRHelp.Name = "cmdRHelp" - Me.cmdRHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdRHelp.SplitMenuStrip = Me.ContextMenuStripDate - Me.cmdRHelp.TabIndex = 212 - Me.cmdRHelp.Text = "R Help" - Me.cmdRHelp.UseVisualStyleBackColor = True - ' - 'cmdHydroHelp - ' - Me.cmdHydroHelp.AutoSize = True - Me.cmdHydroHelp.ContextMenuStrip = Me.ContextMenuStripHydroGOF - Me.cmdHydroHelp.Location = New System.Drawing.Point(113, 298) - Me.cmdHydroHelp.Name = "cmdHydroHelp" - Me.cmdHydroHelp.Size = New System.Drawing.Size(108, 38) - Me.cmdHydroHelp.SplitMenuStrip = Me.ContextMenuStripHydroGOF - Me.cmdHydroHelp.TabIndex = 212 - Me.cmdHydroHelp.Text = "R Help" - Me.cmdHydroHelp.UseVisualStyleBackColor = True - ' - 'cmdTransformHelp - ' - Me.cmdTransformHelp.AutoSize = True - Me.cmdTransformHelp.ContextMenuStrip = Me.ContextMenuStripFactor - Me.cmdTransformHelp.Location = New System.Drawing.Point(188, 218) - Me.cmdTransformHelp.Name = "cmdTransformHelp" - Me.cmdTransformHelp.Size = New System.Drawing.Size(113, 38) - Me.cmdTransformHelp.SplitMenuStrip = Me.ContextMenuStripFactor - Me.cmdTransformHelp.TabIndex = 212 - Me.cmdTransformHelp.Text = "R Help" - Me.cmdTransformHelp.UseVisualStyleBackColor = True - ' 'ucrCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(120.0!, 120.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.Controls.Add(Me.grpList) Me.Controls.Add(Me.cmdRhelpList) Me.Controls.Add(Me.cmdWakefieldHelp) Me.Controls.Add(Me.cmdStringRHelp) @@ -7434,12 +7433,6 @@ Partial Class ucrCalculator Me.Controls.Add(Me.ucrSelectorForCalculations) Me.Controls.Add(Me.ucrReceiverForCalculation) Me.Controls.Add(Me.lblExpression) - Me.Controls.Add(Me.grpSymbols) - Me.Controls.Add(Me.grpCircular) - Me.Controls.Add(Me.grpMaths) - Me.Controls.Add(Me.grpProbabilty) - Me.Controls.Add(Me.grpInteger) - Me.Controls.Add(Me.grpTestString) Me.Controls.Add(Me.grpComplex) Me.Controls.Add(Me.grpSummary) Me.Controls.Add(Me.grpTransform) @@ -7449,6 +7442,13 @@ Partial Class ucrCalculator Me.Controls.Add(Me.grpHydroGOF) Me.Controls.Add(Me.grpFactor) Me.Controls.Add(Me.grpWakefield) + Me.Controls.Add(Me.grpList) + Me.Controls.Add(Me.grpCircular) + Me.Controls.Add(Me.grpMaths) + Me.Controls.Add(Me.grpProbabilty) + Me.Controls.Add(Me.grpInteger) + Me.Controls.Add(Me.grpTestString) + Me.Controls.Add(Me.grpSymbols) Me.Name = "ucrCalculator" Me.Size = New System.Drawing.Size(1123, 572) Me.grpBasic.ResumeLayout(False) diff --git a/instat/ucrCalculator.vb b/instat/ucrCalculator.vb index 00edde45fee..6c65da296b1 100644 --- a/instat/ucrCalculator.vb +++ b/instat/ucrCalculator.vb @@ -280,7 +280,7 @@ Public Class ucrCalculator ' Complex keyboard tooltips ttCalculator.SetToolTip(cmdComplexPi, "pi = 3.14159") ttCalculator.SetToolTip(cmdComplexi, "i is defined as the square root of -1. So sqrt(as.complex(-1)) = 0 + 1i") - ttCalculator.SetToolTip(cmdComplex, "Construct a complex number. For example complex(3, 2) gives 3 + 2i.") + ttCalculator.SetToolTip(cmdComplex, "Generate a complex variable. For example complex(3, 2:4,1. 5) gives 2+1.5i, 3+1.5i, 4+1.5i") ttCalculator.SetToolTip(cmdAsComplex, "Define a variable as complex. For example as.complex(-1) gives 1 + 0i") ttCalculator.SetToolTip(cmdReal, "The real part of a complex number. For example Re(3 + 2i) gives 3.") ttCalculator.SetToolTip(cmdImaginary, "The imaginary part of a complex number or variable. For example Im(3 + 2i) gives 2.") @@ -290,9 +290,19 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdComplexRad, "Change from degrees to radians. For example rad(90 + 180i) gives (1.571 + 3.142i)") ttCalculator.SetToolTip(cmdComplexDeg, " Change from radians to degrees. For example deg(pi/2 + 3.142i) gives (90 + 180i)") ttCalculator.SetToolTip(cmdComplexSqrt, "Square root. For example sqrt(-9 + 0i) gives (0 + 3i) or just 3i. sqrt(-9 + 2i) gives 0.331 + 3.018i)") - 'to add ttCalculator.SetToolTip(cmdComplexExp, "The exponential function. For example exp(3 + 2i) gives") + ttCalculator.SetToolTip(cmdComplexExp, "exponential function. For example exp(1 + 2i) gives -1.131+2.472i") ttCalculator.SetToolTip(cmdComplexRound, "round(pi/2 + 3.14259i) gives 2 + 3i) so rounds to whole numbers. round(pi/2 + 3.14259i, 2) gives 1.57 + 3.14i, so rounds to 2 decimals.") ttCalculator.SetToolTip(cmdComplexSignif, "Rounds to give the specified number off digits in the larger of the components. For example signif(0.424 + 511.38i, 3) gives (0 + 511i)") + ttCalculator.SetToolTip(cmdComplexSin, "sine of the angle in radians For example sin(1-1i) gives (1.2985-0.635i)") + ttCalculator.SetToolTip(cmdComplexCos, "cosine of the angle in radians. For example cos(1-1i) gives (0.8337+0.9889i)") + ttCalculator.SetToolTip(cmdComplexTan, "tangent of the angle in radians. For example tan(1-i) gives (0.272-1.084i)") + 'ttCalculator.SetToolTip(cmdComplexAsin, "arcsine, or inverse of the sine. It is the angle in radians corresponding to a given sine. For example asin(1.2985-0.635i) gives (1-1i)") + ' ttCalculator.SetToolTip(cmdComplexAcos, "arccos, or inverse of the cosine. It is the angle corresponding to a given cos. For example acos(0.8337+0.9889i) gives (1-1i)") + ' ttCalculator.SetToolTip(cmdComplexAtan, "arctan or inverse of the tangent. It is the angle corresponding to a given tan. For example atan(0.272-1.084i) gives (1-1i)") + ttCalculator.SetToolTip(cmdComplexSinH, " hyperbolic sin of a number in radians (asinh also exists)") + ttCalculator.SetToolTip(cmdComplexCosH, "hyperbolic cosine of a number in radians (acosh also exists)") + ttCalculator.SetToolTip(cmdComplexTanH, "hyperbolic tangent of a number in radians (atanh also exists)") + ttCalculator.SetToolTip(cmdComplexLog, "natural logarithm. For example log(1 + 2i) gives 0.805+1.107i") 'Hydro GOF keyboard tooltips ttCalculator.SetToolTip(cmdBr2, "r-squared times the slope of the regression line between sim and obs") @@ -418,7 +428,29 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdSec, "Extract second from date-time variable. For example second(""1984-05-12 14:23:45"") is 45") ttCalculator.SetToolTip(cmdQuarter, " 3-month period of the year from a date or date-time variable. For example quarter(""1984-05-12"") gives 2") - Const strTooltipCmdLength = "number of observations: For example length(c(1,2,3,4,NA)) = 5 " + ' Factor keyboard tooltips + ttCalculator.SetToolTip(cmdFactor, "Make a factor from a numeric or character variable") + ttCalculator.SetToolTip(cmdAnon, "Anonymise factor levels, replacing them by a number. Optionally add a profix, for example fct_anon(name, ""n"")") + ttCalculator.SetToolTip(cmdLabelled, "Create a labelled variable") + ttCalculator.SetToolTip(cmdCollapse, "Combine factor levels. For example fct_collapse(variety, trad=""TRAD"",improved=c(""NEW"",""OLD""))") + ttCalculator.SetToolTip(cmdCross, "Make interaction variable. For example fct_cross(variety,fertgrp, keep_empty=TRUE)") + ttCalculator.SetToolTip(cmdDrop, "Drop unused levels") + ttCalculator.SetToolTip(cmdExpand, "Add additional levels. For example fct_expand(Village, ""New"", ""Newer"")") + ttCalculator.SetToolTip(cmdAdd_na, "Make missing values into an additional factor level. For example fct_na_value_to_level(fertgrp)") + ttCalculator.SetToolTip(cmdInorder, "Order the factor levels by their appearance in the data") + ttCalculator.SetToolTip(cmdInfreq, "Order the factor levels by their frequency ") + ttCalculator.SetToolTip(cmdInseq, "Order a factor with numeric levels") + ttCalculator.SetToolTip(cmdLump, "Change all levels appearing less than min times into Other. For example fct_lump_min(Variety,10)") + ttCalculator.SetToolTip(cmdmatch, "Make a logical variable with TRUE when levels are in the factor. For example fct_match(variety,c(""NEW"",""OLD""))") + ttCalculator.SetToolTip(cmdOther, " Replace levels with Other. For example fct_other(variety, keep=""NEW"")") + ttCalculator.SetToolTip(cmdRecode, "Change factor levels. For example fct_recode(variety,improved=""NEW"",improved=""OLD"")") + ttCalculator.SetToolTip(cmdRelevel, " Reorder factor levels. For example fct_relevel(fertgrp,""0cwt"", "".5-2cwt"")") + ttCalculator.SetToolTip(cmdReorder, "Reorder levels using (default ofmedian of another variable. For example fct_reorder(variety,yield)") + ttCalculator.SetToolTip(cmdReverse, "Reverse the order of the factor levels") + ttCalculator.SetToolTip(cmdShift, "Shift the order of the factor levels") + ttCalculator.SetToolTip(cmdShuffle, "Shuffle the order of the factor levels") + + Const strTooltipCmdLength = "number Of observations: For example length(c(1,2,3,4,NA)) = 5 " ttCalculator.SetToolTip(cmdLength, strTooltipCmdLength) ttCalculator.SetToolTip(cmdListLength, strTooltipCmdLength) @@ -1068,16 +1100,15 @@ Public Class ucrCalculator Private Sub cmdAcos_Click(sender As Object, e As EventArgs) Handles cmdAcos.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos(x = )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos()", 1) End If - End Sub Private Sub cmdAsin_Click(sender As Object, e As EventArgs) Handles cmdAsin.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin(x = )", 1) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin()", 1) End If @@ -3607,9 +3638,9 @@ Public Class ucrCalculator Private Sub cmdAdd_na_Click(sender As Object, e As EventArgs) Handles cmdAdd_na.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("forcats::fct_explicit_na(f = , na_level = ""(Missing)"")", 26) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("forcats::fct_na_value_to_level(f = , na_level = ""(Missing)"")", 26) Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("forcats::fct_explicit_na()", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("forcats::fct_na_value_to_level()", 1) End If End Sub @@ -3639,9 +3670,9 @@ Public Class ucrCalculator Private Sub cmdLump_Click(sender As Object, e As EventArgs) Handles cmdLump.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("forcats::fct_lump(f = , n, prop, w = NULL, other_level = ""Other"", ties.method = c(""min"", ""average"", ""first"", ""last"", ""random"", ""max""))", 113) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("forcats::fct_lump_min(f = , n, prop, w = NULL, other_level = ""Other"", ties.method = c(""min"", ""average"", ""first"", ""last"", ""random"", ""max""))", 113) Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("forcats::fct_lump()", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("forcats::fct_lump_min()", 1) End If End Sub @@ -5211,17 +5242,41 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(clsSampleFunction.ToScript, 36) End Sub - Private Sub cmdAsComplex_Click(sender As Object, e As EventArgs) Handles cmdComplex.Click + Private Sub cmdComplex_Click(sender As Object, e As EventArgs) Handles cmdComplex.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("complex(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("complex(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("complex( )", 1) End If End Sub + 'Private Sub cmdComplexAsin_Click(sender As Object, e As EventArgs) Handles cmdComplexAsin.Click + ' If chkShowParameters.Checked Then + ' ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin(x = )", 1) + ' Else + ' ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin()", 1) + ' End If + 'End Sub + + 'Private Sub cmdComplexAcos_Click(sender As Object, e As EventArgs) Handles cmdComplexAcos.Click + ' If chkShowParameters.Checked Then + ' ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos(x = )", 1) + ' Else + ' ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos()", 1) + ' End If + 'End Sub + + 'Private Sub cmdComplexAtan_Click(sender As Object, e As EventArgs) Handles cmdComplexAtan.Click + ' If chkShowParameters.Checked Then + ' ucrReceiverForCalculation.AddToReceiverAtCursorPosition("atan(x = )", 2) + ' Else + ' ucrReceiverForCalculation.AddToReceiverAtCursorPosition("atan()", 1) + ' End If + 'End Sub + Private Sub cmdReal_Click(sender As Object, e As EventArgs) Handles cmdReal.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Re(z = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Re(z = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Re( )", 1) End If @@ -5229,7 +5284,7 @@ Public Class ucrCalculator Private Sub cmdImaginary_Click(sender As Object, e As EventArgs) Handles cmdImaginary.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Im(z = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Im(z = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Im( )", 1) End If @@ -5237,7 +5292,7 @@ Public Class ucrCalculator Private Sub cmdMod_Click(sender As Object, e As EventArgs) Handles cmdMod.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Mod(z = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Mod(z = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Mod( )", 1) End If @@ -5245,7 +5300,7 @@ Public Class ucrCalculator Private Sub cmdArg_Click(sender As Object, e As EventArgs) Handles cmdArg.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Arg(z = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Arg(z = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Arg( )", 1) End If @@ -5253,15 +5308,27 @@ Public Class ucrCalculator Private Sub cmdConjugate_Click(sender As Object, e As EventArgs) Handles cmdConjugate.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Conj(z = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Conj(z = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("Conj( )", 1) End If End Sub + Private Sub cmdComplexi_Click(sender As Object, e As EventArgs) Handles cmdComplexi.Click + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("i", -1) + End Sub + + Private Sub cmdAsComplex_Click(sender As Object, e As EventArgs) Handles cmdAsComplex.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("as.complex(x = )", 2) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("as.complex( )", 1) + End If + End Sub + Private Sub cmdComplexLog_Click(sender As Object, e As EventArgs) Handles cmdComplexLog.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("log(x= , base=exp(1))", 14) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("log(x= , base=exp(1))", 15) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("log()", 1) End If @@ -5269,7 +5336,7 @@ Public Class ucrCalculator Private Sub cmdComplexSqrt_Click_1(sender As Object, e As EventArgs) Handles cmdComplexSqrt.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("sqrt(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("sqrt(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("sqrt()", 1) End If @@ -5277,7 +5344,7 @@ Public Class ucrCalculator Private Sub cmdComplexRound_Click(sender As Object, e As EventArgs) Handles cmdComplexRound.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("round(x= , digits=0)", 11) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("round(x= , digits=0)", 12) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("round()", 1) End If @@ -5285,7 +5352,7 @@ Public Class ucrCalculator Private Sub cmdComplexExp_Click_1(sender As Object, e As EventArgs) Handles cmdComplexExp.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("exp(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("exp(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("exp()", 1) End If @@ -5293,7 +5360,7 @@ Public Class ucrCalculator Private Sub cmdComplexSignif_Click(sender As Object, e As EventArgs) Handles cmdComplexSignif.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("signif(x= , digits=6)", 11) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("signif(x= , digits=6)", 12) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("signif()", 1) End If @@ -5301,7 +5368,7 @@ Public Class ucrCalculator Private Sub cmdComplexCos_Click(sender As Object, e As EventArgs) Handles cmdComplexCos.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("cos(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("cos(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("cos()", 1) End If @@ -5309,7 +5376,7 @@ Public Class ucrCalculator Private Sub cmdComplexSin_Click(sender As Object, e As EventArgs) Handles cmdComplexSin.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("sin(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("sin(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("sin()", 1) End If @@ -5317,7 +5384,7 @@ Public Class ucrCalculator Private Sub cmdComplexTan_Click(sender As Object, e As EventArgs) Handles cmdComplexTan.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("tan(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("tan(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("tan()", 1) End If @@ -5325,7 +5392,7 @@ Public Class ucrCalculator Private Sub cmdComplexCosH_Click(sender As Object, e As EventArgs) Handles cmdComplexCosH.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("cosh(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("cosh(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("cosh()", 1) End If @@ -5333,7 +5400,7 @@ Public Class ucrCalculator Private Sub cmdComplexSinH_Click(sender As Object, e As EventArgs) Handles cmdComplexSinH.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("sinh(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("sinh(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("sinh()", 1) End If @@ -5341,7 +5408,7 @@ Public Class ucrCalculator Private Sub cmdComplexTanH_Click(sender As Object, e As EventArgs) Handles cmdComplexTanH.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("tanh(x= )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("tanh(x= )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("tanh()", 1) End If @@ -5614,16 +5681,4 @@ Public Class ucrCalculator ucrReceiverForCalculation.AddToReceiverAtCursorPosition(" [which.max( )]", 15) End If End Sub - - Private Sub cmdComplexi_Click(sender As Object, e As EventArgs) Handles cmdComplexi.Click - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("i", -1) - End Sub - - Private Sub cmdAsComplex_Click_1(sender As Object, e As EventArgs) Handles cmdAsComplex.Click - If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("as.complex(x = )", 1) - Else - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("as.complex( )", 1) - End If - End Sub End Class From 59fa950aa170ee7ff534077409b20f7394ca9b3a Mon Sep 17 00:00:00 2001 From: JUMA Date: Tue, 2 Apr 2024 17:32:12 +0300 Subject: [PATCH 73/88] change --- instat/ucrCalculator.Designer.vb | 497 +++++++++++++++++-------------- instat/ucrCalculator.vb | 54 ++-- 2 files changed, 298 insertions(+), 253 deletions(-) diff --git a/instat/ucrCalculator.Designer.vb b/instat/ucrCalculator.Designer.vb index 841b380b668..3ed0cf46384 100644 --- a/instat/ucrCalculator.Designer.vb +++ b/instat/ucrCalculator.Designer.vb @@ -294,22 +294,6 @@ Partial Class ucrCalculator Me.E1071ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.RobustbaseToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.RasterToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.grpFrequencies = New System.Windows.Forms.GroupBox() - Me.cmdFreqQuantile = New System.Windows.Forms.Button() - Me.cmdFreqPropn = New System.Windows.Forms.Button() - Me.cmdFreqDistinct = New System.Windows.Forms.Button() - Me.cmdFreqIQR = New System.Windows.Forms.Button() - Me.cmdFreqMedian = New System.Windows.Forms.Button() - Me.cmdFreqSd = New System.Windows.Forms.Button() - Me.cmdFreqVar = New System.Windows.Forms.Button() - Me.cmdFreqMean = New System.Windows.Forms.Button() - Me.cmdFreqMad = New System.Windows.Forms.Button() - Me.cmdFreqMiss = New System.Windows.Forms.Button() - Me.cmdFreqMode1 = New System.Windows.Forms.Button() - Me.cmdFreqMax = New System.Windows.Forms.Button() - Me.cmdFreqMin = New System.Windows.Forms.Button() - Me.cmdFreqSum = New System.Windows.Forms.Button() - Me.cmdFreqLength = New System.Windows.Forms.Button() Me.cmdKurtosis = New System.Windows.Forms.Button() Me.cmdMode1 = New System.Windows.Forms.Button() Me.cmdMode = New System.Windows.Forms.Button() @@ -338,6 +322,22 @@ Partial Class ucrCalculator Me.cmdLength = New System.Windows.Forms.Button() Me.cmdSum = New System.Windows.Forms.Button() Me.cmdVar = New System.Windows.Forms.Button() + Me.grpFrequencies = New System.Windows.Forms.GroupBox() + Me.cmdFreqQuantile = New System.Windows.Forms.Button() + Me.cmdFreqPropn = New System.Windows.Forms.Button() + Me.cmdFreqDistinct = New System.Windows.Forms.Button() + Me.cmdFreqIQR = New System.Windows.Forms.Button() + Me.cmdFreqMedian = New System.Windows.Forms.Button() + Me.cmdFreqSd = New System.Windows.Forms.Button() + Me.cmdFreqVar = New System.Windows.Forms.Button() + Me.cmdFreqMean = New System.Windows.Forms.Button() + Me.cmdFreqMad = New System.Windows.Forms.Button() + Me.cmdFreqMiss = New System.Windows.Forms.Button() + Me.cmdFreqMode1 = New System.Windows.Forms.Button() + Me.cmdFreqMax = New System.Windows.Forms.Button() + Me.cmdFreqMin = New System.Windows.Forms.Button() + Me.cmdFreqSum = New System.Windows.Forms.Button() + Me.cmdFreqLength = New System.Windows.Forms.Button() Me.grpProbabilty = New System.Windows.Forms.GroupBox() Me.cmdPascal = New System.Windows.Forms.Button() Me.cmdProbRHelp = New instat.ucrSplitButton() @@ -622,6 +622,9 @@ Partial Class ucrCalculator Me.ucrInputCalOptions = New instat.ucrInputComboBox() Me.ucrSelectorForCalculations = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverForCalculation = New instat.ucrReceiverExpression() + Me.cmdComplexAsin = New System.Windows.Forms.Button() + Me.cmdComplexAtan = New System.Windows.Forms.Button() + Me.cmdComplexAcos = New System.Windows.Forms.Button() Me.grpBasic.SuspendLayout Me.grpDates.SuspendLayout Me.ContextMenuStripDate.SuspendLayout @@ -3522,210 +3525,6 @@ Partial Class ucrCalculator Me.RasterToolStripMenuItem.Size = New System.Drawing.Size(155, 24) Me.RasterToolStripMenuItem.Text = "Raster" ' - 'grpFrequencies - ' - Me.grpFrequencies.Controls.Add(Me.cmdFreqQuantile) - Me.grpFrequencies.Controls.Add(Me.cmdFreqPropn) - Me.grpFrequencies.Controls.Add(Me.cmdFreqDistinct) - Me.grpFrequencies.Controls.Add(Me.cmdFreqIQR) - Me.grpFrequencies.Controls.Add(Me.cmdFreqMedian) - Me.grpFrequencies.Controls.Add(Me.cmdFreqSd) - Me.grpFrequencies.Controls.Add(Me.cmdFreqVar) - Me.grpFrequencies.Controls.Add(Me.cmdFreqMean) - Me.grpFrequencies.Controls.Add(Me.cmdFreqMad) - Me.grpFrequencies.Controls.Add(Me.cmdFreqMiss) - Me.grpFrequencies.Controls.Add(Me.cmdFreqMode1) - Me.grpFrequencies.Controls.Add(Me.cmdFreqMax) - Me.grpFrequencies.Controls.Add(Me.cmdFreqMin) - Me.grpFrequencies.Controls.Add(Me.cmdFreqSum) - Me.grpFrequencies.Controls.Add(Me.cmdFreqLength) - Me.grpFrequencies.Location = New System.Drawing.Point(2, 283) - Me.grpFrequencies.Name = "grpFrequencies" - Me.grpFrequencies.Size = New System.Drawing.Size(353, 133) - Me.grpFrequencies.TabIndex = 184 - Me.grpFrequencies.TabStop = False - Me.grpFrequencies.Text = "Frequencies" - ' - 'cmdFreqQuantile - ' - Me.cmdFreqQuantile.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqQuantile.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqQuantile.Location = New System.Drawing.Point(282, 90) - Me.cmdFreqQuantile.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqQuantile.Name = "cmdFreqQuantile" - Me.cmdFreqQuantile.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqQuantile.TabIndex = 186 - Me.cmdFreqQuantile.Text = "quantile" - Me.cmdFreqQuantile.UseVisualStyleBackColor = True - ' - 'cmdFreqPropn - ' - Me.cmdFreqPropn.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqPropn.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqPropn.Location = New System.Drawing.Point(212, 90) - Me.cmdFreqPropn.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqPropn.Name = "cmdFreqPropn" - Me.cmdFreqPropn.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqPropn.TabIndex = 185 - Me.cmdFreqPropn.Text = "propn" - Me.cmdFreqPropn.UseVisualStyleBackColor = True - ' - 'cmdFreqDistinct - ' - Me.cmdFreqDistinct.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqDistinct.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqDistinct.Location = New System.Drawing.Point(142, 90) - Me.cmdFreqDistinct.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqDistinct.Name = "cmdFreqDistinct" - Me.cmdFreqDistinct.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqDistinct.TabIndex = 184 - Me.cmdFreqDistinct.Text = "distinct" - Me.cmdFreqDistinct.UseVisualStyleBackColor = True - ' - 'cmdFreqIQR - ' - Me.cmdFreqIQR.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqIQR.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqIQR.Location = New System.Drawing.Point(70, 90) - Me.cmdFreqIQR.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqIQR.Name = "cmdFreqIQR" - Me.cmdFreqIQR.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqIQR.TabIndex = 183 - Me.cmdFreqIQR.Text = "IQR" - Me.cmdFreqIQR.UseVisualStyleBackColor = True - ' - 'cmdFreqMedian - ' - Me.cmdFreqMedian.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqMedian.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqMedian.Location = New System.Drawing.Point(142, 53) - Me.cmdFreqMedian.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqMedian.Name = "cmdFreqMedian" - Me.cmdFreqMedian.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqMedian.TabIndex = 182 - Me.cmdFreqMedian.Text = "median" - Me.cmdFreqMedian.UseVisualStyleBackColor = True - ' - 'cmdFreqSd - ' - Me.cmdFreqSd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqSd.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqSd.Location = New System.Drawing.Point(282, 53) - Me.cmdFreqSd.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqSd.Name = "cmdFreqSd" - Me.cmdFreqSd.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqSd.TabIndex = 181 - Me.cmdFreqSd.Text = "sd" - Me.cmdFreqSd.UseVisualStyleBackColor = True - ' - 'cmdFreqVar - ' - Me.cmdFreqVar.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqVar.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqVar.Location = New System.Drawing.Point(212, 53) - Me.cmdFreqVar.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqVar.Name = "cmdFreqVar" - Me.cmdFreqVar.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqVar.TabIndex = 180 - Me.cmdFreqVar.Text = "var" - Me.cmdFreqVar.UseVisualStyleBackColor = True - ' - 'cmdFreqMean - ' - Me.cmdFreqMean.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqMean.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqMean.Location = New System.Drawing.Point(70, 53) - Me.cmdFreqMean.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqMean.Name = "cmdFreqMean" - Me.cmdFreqMean.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqMean.TabIndex = 179 - Me.cmdFreqMean.Text = "mean" - Me.cmdFreqMean.UseVisualStyleBackColor = True - ' - 'cmdFreqMad - ' - Me.cmdFreqMad.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqMad.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqMad.Location = New System.Drawing.Point(0, 90) - Me.cmdFreqMad.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqMad.Name = "cmdFreqMad" - Me.cmdFreqMad.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqMad.TabIndex = 178 - Me.cmdFreqMad.Text = "mad" - Me.cmdFreqMad.UseVisualStyleBackColor = True - ' - 'cmdFreqMiss - ' - Me.cmdFreqMiss.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqMiss.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqMiss.Location = New System.Drawing.Point(0, 53) - Me.cmdFreqMiss.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqMiss.Name = "cmdFreqMiss" - Me.cmdFreqMiss.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqMiss.TabIndex = 177 - Me.cmdFreqMiss.Text = "miss" - Me.cmdFreqMiss.UseVisualStyleBackColor = True - ' - 'cmdFreqMode1 - ' - Me.cmdFreqMode1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqMode1.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqMode1.Location = New System.Drawing.Point(282, 18) - Me.cmdFreqMode1.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqMode1.Name = "cmdFreqMode1" - Me.cmdFreqMode1.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqMode1.TabIndex = 176 - Me.cmdFreqMode1.Text = "mode1" - Me.cmdFreqMode1.UseVisualStyleBackColor = True - ' - 'cmdFreqMax - ' - Me.cmdFreqMax.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqMax.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqMax.Location = New System.Drawing.Point(212, 18) - Me.cmdFreqMax.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqMax.Name = "cmdFreqMax" - Me.cmdFreqMax.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqMax.TabIndex = 175 - Me.cmdFreqMax.Text = "max" - Me.cmdFreqMax.UseVisualStyleBackColor = True - ' - 'cmdFreqMin - ' - Me.cmdFreqMin.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqMin.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqMin.Location = New System.Drawing.Point(142, 18) - Me.cmdFreqMin.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqMin.Name = "cmdFreqMin" - Me.cmdFreqMin.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqMin.TabIndex = 174 - Me.cmdFreqMin.Text = "min" - Me.cmdFreqMin.UseVisualStyleBackColor = True - ' - 'cmdFreqSum - ' - Me.cmdFreqSum.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqSum.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqSum.Location = New System.Drawing.Point(70, 18) - Me.cmdFreqSum.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqSum.Name = "cmdFreqSum" - Me.cmdFreqSum.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqSum.TabIndex = 173 - Me.cmdFreqSum.Text = "sum" - Me.cmdFreqSum.UseVisualStyleBackColor = True - ' - 'cmdFreqLength - ' - Me.cmdFreqLength.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdFreqLength.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFreqLength.Location = New System.Drawing.Point(0, 18) - Me.cmdFreqLength.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdFreqLength.Name = "cmdFreqLength" - Me.cmdFreqLength.Size = New System.Drawing.Size(72, 38) - Me.cmdFreqLength.TabIndex = 172 - Me.cmdFreqLength.Text = "length" - Me.cmdFreqLength.UseVisualStyleBackColor = True - ' 'cmdKurtosis ' Me.cmdKurtosis.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) @@ -4047,6 +3846,210 @@ Partial Class ucrCalculator Me.cmdVar.Text = "var" Me.cmdVar.UseVisualStyleBackColor = True ' + 'grpFrequencies + ' + Me.grpFrequencies.Controls.Add(Me.cmdFreqQuantile) + Me.grpFrequencies.Controls.Add(Me.cmdFreqPropn) + Me.grpFrequencies.Controls.Add(Me.cmdFreqDistinct) + Me.grpFrequencies.Controls.Add(Me.cmdFreqIQR) + Me.grpFrequencies.Controls.Add(Me.cmdFreqMedian) + Me.grpFrequencies.Controls.Add(Me.cmdFreqSd) + Me.grpFrequencies.Controls.Add(Me.cmdFreqVar) + Me.grpFrequencies.Controls.Add(Me.cmdFreqMean) + Me.grpFrequencies.Controls.Add(Me.cmdFreqMad) + Me.grpFrequencies.Controls.Add(Me.cmdFreqMiss) + Me.grpFrequencies.Controls.Add(Me.cmdFreqMode1) + Me.grpFrequencies.Controls.Add(Me.cmdFreqMax) + Me.grpFrequencies.Controls.Add(Me.cmdFreqMin) + Me.grpFrequencies.Controls.Add(Me.cmdFreqSum) + Me.grpFrequencies.Controls.Add(Me.cmdFreqLength) + Me.grpFrequencies.Location = New System.Drawing.Point(2, 283) + Me.grpFrequencies.Name = "grpFrequencies" + Me.grpFrequencies.Size = New System.Drawing.Size(353, 133) + Me.grpFrequencies.TabIndex = 184 + Me.grpFrequencies.TabStop = False + Me.grpFrequencies.Text = "Frequencies" + ' + 'cmdFreqQuantile + ' + Me.cmdFreqQuantile.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqQuantile.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqQuantile.Location = New System.Drawing.Point(282, 90) + Me.cmdFreqQuantile.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqQuantile.Name = "cmdFreqQuantile" + Me.cmdFreqQuantile.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqQuantile.TabIndex = 186 + Me.cmdFreqQuantile.Text = "quantile" + Me.cmdFreqQuantile.UseVisualStyleBackColor = True + ' + 'cmdFreqPropn + ' + Me.cmdFreqPropn.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqPropn.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqPropn.Location = New System.Drawing.Point(212, 90) + Me.cmdFreqPropn.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqPropn.Name = "cmdFreqPropn" + Me.cmdFreqPropn.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqPropn.TabIndex = 185 + Me.cmdFreqPropn.Text = "propn" + Me.cmdFreqPropn.UseVisualStyleBackColor = True + ' + 'cmdFreqDistinct + ' + Me.cmdFreqDistinct.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqDistinct.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqDistinct.Location = New System.Drawing.Point(142, 90) + Me.cmdFreqDistinct.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqDistinct.Name = "cmdFreqDistinct" + Me.cmdFreqDistinct.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqDistinct.TabIndex = 184 + Me.cmdFreqDistinct.Text = "distinct" + Me.cmdFreqDistinct.UseVisualStyleBackColor = True + ' + 'cmdFreqIQR + ' + Me.cmdFreqIQR.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqIQR.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqIQR.Location = New System.Drawing.Point(70, 90) + Me.cmdFreqIQR.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqIQR.Name = "cmdFreqIQR" + Me.cmdFreqIQR.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqIQR.TabIndex = 183 + Me.cmdFreqIQR.Text = "IQR" + Me.cmdFreqIQR.UseVisualStyleBackColor = True + ' + 'cmdFreqMedian + ' + Me.cmdFreqMedian.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqMedian.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqMedian.Location = New System.Drawing.Point(142, 53) + Me.cmdFreqMedian.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqMedian.Name = "cmdFreqMedian" + Me.cmdFreqMedian.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqMedian.TabIndex = 182 + Me.cmdFreqMedian.Text = "median" + Me.cmdFreqMedian.UseVisualStyleBackColor = True + ' + 'cmdFreqSd + ' + Me.cmdFreqSd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqSd.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqSd.Location = New System.Drawing.Point(282, 53) + Me.cmdFreqSd.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqSd.Name = "cmdFreqSd" + Me.cmdFreqSd.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqSd.TabIndex = 181 + Me.cmdFreqSd.Text = "sd" + Me.cmdFreqSd.UseVisualStyleBackColor = True + ' + 'cmdFreqVar + ' + Me.cmdFreqVar.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqVar.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqVar.Location = New System.Drawing.Point(212, 53) + Me.cmdFreqVar.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqVar.Name = "cmdFreqVar" + Me.cmdFreqVar.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqVar.TabIndex = 180 + Me.cmdFreqVar.Text = "var" + Me.cmdFreqVar.UseVisualStyleBackColor = True + ' + 'cmdFreqMean + ' + Me.cmdFreqMean.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqMean.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqMean.Location = New System.Drawing.Point(70, 53) + Me.cmdFreqMean.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqMean.Name = "cmdFreqMean" + Me.cmdFreqMean.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqMean.TabIndex = 179 + Me.cmdFreqMean.Text = "mean" + Me.cmdFreqMean.UseVisualStyleBackColor = True + ' + 'cmdFreqMad + ' + Me.cmdFreqMad.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqMad.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqMad.Location = New System.Drawing.Point(0, 90) + Me.cmdFreqMad.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqMad.Name = "cmdFreqMad" + Me.cmdFreqMad.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqMad.TabIndex = 178 + Me.cmdFreqMad.Text = "mad" + Me.cmdFreqMad.UseVisualStyleBackColor = True + ' + 'cmdFreqMiss + ' + Me.cmdFreqMiss.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqMiss.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqMiss.Location = New System.Drawing.Point(0, 53) + Me.cmdFreqMiss.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqMiss.Name = "cmdFreqMiss" + Me.cmdFreqMiss.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqMiss.TabIndex = 177 + Me.cmdFreqMiss.Text = "miss" + Me.cmdFreqMiss.UseVisualStyleBackColor = True + ' + 'cmdFreqMode1 + ' + Me.cmdFreqMode1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqMode1.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqMode1.Location = New System.Drawing.Point(282, 18) + Me.cmdFreqMode1.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqMode1.Name = "cmdFreqMode1" + Me.cmdFreqMode1.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqMode1.TabIndex = 176 + Me.cmdFreqMode1.Text = "mode1" + Me.cmdFreqMode1.UseVisualStyleBackColor = True + ' + 'cmdFreqMax + ' + Me.cmdFreqMax.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqMax.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqMax.Location = New System.Drawing.Point(212, 18) + Me.cmdFreqMax.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqMax.Name = "cmdFreqMax" + Me.cmdFreqMax.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqMax.TabIndex = 175 + Me.cmdFreqMax.Text = "max" + Me.cmdFreqMax.UseVisualStyleBackColor = True + ' + 'cmdFreqMin + ' + Me.cmdFreqMin.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqMin.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqMin.Location = New System.Drawing.Point(142, 18) + Me.cmdFreqMin.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqMin.Name = "cmdFreqMin" + Me.cmdFreqMin.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqMin.TabIndex = 174 + Me.cmdFreqMin.Text = "min" + Me.cmdFreqMin.UseVisualStyleBackColor = True + ' + 'cmdFreqSum + ' + Me.cmdFreqSum.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqSum.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqSum.Location = New System.Drawing.Point(70, 18) + Me.cmdFreqSum.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqSum.Name = "cmdFreqSum" + Me.cmdFreqSum.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqSum.TabIndex = 173 + Me.cmdFreqSum.Text = "sum" + Me.cmdFreqSum.UseVisualStyleBackColor = True + ' + 'cmdFreqLength + ' + Me.cmdFreqLength.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdFreqLength.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFreqLength.Location = New System.Drawing.Point(0, 18) + Me.cmdFreqLength.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdFreqLength.Name = "cmdFreqLength" + Me.cmdFreqLength.Size = New System.Drawing.Size(72, 38) + Me.cmdFreqLength.TabIndex = 172 + Me.cmdFreqLength.Text = "length" + Me.cmdFreqLength.UseVisualStyleBackColor = True + ' 'grpProbabilty ' Me.grpProbabilty.Controls.Add(Me.cmdPascal) @@ -6282,6 +6285,9 @@ Partial Class ucrCalculator ' 'grpComplex ' + Me.grpComplex.Controls.Add(Me.cmdComplexAsin) + Me.grpComplex.Controls.Add(Me.cmdComplexAtan) + Me.grpComplex.Controls.Add(Me.cmdComplexAcos) Me.grpComplex.Controls.Add(Me.cmdAsComplex) Me.grpComplex.Controls.Add(Me.cmdComplexi) Me.grpComplex.Controls.Add(Me.cmdComplexRHelp) @@ -6328,7 +6334,7 @@ Partial Class ucrCalculator ' Me.cmdComplexi.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexi.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexi.Location = New System.Drawing.Point(30, 240) + Me.cmdComplexi.Location = New System.Drawing.Point(30, 239) Me.cmdComplexi.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexi.Name = "cmdComplexi" Me.cmdComplexi.Size = New System.Drawing.Size(82, 38) @@ -6376,7 +6382,7 @@ Partial Class ucrCalculator ' Me.cmdComplexPi.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexPi.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexPi.Location = New System.Drawing.Point(279, 164) + Me.cmdComplexPi.Location = New System.Drawing.Point(279, 165) Me.cmdComplexPi.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexPi.Name = "cmdComplexPi" Me.cmdComplexPi.Size = New System.Drawing.Size(78, 38) @@ -6412,7 +6418,7 @@ Partial Class ucrCalculator ' Me.cmdComplexSignif.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexSignif.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexSignif.Location = New System.Drawing.Point(198, 203) + Me.cmdComplexSignif.Location = New System.Drawing.Point(198, 202) Me.cmdComplexSignif.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexSignif.Name = "cmdComplexSignif" Me.cmdComplexSignif.Size = New System.Drawing.Size(82, 38) @@ -6484,7 +6490,7 @@ Partial Class ucrCalculator ' Me.cmdComplexRound.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexRound.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexRound.Location = New System.Drawing.Point(111, 203) + Me.cmdComplexRound.Location = New System.Drawing.Point(111, 202) Me.cmdComplexRound.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexRound.Name = "cmdComplexRound" Me.cmdComplexRound.Size = New System.Drawing.Size(88, 38) @@ -6496,7 +6502,7 @@ Partial Class ucrCalculator ' Me.cmdComplexLog.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexLog.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexLog.Location = New System.Drawing.Point(279, 203) + Me.cmdComplexLog.Location = New System.Drawing.Point(279, 202) Me.cmdComplexLog.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexLog.Name = "cmdComplexLog" Me.cmdComplexLog.Size = New System.Drawing.Size(79, 38) @@ -6508,7 +6514,7 @@ Partial Class ucrCalculator ' Me.cmdComplexSqrt.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexSqrt.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexSqrt.Location = New System.Drawing.Point(30, 203) + Me.cmdComplexSqrt.Location = New System.Drawing.Point(30, 202) Me.cmdComplexSqrt.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexSqrt.Name = "cmdComplexSqrt" Me.cmdComplexSqrt.Size = New System.Drawing.Size(82, 38) @@ -7417,6 +7423,42 @@ Partial Class ucrCalculator Me.ucrReceiverForCalculation.TabIndex = 120 Me.ucrReceiverForCalculation.ucrSelector = Nothing ' + 'cmdComplexAsin + ' + Me.cmdComplexAsin.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdComplexAsin.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdComplexAsin.Location = New System.Drawing.Point(31, 165) + Me.cmdComplexAsin.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdComplexAsin.Name = "cmdComplexAsin" + Me.cmdComplexAsin.Size = New System.Drawing.Size(81, 38) + Me.cmdComplexAsin.TabIndex = 217 + Me.cmdComplexAsin.Text = "asin" + Me.cmdComplexAsin.UseVisualStyleBackColor = True + ' + 'cmdComplexAtan + ' + Me.cmdComplexAtan.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdComplexAtan.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdComplexAtan.Location = New System.Drawing.Point(198, 165) + Me.cmdComplexAtan.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdComplexAtan.Name = "cmdComplexAtan" + Me.cmdComplexAtan.Size = New System.Drawing.Size(82, 38) + Me.cmdComplexAtan.TabIndex = 216 + Me.cmdComplexAtan.Text = "atan" + Me.cmdComplexAtan.UseVisualStyleBackColor = True + ' + 'cmdComplexAcos + ' + Me.cmdComplexAcos.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdComplexAcos.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdComplexAcos.Location = New System.Drawing.Point(111, 165) + Me.cmdComplexAcos.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdComplexAcos.Name = "cmdComplexAcos" + Me.cmdComplexAcos.Size = New System.Drawing.Size(88, 38) + Me.cmdComplexAcos.TabIndex = 215 + Me.cmdComplexAcos.Text = "acos" + Me.cmdComplexAcos.UseVisualStyleBackColor = True + ' 'ucrCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(120.0!, 120.0!) @@ -8092,4 +8134,7 @@ Partial Class ucrCalculator Friend WithEvents cmdMdy As Button Friend WithEvents cmdYmd As Button Friend WithEvents cmdLeap As Button + Friend WithEvents cmdComplexAsin As Button + Friend WithEvents cmdComplexAtan As Button + Friend WithEvents cmdComplexAcos As Button End Class diff --git a/instat/ucrCalculator.vb b/instat/ucrCalculator.vb index 6c65da296b1..2ff712429b2 100644 --- a/instat/ucrCalculator.vb +++ b/instat/ucrCalculator.vb @@ -296,9 +296,9 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdComplexSin, "sine of the angle in radians For example sin(1-1i) gives (1.2985-0.635i)") ttCalculator.SetToolTip(cmdComplexCos, "cosine of the angle in radians. For example cos(1-1i) gives (0.8337+0.9889i)") ttCalculator.SetToolTip(cmdComplexTan, "tangent of the angle in radians. For example tan(1-i) gives (0.272-1.084i)") - 'ttCalculator.SetToolTip(cmdComplexAsin, "arcsine, or inverse of the sine. It is the angle in radians corresponding to a given sine. For example asin(1.2985-0.635i) gives (1-1i)") - ' ttCalculator.SetToolTip(cmdComplexAcos, "arccos, or inverse of the cosine. It is the angle corresponding to a given cos. For example acos(0.8337+0.9889i) gives (1-1i)") - ' ttCalculator.SetToolTip(cmdComplexAtan, "arctan or inverse of the tangent. It is the angle corresponding to a given tan. For example atan(0.272-1.084i) gives (1-1i)") + ttCalculator.SetToolTip(cmdComplexAsin, "arcsine, or inverse of the sine. It is the angle in radians corresponding to a given sine. For example asin(1.2985-0.635i) gives (1-1i)") + ttCalculator.SetToolTip(cmdComplexAcos, "arccos, or inverse of the cosine. It is the angle corresponding to a given cos. For example acos(0.8337+0.9889i) gives (1-1i)") + ttCalculator.SetToolTip(cmdComplexAtan, "arctan or inverse of the tangent. It is the angle corresponding to a given tan. For example atan(0.272-1.084i) gives (1-1i)") ttCalculator.SetToolTip(cmdComplexSinH, " hyperbolic sin of a number in radians (asinh also exists)") ttCalculator.SetToolTip(cmdComplexCosH, "hyperbolic cosine of a number in radians (acosh also exists)") ttCalculator.SetToolTip(cmdComplexTanH, "hyperbolic tangent of a number in radians (atanh also exists)") @@ -441,7 +441,7 @@ Public Class ucrCalculator ttCalculator.SetToolTip(cmdInfreq, "Order the factor levels by their frequency ") ttCalculator.SetToolTip(cmdInseq, "Order a factor with numeric levels") ttCalculator.SetToolTip(cmdLump, "Change all levels appearing less than min times into Other. For example fct_lump_min(Variety,10)") - ttCalculator.SetToolTip(cmdmatch, "Make a logical variable with TRUE when levels are in the factor. For example fct_match(variety,c(""NEW"",""OLD""))") + ttCalculator.SetToolTip(cmdFmatch, "Make a logical variable with TRUE when levels are in the factor. For example fct_match(variety,c(""NEW"",""OLD""))") ttCalculator.SetToolTip(cmdOther, " Replace levels with Other. For example fct_other(variety, keep=""NEW"")") ttCalculator.SetToolTip(cmdRecode, "Change factor levels. For example fct_recode(variety,improved=""NEW"",improved=""OLD"")") ttCalculator.SetToolTip(cmdRelevel, " Reorder factor levels. For example fct_relevel(fertgrp,""0cwt"", "".5-2cwt"")") @@ -5250,29 +5250,29 @@ Public Class ucrCalculator End If End Sub - 'Private Sub cmdComplexAsin_Click(sender As Object, e As EventArgs) Handles cmdComplexAsin.Click - ' If chkShowParameters.Checked Then - ' ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin(x = )", 1) - ' Else - ' ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin()", 1) - ' End If - 'End Sub - - 'Private Sub cmdComplexAcos_Click(sender As Object, e As EventArgs) Handles cmdComplexAcos.Click - ' If chkShowParameters.Checked Then - ' ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos(x = )", 1) - ' Else - ' ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos()", 1) - ' End If - 'End Sub - - 'Private Sub cmdComplexAtan_Click(sender As Object, e As EventArgs) Handles cmdComplexAtan.Click - ' If chkShowParameters.Checked Then - ' ucrReceiverForCalculation.AddToReceiverAtCursorPosition("atan(x = )", 2) - ' Else - ' ucrReceiverForCalculation.AddToReceiverAtCursorPosition("atan()", 1) - ' End If - 'End Sub + Private Sub cmdComplexAsin_Click(sender As Object, e As EventArgs) Handles cmdComplexAsin.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin(x = )", 1) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin()", 1) + End If + End Sub + + Private Sub cmdComplexAcos_Click(sender As Object, e As EventArgs) Handles cmdComplexAcos.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos(x = )", 1) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos()", 1) + End If + End Sub + + Private Sub cmdComplexAtan_Click(sender As Object, e As EventArgs) Handles cmdComplexAtan.Click + If chkShowParameters.Checked Then + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("atan(x = )", 2) + Else + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("atan()", 1) + End If + End Sub Private Sub cmdReal_Click(sender As Object, e As EventArgs) Handles cmdReal.Click If chkShowParameters.Checked Then From 0a20aa1c8ce3d93577a8c080b1fabc8955060efe Mon Sep 17 00:00:00 2001 From: JUMA Date: Tue, 2 Apr 2024 17:42:47 +0300 Subject: [PATCH 74/88] changes --- instat/ucrCalculator.Designer.vb | 126 +++++++++++++++---------------- instat/ucrCalculator.vb | 10 +-- 2 files changed, 68 insertions(+), 68 deletions(-) diff --git a/instat/ucrCalculator.Designer.vb b/instat/ucrCalculator.Designer.vb index 3ed0cf46384..cc6c218127b 100644 --- a/instat/ucrCalculator.Designer.vb +++ b/instat/ucrCalculator.Designer.vb @@ -529,6 +529,9 @@ Partial Class ucrCalculator Me.cmdbegin = New System.Windows.Forms.Button() Me.cmdAny1 = New System.Windows.Forms.Button() Me.grpComplex = New System.Windows.Forms.GroupBox() + Me.cmdComplexAsin = New System.Windows.Forms.Button() + Me.cmdComplexAtan = New System.Windows.Forms.Button() + Me.cmdComplexAcos = New System.Windows.Forms.Button() Me.cmdAsComplex = New System.Windows.Forms.Button() Me.cmdComplexi = New System.Windows.Forms.Button() Me.cmdComplexRHelp = New instat.ucrSplitButton() @@ -622,9 +625,6 @@ Partial Class ucrCalculator Me.ucrInputCalOptions = New instat.ucrInputComboBox() Me.ucrSelectorForCalculations = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverForCalculation = New instat.ucrReceiverExpression() - Me.cmdComplexAsin = New System.Windows.Forms.Button() - Me.cmdComplexAtan = New System.Windows.Forms.Button() - Me.cmdComplexAcos = New System.Windows.Forms.Button() Me.grpBasic.SuspendLayout Me.grpDates.SuspendLayout Me.ContextMenuStripDate.SuspendLayout @@ -3431,7 +3431,7 @@ Partial Class ucrCalculator Me.cmdwheremin.Location = New System.Drawing.Point(269, 199) Me.cmdwheremin.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdwheremin.Name = "cmdwheremin" - Me.cmdwheremin.Size = New System.Drawing.Size(90, 38) + Me.cmdwheremin.Size = New System.Drawing.Size(88, 38) Me.cmdwheremin.TabIndex = 193 Me.cmdwheremin.Text = "where.min" Me.cmdwheremin.UseVisualStyleBackColor = True @@ -3595,7 +3595,7 @@ Partial Class ucrCalculator 'cmdCor ' Me.cmdCor.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdCor.Location = New System.Drawing.Point(2, 235) + Me.cmdCor.Location = New System.Drawing.Point(2, 236) Me.cmdCor.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdCor.Name = "cmdCor" Me.cmdCor.Size = New System.Drawing.Size(78, 38) @@ -3606,7 +3606,7 @@ Partial Class ucrCalculator 'cmdCov ' Me.cmdCov.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdCov.Location = New System.Drawing.Point(79, 235) + Me.cmdCov.Location = New System.Drawing.Point(79, 236) Me.cmdCov.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdCov.Name = "cmdCov" Me.cmdCov.Size = New System.Drawing.Size(70, 38) @@ -3724,7 +3724,7 @@ Partial Class ucrCalculator ' Me.cmdQuantile.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdQuantile.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdQuantile.Location = New System.Drawing.Point(148, 235) + Me.cmdQuantile.Location = New System.Drawing.Point(148, 236) Me.cmdQuantile.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdQuantile.Name = "cmdQuantile" Me.cmdQuantile.Size = New System.Drawing.Size(70, 38) @@ -6318,6 +6318,42 @@ Partial Class ucrCalculator Me.grpComplex.TabStop = False Me.grpComplex.Text = "Complex" ' + 'cmdComplexAsin + ' + Me.cmdComplexAsin.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdComplexAsin.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdComplexAsin.Location = New System.Drawing.Point(30, 164) + Me.cmdComplexAsin.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdComplexAsin.Name = "cmdComplexAsin" + Me.cmdComplexAsin.Size = New System.Drawing.Size(82, 38) + Me.cmdComplexAsin.TabIndex = 217 + Me.cmdComplexAsin.Text = "asin" + Me.cmdComplexAsin.UseVisualStyleBackColor = True + ' + 'cmdComplexAtan + ' + Me.cmdComplexAtan.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdComplexAtan.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdComplexAtan.Location = New System.Drawing.Point(198, 164) + Me.cmdComplexAtan.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdComplexAtan.Name = "cmdComplexAtan" + Me.cmdComplexAtan.Size = New System.Drawing.Size(82, 38) + Me.cmdComplexAtan.TabIndex = 216 + Me.cmdComplexAtan.Text = "atan" + Me.cmdComplexAtan.UseVisualStyleBackColor = True + ' + 'cmdComplexAcos + ' + Me.cmdComplexAcos.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.cmdComplexAcos.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdComplexAcos.Location = New System.Drawing.Point(111, 164) + Me.cmdComplexAcos.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.cmdComplexAcos.Name = "cmdComplexAcos" + Me.cmdComplexAcos.Size = New System.Drawing.Size(88, 38) + Me.cmdComplexAcos.TabIndex = 215 + Me.cmdComplexAcos.Text = "acos" + Me.cmdComplexAcos.UseVisualStyleBackColor = True + ' 'cmdAsComplex ' Me.cmdAsComplex.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) @@ -6334,7 +6370,7 @@ Partial Class ucrCalculator ' Me.cmdComplexi.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexi.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexi.Location = New System.Drawing.Point(30, 239) + Me.cmdComplexi.Location = New System.Drawing.Point(30, 237) Me.cmdComplexi.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexi.Name = "cmdComplexi" Me.cmdComplexi.Size = New System.Drawing.Size(82, 38) @@ -6382,7 +6418,7 @@ Partial Class ucrCalculator ' Me.cmdComplexPi.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexPi.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexPi.Location = New System.Drawing.Point(279, 165) + Me.cmdComplexPi.Location = New System.Drawing.Point(279, 164) Me.cmdComplexPi.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexPi.Name = "cmdComplexPi" Me.cmdComplexPi.Size = New System.Drawing.Size(78, 38) @@ -6418,7 +6454,7 @@ Partial Class ucrCalculator ' Me.cmdComplexSignif.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexSignif.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexSignif.Location = New System.Drawing.Point(198, 202) + Me.cmdComplexSignif.Location = New System.Drawing.Point(198, 200) Me.cmdComplexSignif.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexSignif.Name = "cmdComplexSignif" Me.cmdComplexSignif.Size = New System.Drawing.Size(82, 38) @@ -6490,7 +6526,7 @@ Partial Class ucrCalculator ' Me.cmdComplexRound.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexRound.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexRound.Location = New System.Drawing.Point(111, 202) + Me.cmdComplexRound.Location = New System.Drawing.Point(111, 200) Me.cmdComplexRound.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexRound.Name = "cmdComplexRound" Me.cmdComplexRound.Size = New System.Drawing.Size(88, 38) @@ -6502,7 +6538,7 @@ Partial Class ucrCalculator ' Me.cmdComplexLog.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexLog.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexLog.Location = New System.Drawing.Point(279, 202) + Me.cmdComplexLog.Location = New System.Drawing.Point(279, 200) Me.cmdComplexLog.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexLog.Name = "cmdComplexLog" Me.cmdComplexLog.Size = New System.Drawing.Size(79, 38) @@ -6514,7 +6550,7 @@ Partial Class ucrCalculator ' Me.cmdComplexSqrt.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexSqrt.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexSqrt.Location = New System.Drawing.Point(30, 202) + Me.cmdComplexSqrt.Location = New System.Drawing.Point(30, 200) Me.cmdComplexSqrt.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexSqrt.Name = "cmdComplexSqrt" Me.cmdComplexSqrt.Size = New System.Drawing.Size(82, 38) @@ -7423,42 +7459,6 @@ Partial Class ucrCalculator Me.ucrReceiverForCalculation.TabIndex = 120 Me.ucrReceiverForCalculation.ucrSelector = Nothing ' - 'cmdComplexAsin - ' - Me.cmdComplexAsin.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdComplexAsin.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexAsin.Location = New System.Drawing.Point(31, 165) - Me.cmdComplexAsin.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdComplexAsin.Name = "cmdComplexAsin" - Me.cmdComplexAsin.Size = New System.Drawing.Size(81, 38) - Me.cmdComplexAsin.TabIndex = 217 - Me.cmdComplexAsin.Text = "asin" - Me.cmdComplexAsin.UseVisualStyleBackColor = True - ' - 'cmdComplexAtan - ' - Me.cmdComplexAtan.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdComplexAtan.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexAtan.Location = New System.Drawing.Point(198, 165) - Me.cmdComplexAtan.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdComplexAtan.Name = "cmdComplexAtan" - Me.cmdComplexAtan.Size = New System.Drawing.Size(82, 38) - Me.cmdComplexAtan.TabIndex = 216 - Me.cmdComplexAtan.Text = "atan" - Me.cmdComplexAtan.UseVisualStyleBackColor = True - ' - 'cmdComplexAcos - ' - Me.cmdComplexAcos.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) - Me.cmdComplexAcos.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexAcos.Location = New System.Drawing.Point(111, 165) - Me.cmdComplexAcos.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.cmdComplexAcos.Name = "cmdComplexAcos" - Me.cmdComplexAcos.Size = New System.Drawing.Size(88, 38) - Me.cmdComplexAcos.TabIndex = 215 - Me.cmdComplexAcos.Text = "acos" - Me.cmdComplexAcos.UseVisualStyleBackColor = True - ' 'ucrCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(120.0!, 120.0!) @@ -7475,8 +7475,6 @@ Partial Class ucrCalculator Me.Controls.Add(Me.ucrSelectorForCalculations) Me.Controls.Add(Me.ucrReceiverForCalculation) Me.Controls.Add(Me.lblExpression) - Me.Controls.Add(Me.grpComplex) - Me.Controls.Add(Me.grpSummary) Me.Controls.Add(Me.grpTransform) Me.Controls.Add(Me.grpLogical) Me.Controls.Add(Me.grpModifier) @@ -7491,48 +7489,50 @@ Partial Class ucrCalculator Me.Controls.Add(Me.grpInteger) Me.Controls.Add(Me.grpTestString) Me.Controls.Add(Me.grpSymbols) + Me.Controls.Add(Me.grpComplex) + Me.Controls.Add(Me.grpSummary) Me.Name = "ucrCalculator" Me.Size = New System.Drawing.Size(1123, 572) Me.grpBasic.ResumeLayout(False) Me.grpDates.ResumeLayout(False) - Me.grpDates.PerformLayout() + Me.grpDates.PerformLayout Me.ContextMenuStripDate.ResumeLayout(False) Me.ContextMenuStripComplex.ResumeLayout(False) Me.grpInteger.ResumeLayout(False) - Me.grpInteger.PerformLayout() + Me.grpInteger.PerformLayout Me.ContextMenuStripInteger.ResumeLayout(False) Me.grpFactor.ResumeLayout(False) - Me.grpFactor.PerformLayout() + Me.grpFactor.PerformLayout Me.ContextMenuStripFactor.ResumeLayout(False) Me.grpHydroGOF.ResumeLayout(False) - Me.grpHydroGOF.PerformLayout() + Me.grpHydroGOF.PerformLayout Me.ContextMenuStripHydroGOF.ResumeLayout(False) Me.grpWakefield.ResumeLayout(False) Me.grpMaths.ResumeLayout(False) - Me.grpMaths.PerformLayout() + Me.grpMaths.PerformLayout Me.ContextMenuStripMaths.ResumeLayout(False) Me.grpSummary.ResumeLayout(False) - Me.grpSummary.PerformLayout() + Me.grpSummary.PerformLayout Me.ContextMenuStripSummary.ResumeLayout(False) Me.grpFrequencies.ResumeLayout(False) Me.grpProbabilty.ResumeLayout(False) - Me.grpProbabilty.PerformLayout() + Me.grpProbabilty.PerformLayout Me.ContextMenuStripProbability.ResumeLayout(False) Me.grpRandom.ResumeLayout(False) Me.grpTransform.ResumeLayout(False) - Me.grpTransform.PerformLayout() + Me.grpTransform.PerformLayout Me.ContextMenuStripTransform.ResumeLayout(False) Me.grpLogical.ResumeLayout(False) - Me.grpLogical.PerformLayout() + Me.grpLogical.PerformLayout Me.ContextMenuStripLogical.ResumeLayout(False) Me.grpTestString.ResumeLayout(False) Me.grpCircular.ResumeLayout(False) - Me.grpCircular.PerformLayout() + Me.grpCircular.PerformLayout Me.ContextMenuStripCircular.ResumeLayout(False) Me.grpModifier.ResumeLayout(False) Me.grpSymbols.ResumeLayout(False) Me.grpComplex.ResumeLayout(False) - Me.grpComplex.PerformLayout() + Me.grpComplex.PerformLayout Me.ContextMenuStripTxtString.ResumeLayout(False) Me.ContextMenuStripWakefield.ResumeLayout(False) Me.ContextMenuStripList.ResumeLayout(False) @@ -7540,7 +7540,7 @@ Partial Class ucrCalculator Me.GroupBox1.ResumeLayout(False) Me.grpMathBloc.ResumeLayout(False) Me.ResumeLayout(False) - Me.PerformLayout() + Me.PerformLayout End Sub diff --git a/instat/ucrCalculator.vb b/instat/ucrCalculator.vb index 2ff712429b2..a4d3f1b7658 100644 --- a/instat/ucrCalculator.vb +++ b/instat/ucrCalculator.vb @@ -1100,7 +1100,7 @@ Public Class ucrCalculator Private Sub cmdAcos_Click(sender As Object, e As EventArgs) Handles cmdAcos.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos()", 1) End If @@ -1108,7 +1108,7 @@ Public Class ucrCalculator Private Sub cmdAsin_Click(sender As Object, e As EventArgs) Handles cmdAsin.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin()", 1) End If @@ -1116,7 +1116,7 @@ Public Class ucrCalculator Private Sub cmdAtan_Click(sender As Object, e As EventArgs) Handles cmdAtan.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("atan(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("atan(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("atan()", 1) End If @@ -5252,7 +5252,7 @@ Public Class ucrCalculator Private Sub cmdComplexAsin_Click(sender As Object, e As EventArgs) Handles cmdComplexAsin.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("asin()", 1) End If @@ -5260,7 +5260,7 @@ Public Class ucrCalculator Private Sub cmdComplexAcos_Click(sender As Object, e As EventArgs) Handles cmdComplexAcos.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos(x = )", 1) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos(x = )", 2) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("acos()", 1) End If From 30e1b7a9b188c7c13558c2f79b23669807c61ec1 Mon Sep 17 00:00:00 2001 From: Stephen Lloyd Date: Wed, 3 Apr 2024 10:47:38 +0200 Subject: [PATCH 75/88] Added publit strScript --- instat/clsRSyntax.vb | 3 ++- instat/ucrButtons.vb | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/instat/clsRSyntax.vb b/instat/clsRSyntax.vb index ec7020e541f..5832c708cf7 100644 --- a/instat/clsRSyntax.vb +++ b/instat/clsRSyntax.vb @@ -94,6 +94,8 @@ Public Class RSyntax ''' The R command in the form of a string. Public strCommandString As String = "" + ''' The script associated with the base R code. + Public strScript As String ''' The R functions/operators/commands that should be run before the base R code. Private lstBeforeCodes As New List(Of RCodeStructure) @@ -293,7 +295,6 @@ Public Class RSyntax '''-------------------------------------------------------------------------------------------- Public Function GetScript() As String Dim strTemp As String = "" - Dim strScript As String = "" If bUseBaseFunction Then strTemp = clsBaseFunction.ToScript(strScript) diff --git a/instat/ucrButtons.vb b/instat/ucrButtons.vb index 9406a8b3535..39ec45ab36a 100644 --- a/instat/ucrButtons.vb +++ b/instat/ucrButtons.vb @@ -173,6 +173,10 @@ Public Class ucrButtons frmMain.AddToScriptWindow(clsRsyntax.GetScript(), bMakeVisible:=bMakeVisibleScriptWindow, bAppendAtCurrentCursorPosition:=bAppendScriptsAtCurrentScriptWindowCursorPosition) End If + 'This clears the script after it has been run, but leave the function and parameters in the base function + 'so that it can be run exactly the same when reopened. + clsRsyntax.strScript = "" + 'Run additional after codes lstAfterCodes = clsRsyntax.GetAfterCodes() lstAfterScripts = clsRsyntax.GetScriptsFromCodeList(lstAfterCodes) From 877f3eb64f5878e37cff8f7a9a624a1a1eaabe09 Mon Sep 17 00:00:00 2001 From: Stephen Lloyd Date: Wed, 3 Apr 2024 11:19:24 +0200 Subject: [PATCH 76/88] Re-inserted code to get script from command string --- instat/clsRSyntax.vb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/instat/clsRSyntax.vb b/instat/clsRSyntax.vb index 5832c708cf7..8b4476a0615 100644 --- a/instat/clsRSyntax.vb +++ b/instat/clsRSyntax.vb @@ -300,13 +300,16 @@ Public Class RSyntax strTemp = clsBaseFunction.ToScript(strScript) ElseIf bUseBaseOperator Then strTemp = clsBaseOperator.ToScript(strScript) + ElseIf bUseCommandString Then + strTemp = clsBaseCommandString.ToScript(strScript, strCommandString) End If If bExcludeAssignedFunctionOutput Then 'Sometimes the output of the R-command we deal with should not be part of the script... 'That's only the case when this output has already been assigned. If (bUseBaseFunction AndAlso clsBaseFunction.IsAssigned()) OrElse - (bUseBaseOperator AndAlso clsBaseFunction.IsAssigned()) Then + (bUseBaseOperator AndAlso clsBaseFunction.IsAssigned()) OrElse + (bUseCommandString AndAlso clsBaseFunction.IsAssigned()) Then Return strScript End If End If From 717e5d74a6494557cde78d4018e821599a2ec7c5 Mon Sep 17 00:00:00 2001 From: lilyclements Date: Wed, 3 Apr 2024 11:11:13 +0100 Subject: [PATCH 77/88] Update stand_alone_functions.R --- .../InstatObject/R/stand_alone_functions.R | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index e5cb1ade294..92267e8ece8 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -3259,22 +3259,6 @@ ggwalter_lieth <- function (data, month, station = NULL, p_mes, tm_max, tm_min, # data frame pretty things ------------------------------------------------------ ticks <- data.frame(x = seq(0, 12), ymin = -3, ymax = 0) - title <- station_name - if (!is.na(alt)) { - title <- paste0(title, " (", prettyNum(alt, big.mark = ",", - decimal.mark = "."), " m)") - } - if (!is.na(per)) { - title <- paste0(title, "\n", per) - } - sub <- paste(round(mean(dat_long_end[dat_long_end$interpolate == FALSE, ]$tm), 1), - "C ", - prettyNum(round(sum(dat_long_end[dat_long_end$interpolate == FALSE, ][[p_mes]])), big.mark = ","), " mm", sep = "") - - maxtm <- prettyNum(round(max(dat_long_end[[tm_max]]), 1)) - mintm <- prettyNum(round(min(dat_long_end[[tm_min]]), 1)) - tags <- paste0(paste0(rep(" \n", 6), collapse = ""), maxtm, - paste0(rep(" \n", 10), collapse = ""), mintm) month_breaks <- dat_long_end[dat_long_end[[month]] != "", ]$indrow month_labs <- dat_long_end[dat_long_end[[month]] != "", ][[month]] @@ -3329,13 +3313,8 @@ ggwalter_lieth <- function (data, month, station = NULL, p_mes, tm_max, tm_min, scale_y_continuous("C", limits = c(ymin, ymax), labels = templabs, breaks = range_tm, sec.axis = dup_axis(name = "mm", labels = preclabs)) wandlplot <- wandlplot + - ggplot2::labs(title = title, subtitle = sub, tag = tags) + ggplot2::theme_classic() + - ggplot2::theme(plot.title = element_text(lineheight = 1, size = 14, face = "bold"), - plot.subtitle = element_text(hjust = 1, vjust = 1, size = 14), - plot.tag = element_text(size = 10), - plot.tag.position = "left", axis.ticks.length.x.bottom = unit(0, "pt"), - axis.line.x.bottom = element_blank(), + ggplot2::theme(axis.line.x.bottom = element_blank(), axis.title.y.left = element_text(angle = 0, vjust = 0.9, size = 10, colour = tcol, margin = unit(rep(10, 4), "pt")), @@ -3351,4 +3330,4 @@ ggwalter_lieth <- function (data, month, station = NULL, p_mes, tm_max, tm_min, } return(wandlplot) -} \ No newline at end of file +} From ae0c9a403090f2f8f1827ebb8dc35d993f9a80d9 Mon Sep 17 00:00:00 2001 From: lilyclements Date: Wed, 3 Apr 2024 11:14:14 +0100 Subject: [PATCH 78/88] size to linewidth --- instat/static/InstatObject/R/stand_alone_functions.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index 92267e8ece8..3117ee37ac6 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -3307,7 +3307,7 @@ ggwalter_lieth <- function (data, month, station = NULL, p_mes, tm_max, tm_min, fill = sfcol, colour = "black") } wandlplot <- wandlplot + geom_hline(yintercept = c(0, 50), - size = 0.5) + + linewidth = 0.5) + geom_segment(data = ticks, aes(x = x, xend = x, y = ymin, yend = ymax)) + scale_x_continuous(breaks = month_breaks, name = "", labels = month_labs, expand = c(0, 0)) + scale_y_continuous("C", limits = c(ymin, ymax), labels = templabs, From 3cdf805264f881df56b87c0e97754c9558c5e22b Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:28:39 +0200 Subject: [PATCH 79/88] Code Changes --- instat/dlgTransform.vb | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 18a169332fc..dd224231125 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -419,7 +419,6 @@ Public Class dlgTransform ucrReceiverRank.SetMeAsReceiver() ucrSaveNew.Reset() ucrInputLogicOperations.SetText("==") - rdoSingle.Checked = True clsConstantDummyFunction.AddParameter("checked", "FALSE", iPosition:=0) clsConstantDummyFunction.AddParameter("preview", "TRUE", iPosition:=1) @@ -635,7 +634,6 @@ Public Class dlgTransform clsAssignOperator.AddParameter("left", clsRFunctionParameter:=clsColumnsFunction, iPosition:=0) clsAssignOperator.AddParameter("right", clsRFunctionParameter:=clsPasteFunction, iPosition:=1) - clsAddColumnsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") clsAddColumnsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRank.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) clsAddColumnsFunction.AddParameter("before", "FALSE", iPosition:=2) @@ -768,14 +766,13 @@ Public Class dlgTransform Private Sub NewDefaultName() If rdoSingle.Checked Then ucrSaveNew.SetLabelText("New Column Name:") - If (Not ucrSaveNew.bUserTyped) AndAlso Not ucrReceiverRank.IsEmpty Then + If Not ucrSaveNew.bUserTyped AndAlso Not ucrReceiverRank.IsEmpty Then ucrSaveNew.SetPrefix(ucrReceiverRank.GetVariableNames(bWithQuotes:=False)) End If ElseIf rdoMultiple.Checked Then ucrSaveNew.SetLabelText("Suffix Name:") ucrSaveNew.btnColumnPosition.Visible = False If Not ucrReceiverRank.IsEmpty AndAlso (Not ucrSaveNew.bUserTyped) Then - clsAddColumnsFunction.AddParameter("col_data", "col", iPosition:=1) End If End If @@ -796,7 +793,6 @@ Public Class dlgTransform ucrBase.clsRsyntax.ClearCodes() If rdoSingle.Checked Then - If rdoRank.Checked Then clsPreviewTextFunction = clsRankFunction.Clone clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) @@ -894,7 +890,7 @@ Public Class dlgTransform ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAssignOperator) ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddColumnsFunction) Else - LoopsParameters() + UpdateLoopParameters() ucrBase.clsRsyntax.ClearCodes() ucrBase.clsRsyntax.SetAssignTo("col") ucrBase.clsRsyntax.AddToAfterCodes(clsPipeOperator, 0) @@ -910,7 +906,7 @@ Public Class dlgTransform AddRemoveLogicalValues() End Sub - Private Sub LoopsParameters() + Private Sub UpdateLoopParameters() If rdoRank.Checked Then clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) clsPreviewTextFunction = clsRankColsFunction.Clone @@ -984,7 +980,6 @@ Public Class dlgTransform End If ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) - ElseIf rdoNonNegative.Checked Then clsDummyTransformFunction.AddParameter("check", "non-negative", iPosition:=0) If rdoSquareRoot.Checked Then @@ -1002,7 +997,6 @@ Public Class dlgTransform ElseIf rdoLogToBase10.Checked Then clsNonNegativeDummyFunction.AddParameter("check", "log10", iPosition:=0) - clsLogBase10ColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsLogBase10ColsFunction, bIncludeArgumentName:=False) ElseIf rdoNaturalLog.Checked Then @@ -1134,7 +1128,6 @@ Public Class dlgTransform If ucrSaveNew.GetText <> "" AndAlso ucrSaveNew.IsComplete() Then clsRemoveLabelsFunction.AddParameter("col_names", Chr(34) & ucrSaveNew.GetText & Chr(34), iPosition:=1) clsPasteFunction.AddParameter("col_data", Chr(34) & "_" & ucrSaveNew.GetText & Chr(34), iPosition:=1, bIncludeArgumentName:=False) - End If End Sub @@ -1149,9 +1142,7 @@ Public Class dlgTransform clsGetDataFrameFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRank.strCurrentDataFrame & Chr(34), iPosition:=0, bIncludeArgumentName:=False) clsGetDataFrameFunction.AddParameter("column_selection_name ", ucrReceiverRank.GetVariableNames, iPosition:=1) clsGetDataFrameFunction.SetAssignTo(ucrSelectorForRank.ucrAvailableDataFrames.cboAvailableDataFrames.Text) - clsAddColumnsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRank.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) - If rdoMultiple.Checked Then clsDummyTransformFunction.AddParameter("col", "multiple", iPosition:=0) ucrSelectorForRank.SetItemType("column_selection") @@ -1169,7 +1160,6 @@ Public Class dlgTransform Private Sub ucrChkMultiply_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkMultiply.ControlValueChanged, ucrInputMultiply.ControlValueChanged If ucrChkMultiply.Checked AndAlso Not ucrInputMultiply.IsEmpty Then clsScaleMultiplyColsOperator.AddParameter("y", ucrInputMultiply.GetText, iPosition:=1) - Else clsScaleMultiplyColsOperator.RemoveParameterByName("y") End If @@ -1178,7 +1168,6 @@ Public Class dlgTransform Private Sub ucrChkAdd_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAdd.ControlValueChanged, ucrInputAdd.ControlValueChanged If ucrChkAdd.Checked AndAlso Not ucrInputAdd.IsEmpty Then clsScaleAddColsOperator.AddParameter("v", ucrInputAdd.GetText, iPosition:=1) - Else clsScaleAddColsOperator.RemoveParameterByName("v") End If @@ -1187,7 +1176,6 @@ Public Class dlgTransform Private Sub ucrChkSubtract_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkSubtract.ControlValueChanged, ucrInputSubtract.ControlValueChanged If ucrChkSubtract.Checked AndAlso Not ucrInputSubtract.IsEmpty Then clsScaleSubtractColsOperator.AddParameter("u", ucrInputSubtract.GetText, iPosition:=1) - Else clsScaleSubtractColsOperator.RemoveParameterByName("u") End If @@ -1196,7 +1184,6 @@ Public Class dlgTransform Private Sub ucrChkDivide_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDivide.ControlValueChanged, ucrInputDivide.ControlValueChanged If ucrChkDivide.Checked AndAlso Not ucrInputDivide.IsEmpty Then clsScaleDivideColsOperator.AddParameter("z", ucrInputDivide.GetText, iPosition:=1) - Else clsScaleDivideColsOperator.RemoveParameterByName("z") End If From 6c32a61ba6cddb995b3ae905e94a269b67ecb2fa Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:32:10 +0200 Subject: [PATCH 80/88] Code Changes --- instat/dlgTransform.vb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index dd224231125..4d0ae1b168c 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -979,35 +979,28 @@ Public Class dlgTransform End Select End If ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) - ElseIf rdoNonNegative.Checked Then clsDummyTransformFunction.AddParameter("check", "non-negative", iPosition:=0) If rdoSquareRoot.Checked Then clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) - clsSquarerootColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsSquarerootColsFunction, bIncludeArgumentName:=False) ElseIf rdoPower.Checked Then - clsNonNegativeDummyFunction.AddParameter("check", "power", iPosition:=0) clsPowerColsOperator.AddParameter("y", ucrInputPower.GetText, iPosition:=1) - clsPowerColsOperator.AddParameter("x", "~.", bIncludeArgumentName:=False, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsPowerColsOperator, bIncludeArgumentName:=False) ElseIf rdoLogToBase10.Checked Then clsNonNegativeDummyFunction.AddParameter("check", "log10", iPosition:=0) - clsLogBase10ColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsLogBase10ColsFunction, bIncludeArgumentName:=False) ElseIf rdoNaturalLog.Checked Then clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) - clsNaturalLogColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsNaturalLogColsFunction, bIncludeArgumentName:=False) End If ElseIf rdoScale.Checked Then clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) - clsScaleSubtractColsOperator.AddParameter("left", "~.x", iPosition:=0) clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsScaleAddColsOperator, bIncludeArgumentName:=False) End If From 02185ab19b3b88f2e17c241d7528d0c2bc6ebbfc Mon Sep 17 00:00:00 2001 From: JUMA Date: Wed, 3 Apr 2024 14:01:14 +0300 Subject: [PATCH 81/88] changes --- instat/ucrCalculator.Designer.vb | 54 ++++++++++++++++---------------- instat/ucrCalculator.vb | 6 ++-- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/instat/ucrCalculator.Designer.vb b/instat/ucrCalculator.Designer.vb index cc6c218127b..f52022d6196 100644 --- a/instat/ucrCalculator.Designer.vb +++ b/instat/ucrCalculator.Designer.vb @@ -6109,7 +6109,7 @@ Partial Class ucrCalculator Me.grpSymbols.Controls.Add(Me.cmdEnd1) Me.grpSymbols.Controls.Add(Me.cmdbegin) Me.grpSymbols.Controls.Add(Me.cmdAny1) - Me.grpSymbols.Location = New System.Drawing.Point(542, 355) + Me.grpSymbols.Location = New System.Drawing.Point(542, 359) Me.grpSymbols.Margin = New System.Windows.Forms.Padding(2) Me.grpSymbols.Name = "grpSymbols" Me.grpSymbols.Padding = New System.Windows.Forms.Padding(2) @@ -6322,7 +6322,7 @@ Partial Class ucrCalculator ' Me.cmdComplexAsin.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexAsin.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexAsin.Location = New System.Drawing.Point(30, 164) + Me.cmdComplexAsin.Location = New System.Drawing.Point(30, 128) Me.cmdComplexAsin.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexAsin.Name = "cmdComplexAsin" Me.cmdComplexAsin.Size = New System.Drawing.Size(82, 38) @@ -6334,7 +6334,7 @@ Partial Class ucrCalculator ' Me.cmdComplexAtan.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexAtan.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexAtan.Location = New System.Drawing.Point(198, 164) + Me.cmdComplexAtan.Location = New System.Drawing.Point(198, 128) Me.cmdComplexAtan.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexAtan.Name = "cmdComplexAtan" Me.cmdComplexAtan.Size = New System.Drawing.Size(82, 38) @@ -6346,7 +6346,7 @@ Partial Class ucrCalculator ' Me.cmdComplexAcos.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexAcos.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexAcos.Location = New System.Drawing.Point(111, 164) + Me.cmdComplexAcos.Location = New System.Drawing.Point(111, 128) Me.cmdComplexAcos.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexAcos.Name = "cmdComplexAcos" Me.cmdComplexAcos.Size = New System.Drawing.Size(88, 38) @@ -6394,7 +6394,7 @@ Partial Class ucrCalculator ' Me.cmdComplexTanH.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexTanH.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexTanH.Location = New System.Drawing.Point(198, 128) + Me.cmdComplexTanH.Location = New System.Drawing.Point(198, 164) Me.cmdComplexTanH.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexTanH.Name = "cmdComplexTanH" Me.cmdComplexTanH.Size = New System.Drawing.Size(82, 38) @@ -6418,7 +6418,7 @@ Partial Class ucrCalculator ' Me.cmdComplexPi.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexPi.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexPi.Location = New System.Drawing.Point(279, 164) + Me.cmdComplexPi.Location = New System.Drawing.Point(279, 128) Me.cmdComplexPi.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexPi.Name = "cmdComplexPi" Me.cmdComplexPi.Size = New System.Drawing.Size(78, 38) @@ -6466,7 +6466,7 @@ Partial Class ucrCalculator ' Me.cmdComplexCosH.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexCosH.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexCosH.Location = New System.Drawing.Point(111, 128) + Me.cmdComplexCosH.Location = New System.Drawing.Point(111, 164) Me.cmdComplexCosH.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexCosH.Name = "cmdComplexCosH" Me.cmdComplexCosH.Size = New System.Drawing.Size(88, 38) @@ -6478,7 +6478,7 @@ Partial Class ucrCalculator ' Me.cmdComplexSinH.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexSinH.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexSinH.Location = New System.Drawing.Point(30, 128) + Me.cmdComplexSinH.Location = New System.Drawing.Point(30, 164) Me.cmdComplexSinH.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexSinH.Name = "cmdComplexSinH" Me.cmdComplexSinH.Size = New System.Drawing.Size(82, 38) @@ -6514,7 +6514,7 @@ Partial Class ucrCalculator ' Me.cmdComplexExp.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdComplexExp.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdComplexExp.Location = New System.Drawing.Point(279, 128) + Me.cmdComplexExp.Location = New System.Drawing.Point(279, 164) Me.cmdComplexExp.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.cmdComplexExp.Name = "cmdComplexExp" Me.cmdComplexExp.Size = New System.Drawing.Size(79, 38) @@ -7464,6 +7464,7 @@ Partial Class ucrCalculator Me.AutoScaleDimensions = New System.Drawing.SizeF(120.0!, 120.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True + Me.Controls.Add(Me.grpList) Me.Controls.Add(Me.cmdRhelpList) Me.Controls.Add(Me.cmdWakefieldHelp) Me.Controls.Add(Me.cmdStringRHelp) @@ -7475,64 +7476,63 @@ Partial Class ucrCalculator Me.Controls.Add(Me.ucrSelectorForCalculations) Me.Controls.Add(Me.ucrReceiverForCalculation) Me.Controls.Add(Me.lblExpression) + Me.Controls.Add(Me.grpModifier) + Me.Controls.Add(Me.grpTestString) + Me.Controls.Add(Me.grpSymbols) + Me.Controls.Add(Me.grpComplex) + Me.Controls.Add(Me.grpSummary) Me.Controls.Add(Me.grpTransform) Me.Controls.Add(Me.grpLogical) - Me.Controls.Add(Me.grpModifier) Me.Controls.Add(Me.grpDates) Me.Controls.Add(Me.grpHydroGOF) Me.Controls.Add(Me.grpFactor) Me.Controls.Add(Me.grpWakefield) - Me.Controls.Add(Me.grpList) Me.Controls.Add(Me.grpCircular) Me.Controls.Add(Me.grpMaths) Me.Controls.Add(Me.grpProbabilty) Me.Controls.Add(Me.grpInteger) - Me.Controls.Add(Me.grpTestString) - Me.Controls.Add(Me.grpSymbols) - Me.Controls.Add(Me.grpComplex) - Me.Controls.Add(Me.grpSummary) Me.Name = "ucrCalculator" Me.Size = New System.Drawing.Size(1123, 572) Me.grpBasic.ResumeLayout(False) Me.grpDates.ResumeLayout(False) - Me.grpDates.PerformLayout + Me.grpDates.PerformLayout() Me.ContextMenuStripDate.ResumeLayout(False) Me.ContextMenuStripComplex.ResumeLayout(False) Me.grpInteger.ResumeLayout(False) - Me.grpInteger.PerformLayout + Me.grpInteger.PerformLayout() Me.ContextMenuStripInteger.ResumeLayout(False) Me.grpFactor.ResumeLayout(False) - Me.grpFactor.PerformLayout + Me.grpFactor.PerformLayout() Me.ContextMenuStripFactor.ResumeLayout(False) Me.grpHydroGOF.ResumeLayout(False) - Me.grpHydroGOF.PerformLayout + Me.grpHydroGOF.PerformLayout() Me.ContextMenuStripHydroGOF.ResumeLayout(False) Me.grpWakefield.ResumeLayout(False) Me.grpMaths.ResumeLayout(False) - Me.grpMaths.PerformLayout + Me.grpMaths.PerformLayout() Me.ContextMenuStripMaths.ResumeLayout(False) Me.grpSummary.ResumeLayout(False) - Me.grpSummary.PerformLayout + Me.grpSummary.PerformLayout() Me.ContextMenuStripSummary.ResumeLayout(False) Me.grpFrequencies.ResumeLayout(False) Me.grpProbabilty.ResumeLayout(False) - Me.grpProbabilty.PerformLayout + Me.grpProbabilty.PerformLayout() Me.ContextMenuStripProbability.ResumeLayout(False) Me.grpRandom.ResumeLayout(False) Me.grpTransform.ResumeLayout(False) - Me.grpTransform.PerformLayout + Me.grpTransform.PerformLayout() Me.ContextMenuStripTransform.ResumeLayout(False) Me.grpLogical.ResumeLayout(False) - Me.grpLogical.PerformLayout + Me.grpLogical.PerformLayout() Me.ContextMenuStripLogical.ResumeLayout(False) Me.grpTestString.ResumeLayout(False) Me.grpCircular.ResumeLayout(False) - Me.grpCircular.PerformLayout + Me.grpCircular.PerformLayout() Me.ContextMenuStripCircular.ResumeLayout(False) Me.grpModifier.ResumeLayout(False) Me.grpSymbols.ResumeLayout(False) Me.grpComplex.ResumeLayout(False) - Me.grpComplex.PerformLayout + Me.grpComplex.PerformLayout() Me.ContextMenuStripTxtString.ResumeLayout(False) Me.ContextMenuStripWakefield.ResumeLayout(False) Me.ContextMenuStripList.ResumeLayout(False) @@ -7540,7 +7540,7 @@ Partial Class ucrCalculator Me.GroupBox1.ResumeLayout(False) Me.grpMathBloc.ResumeLayout(False) Me.ResumeLayout(False) - Me.PerformLayout + Me.PerformLayout() End Sub diff --git a/instat/ucrCalculator.vb b/instat/ucrCalculator.vb index a4d3f1b7658..978f359712b 100644 --- a/instat/ucrCalculator.vb +++ b/instat/ucrCalculator.vb @@ -280,7 +280,7 @@ Public Class ucrCalculator ' Complex keyboard tooltips ttCalculator.SetToolTip(cmdComplexPi, "pi = 3.14159") ttCalculator.SetToolTip(cmdComplexi, "i is defined as the square root of -1. So sqrt(as.complex(-1)) = 0 + 1i") - ttCalculator.SetToolTip(cmdComplex, "Generate a complex variable. For example complex(3, 2:4,1. 5) gives 2+1.5i, 3+1.5i, 4+1.5i") + ttCalculator.SetToolTip(cmdComplex, "Generate a complex variable. For example complex(3, 2:4,1.5) gives 2+1.5i, 3+1.5i, 4+1.5i") ttCalculator.SetToolTip(cmdAsComplex, "Define a variable as complex. For example as.complex(-1) gives 1 + 0i") ttCalculator.SetToolTip(cmdReal, "The real part of a complex number. For example Re(3 + 2i) gives 3.") ttCalculator.SetToolTip(cmdImaginary, "The imaginary part of a complex number or variable. For example Im(3 + 2i) gives 2.") @@ -430,7 +430,7 @@ Public Class ucrCalculator ' Factor keyboard tooltips ttCalculator.SetToolTip(cmdFactor, "Make a factor from a numeric or character variable") - ttCalculator.SetToolTip(cmdAnon, "Anonymise factor levels, replacing them by a number. Optionally add a profix, for example fct_anon(name, ""n"")") + ttCalculator.SetToolTip(cmdAnon, "Anonymise factor levels, replacing them by a number. Optionally add a prefix, for example fct_anon(name, ""n"")") ttCalculator.SetToolTip(cmdLabelled, "Create a labelled variable") ttCalculator.SetToolTip(cmdCollapse, "Combine factor levels. For example fct_collapse(variety, trad=""TRAD"",improved=c(""NEW"",""OLD""))") ttCalculator.SetToolTip(cmdCross, "Make interaction variable. For example fct_cross(variety,fertgrp, keep_empty=TRUE)") @@ -5244,7 +5244,7 @@ Public Class ucrCalculator Private Sub cmdComplex_Click(sender As Object, e As EventArgs) Handles cmdComplex.Click If chkShowParameters.Checked Then - ucrReceiverForCalculation.AddToReceiverAtCursorPosition("complex(x = )", 2) + ucrReceiverForCalculation.AddToReceiverAtCursorPosition("complex(length.out= 0,real= numeric(),imaginary= numeric(),modulus= 1,argument= 0)", 0) Else ucrReceiverForCalculation.AddToReceiverAtCursorPosition("complex( )", 1) End If From c2c096b7e6a6ae6997453d9a8b4095a3c81ed204 Mon Sep 17 00:00:00 2001 From: Ntalumeso Date: Wed, 3 Apr 2024 14:49:03 +0300 Subject: [PATCH 82/88] Sorting the display of numbers in the output window --- instat/dlgCalculator.vb | 2 +- instat/static/InstatObject/R/stand_alone_functions.R | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/instat/dlgCalculator.vb b/instat/dlgCalculator.vb index b544e8d7b90..941ad851aa3 100644 --- a/instat/dlgCalculator.vb +++ b/instat/dlgCalculator.vb @@ -132,7 +132,7 @@ Public Class dlgCalculator Else ucrBase.clsRsyntax.RemoveFromAfterCodes(clsRemoveLabelsFunction) ucrBase.clsRsyntax.RemoveAssignTo() - ucrBase.clsRsyntax.iCallType = 1 + ucrBase.clsRsyntax.iCallType = 5 ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False End If diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index 6b56e32cffa..8d770891476 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -1,5 +1,6 @@ get_default_significant_figures <- function(data) { - if(is.numeric(data)) return(3) + default_digits <- getOption("digits") + if(is.numeric(data) || is.complex(data)) return(default_digits) else return(NA) } From 073370c76ff270b4e3b85fefd085afb03c88fe6a Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Thu, 4 Apr 2024 11:01:00 +0100 Subject: [PATCH 83/88] minor change made --- instat/dlgClimograph.vb | 1 - 1 file changed, 1 deletion(-) diff --git a/instat/dlgClimograph.vb b/instat/dlgClimograph.vb index b7c7646e0c5..5852c08272f 100644 --- a/instat/dlgClimograph.vb +++ b/instat/dlgClimograph.vb @@ -284,7 +284,6 @@ Public Class dlgClimograph Private Sub ucr1stFactorReceiver_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucr1stFactorReceiver.ControlValueChanged If Not ucr1stFactorReceiver.IsEmpty Then - 'clsGgwalterliethFunction.AddParameter("station", Chr(34) & ucr1stFactorReceiver.GetVariableNames(False) & Chr(34), iPosition:=1) clsGgwalterliethFunction.AddParameter("station", ucr1stFactorReceiver.GetVariableNames(), iPosition:=1) Else clsGgwalterliethFunction.RemoveParameterByName("station") From 8782aba65d7ea808b2a9986e89d0d827ba2e1530 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Thu, 4 Apr 2024 14:46:37 +0200 Subject: [PATCH 84/88] fixed the Standardise function for the select columns --- instat/dlgTransform.vb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 4d0ae1b168c..5b50a95bd9b 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -46,6 +46,7 @@ Public Class dlgTransform Private clsLogBase10Function As New RFunction Private clsLogBase10ColsFunction As New RFunction Private clsStandardDevColsFunction As New RFunction + Private clsSymbolOperator As New ROperator Private clsMeanColsFunction As New RFunction Private clsReplicateColsFunction As New RFunction Private clsConcDiffColsFunction As New RFunction @@ -408,6 +409,7 @@ Public Class dlgTransform clsConcDiffColsFunction = New RFunction clsReplicateColsFunction = New RFunction clsStandardDevColsFunction = New RFunction + clsSymbolOperator = New ROperator clsBooleanColsOperator = New ROperator clsAddColumnsFunction = New RFunction clsPasteFunction = New RFunction @@ -543,13 +545,17 @@ Public Class dlgTransform clsStandardDevColsFunction.AddParameter("na.rm", "TRUE", iPosition:=1) clsSubtractColsOperator.SetOperation("-") - clsSubtractColsOperator.AddParameter("left", "~.x", iPosition:=0) + clsSubtractColsOperator.AddParameter("left", ".x", iPosition:=0) clsSubtractColsOperator.AddParameter("y", clsRFunctionParameter:=clsMeanColsFunction, iPosition:=1) clsDivisionColsOperator.SetOperation("/") clsDivisionColsOperator.AddParameter("x", clsROperatorParameter:=clsSubtractColsOperator, iPosition:=0) clsDivisionColsOperator.AddParameter("y", clsRFunctionParameter:=clsStandardDevColsFunction, iPosition:=1) - clsDivisionColsOperator.bBrackets = False + 'clsDivisionColsOperator.bBrackets = False + + clsSymbolOperator.AddParameter("left", "~", iPosition:=0, bIncludeArgumentName:=False) + clsSymbolOperator.AddParameter("right", clsROperatorParameter:=clsDivisionColsOperator, iPosition:=1, bIncludeArgumentName:=False) + clsSymbolOperator.bBrackets = False clsSquarerootColsFunction.SetRCommand("~sqrt") @@ -948,7 +954,7 @@ Public Class dlgTransform clsMeanColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) clsStandardDevColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsDivisionColsOperator, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsSymbolOperator, bIncludeArgumentName:=False) ElseIf rdoLogical.Checked Then clsNumericDummyFunction.AddParameter("check", "logical", iPosition:=0) clsBooleanColsOperator.AddParameter("x", "~.x", bIncludeArgumentName:=False, iPosition:=0) From e39e2f74a0aaf1c8addffd35cedea7ce752b9af6 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Thu, 4 Apr 2024 15:08:30 +0200 Subject: [PATCH 85/88] Fixed Scale Function for the select column --- instat/dlgTransform.vb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 5b50a95bd9b..3200d7b2624 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -47,6 +47,7 @@ Public Class dlgTransform Private clsLogBase10ColsFunction As New RFunction Private clsStandardDevColsFunction As New RFunction Private clsSymbolOperator As New ROperator + Private clsSymbolOperator2 As New ROperator Private clsMeanColsFunction As New RFunction Private clsReplicateColsFunction As New RFunction Private clsConcDiffColsFunction As New RFunction @@ -410,6 +411,7 @@ Public Class dlgTransform clsReplicateColsFunction = New RFunction clsStandardDevColsFunction = New RFunction clsSymbolOperator = New ROperator + clsSymbolOperator2 = New ROperator clsBooleanColsOperator = New ROperator clsAddColumnsFunction = New RFunction clsPasteFunction = New RFunction @@ -551,7 +553,6 @@ Public Class dlgTransform clsDivisionColsOperator.SetOperation("/") clsDivisionColsOperator.AddParameter("x", clsROperatorParameter:=clsSubtractColsOperator, iPosition:=0) clsDivisionColsOperator.AddParameter("y", clsRFunctionParameter:=clsStandardDevColsFunction, iPosition:=1) - 'clsDivisionColsOperator.bBrackets = False clsSymbolOperator.AddParameter("left", "~", iPosition:=0, bIncludeArgumentName:=False) clsSymbolOperator.AddParameter("right", clsROperatorParameter:=clsDivisionColsOperator, iPosition:=1, bIncludeArgumentName:=False) @@ -591,7 +592,10 @@ Public Class dlgTransform clsScaleAddColsOperator.SetOperation("+") clsScaleAddColsOperator.AddParameter("x", clsROperatorParameter:=clsScaleDivideColsOperator, iPosition:=0) clsScaleAddColsOperator.AddParameter("v", "0", iPosition:=1) - clsScaleAddColsOperator.bBrackets = False + + clsSymbolOperator2.AddParameter("left", "~", iPosition:=0, bIncludeArgumentName:=False) + clsSymbolOperator2.AddParameter("right", clsROperatorParameter:=clsScaleAddColsOperator, iPosition:=1, bIncludeArgumentName:=False) + clsSymbolOperator2.bBrackets = False clsBooleanColsOperator.SetOperation("==") clsIsNAColsFunction.SetRCommand("is.na") @@ -1007,8 +1011,8 @@ Public Class dlgTransform End If ElseIf rdoScale.Checked Then clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) - clsScaleSubtractColsOperator.AddParameter("left", "~.x", iPosition:=0) - clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsScaleAddColsOperator, bIncludeArgumentName:=False) + clsScaleSubtractColsOperator.AddParameter("left", ".x", iPosition:=0) + clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsSymbolOperator2, bIncludeArgumentName:=False) End If clsMutateFunction.AddParameter("var", clsRFunctionParameter:=clsAcrossFunction, bIncludeArgumentName:=False, iPosition:=0) From 49cbfc03bdaf6970f8d969287f8ae07b029020de Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Thu, 4 Apr 2024 15:58:53 +0200 Subject: [PATCH 86/88] Code Changes --- instat/dlgTransform.vb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 3200d7b2624..ca8a6986e2f 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -935,17 +935,14 @@ Public Class dlgTransform clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsRoundColsFunction, bIncludeArgumentName:=False) ElseIf rdoSignificantDigits.Checked Then clsNumericDummyFunction.AddParameter("check", "signif", iPosition:=0) - clsSignifColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsSignifColsFunction, bIncludeArgumentName:=False) ElseIf rdoLag.Checked Then clsNumericDummyFunction.AddParameter("check", "lag", iPosition:=0) - clsLagColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsLagColsFunction, bIncludeArgumentName:=False) ElseIf rdoLead.Checked Then clsNumericDummyFunction.AddParameter("check", "lead", iPosition:=0) - clsLeadColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsLeadColsFunction, bIncludeArgumentName:=False) ElseIf rdoDifference.Checked Then @@ -954,10 +951,8 @@ Public Class dlgTransform clsAcrossFunction.AddParameter("operator", clsRFunctionParameter:=clsConcDiffColsFunction, bIncludeArgumentName:=False) ElseIf rdoStandardize.Checked Then clsNumericDummyFunction.AddParameter("check", "standardise", iPosition:=0) - clsMeanColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) clsStandardDevColsFunction.AddParameter("x", ".x", bIncludeArgumentName:=False, iPosition:=0) - clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsSymbolOperator, bIncludeArgumentName:=False) ElseIf rdoLogical.Checked Then clsNumericDummyFunction.AddParameter("check", "logical", iPosition:=0) From 4deafdde0e1648095c7e8440fd4026a5bfa931d7 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Thu, 4 Apr 2024 19:51:45 +0200 Subject: [PATCH 87/88] Fixed the Scale function for the select columns --- instat/dlgTransform.vb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index ca8a6986e2f..fc8147d6f9c 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -582,19 +582,19 @@ Public Class dlgTransform clsScaleMultiplyColsOperator.SetOperation("*") clsScaleMultiplyColsOperator.AddParameter("x", clsROperatorParameter:=clsScaleSubtractColsOperator, iPosition:=0) clsScaleMultiplyColsOperator.AddParameter("y", "1", iPosition:=1) - clsScaleMultiplyColsOperator.bBrackets = False clsScaleDivideColsOperator.SetOperation("/") - clsScaleDivideColsOperator.AddParameter("x", clsROperatorParameter:=clsScaleMultiplyColsOperator, iPosition:=0) + clsScaleDivideColsOperator.AddParameter("x", clsROperatorParameter:=clsSymbolOperator2, iPosition:=0) clsScaleDivideColsOperator.AddParameter("z", "1", iPosition:=1) clsScaleDivideColsOperator.bBrackets = False clsScaleAddColsOperator.SetOperation("+") clsScaleAddColsOperator.AddParameter("x", clsROperatorParameter:=clsScaleDivideColsOperator, iPosition:=0) clsScaleAddColsOperator.AddParameter("v", "0", iPosition:=1) + clsScaleAddColsOperator.bBrackets = False clsSymbolOperator2.AddParameter("left", "~", iPosition:=0, bIncludeArgumentName:=False) - clsSymbolOperator2.AddParameter("right", clsROperatorParameter:=clsScaleAddColsOperator, iPosition:=1, bIncludeArgumentName:=False) + clsSymbolOperator2.AddParameter("right", clsROperatorParameter:=clsScaleMultiplyColsOperator, iPosition:=1, bIncludeArgumentName:=False) clsSymbolOperator2.bBrackets = False clsBooleanColsOperator.SetOperation("==") @@ -1007,7 +1007,7 @@ Public Class dlgTransform ElseIf rdoScale.Checked Then clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) clsScaleSubtractColsOperator.AddParameter("left", ".x", iPosition:=0) - clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsSymbolOperator2, bIncludeArgumentName:=False) + clsAcrossFunction.AddParameter("operator", clsROperatorParameter:=clsScaleAddColsOperator, bIncludeArgumentName:=False) End If clsMutateFunction.AddParameter("var", clsRFunctionParameter:=clsAcrossFunction, bIncludeArgumentName:=False, iPosition:=0) From 7029cbf45a0efad1d5f0259c5cacd9c068866e65 Mon Sep 17 00:00:00 2001 From: Stephen Lloyd Date: Fri, 5 Apr 2024 09:32:38 +0200 Subject: [PATCH 88/88] ensured that dlgEnter assignments are correctly deleted --- instat/clsRSyntax.vb | 7 +++++-- instat/ucrButtons.vb | 4 ---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/instat/clsRSyntax.vb b/instat/clsRSyntax.vb index 8b4476a0615..c73283a7497 100644 --- a/instat/clsRSyntax.vb +++ b/instat/clsRSyntax.vb @@ -94,8 +94,6 @@ Public Class RSyntax ''' The R command in the form of a string. Public strCommandString As String = "" - ''' The script associated with the base R code. - Public strScript As String ''' The R functions/operators/commands that should be run before the base R code. Private lstBeforeCodes As New List(Of RCodeStructure) @@ -231,6 +229,8 @@ Public Class RSyntax clsBaseFunction.GetAllAssignTo(lstCodes, lstValues) ElseIf bUseBaseOperator Then clsBaseOperator.GetAllAssignTo(lstCodes, lstValues) + ElseIf bUseCommandString Then + clsBaseCommandString.GetAllAssignTo(lstCodes, lstValues) End If lstBeforeCodes.Sort(AddressOf CompareCodePositions) For Each clsTempCode As RCodeStructure In lstBeforeCodes @@ -295,6 +295,7 @@ Public Class RSyntax '''-------------------------------------------------------------------------------------------- Public Function GetScript() As String Dim strTemp As String = "" + Dim strScript As String = "" If bUseBaseFunction Then strTemp = clsBaseFunction.ToScript(strScript) @@ -431,6 +432,7 @@ Public Class RSyntax clsBaseFunction = clsFunction bUseBaseFunction = True bUseBaseOperator = False + bUseCommandString = False End Sub '''-------------------------------------------------------------------------------------------- @@ -442,6 +444,7 @@ Public Class RSyntax clsBaseOperator = clsOperator bUseBaseFunction = False bUseBaseOperator = True + bUseCommandString = False End Sub '''-------------------------------------------------------------------------------------------- diff --git a/instat/ucrButtons.vb b/instat/ucrButtons.vb index 39ec45ab36a..9406a8b3535 100644 --- a/instat/ucrButtons.vb +++ b/instat/ucrButtons.vb @@ -173,10 +173,6 @@ Public Class ucrButtons frmMain.AddToScriptWindow(clsRsyntax.GetScript(), bMakeVisible:=bMakeVisibleScriptWindow, bAppendAtCurrentCursorPosition:=bAppendScriptsAtCurrentScriptWindowCursorPosition) End If - 'This clears the script after it has been run, but leave the function and parameters in the base function - 'so that it can be run exactly the same when reopened. - clsRsyntax.strScript = "" - 'Run additional after codes lstAfterCodes = clsRsyntax.GetAfterCodes() lstAfterScripts = clsRsyntax.GetScriptsFromCodeList(lstAfterCodes)