Skip to content

Commit

Permalink
Merge pull request IDEMSInternational#9297 from derekagorhom/Update_O…
Browse files Browse the repository at this point in the history
…ne_Variable_Summarise

Update One Variable Summarise and changing the Format options to Table Options
  • Loading branch information
N-thony authored Dec 12, 2024
2 parents fbcc184 + fc270fd commit 2fda5d3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 112 deletions.
42 changes: 22 additions & 20 deletions instat/dlgOneVariableSummarise.Designer.vb

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

112 changes: 20 additions & 92 deletions instat/dlgOneVariableSummarise.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,9 @@ Public Class dlgOneVariableSummarise
clsConcFunction, clsSummaryTableFunction, clsDummyFunction,
clsSkimrFunction, clsPivotWiderFunction As New RFunction

Private clsTableTitleFunction, clsTabFootnoteTitleFunction, clsTableSourcenoteFunction, clsFootnoteTitleLocationFunction,
clsFootnoteSubtitleLocationFunction, clsTabFootnoteSubtitleFunction, clsFootnoteCellFunction, clsFootnoteCellBodyFunction,
clsSecondFootnoteCellFunction, clsSecondFootnoteCellBodyFunction, clsTabStyleFunction, clsTabStyleCellTextFunction,
clsTabStylePxFunction, clsTabStyleCellTitleFunction, clsThemesTabOptionsFunction, clsgtExtraThemesFunction As New RFunction
Private clsPipeOperator, clsJoiningPipeOperator As New ROperator
Private clsSummaryOperator As New ROperator
Private clsGetGtTableFunction As New RFunction
Private clsGtTableROperator As New ROperator
Private bResetSubdialog As Boolean = False
Private bResetFormatSubdialog As Boolean = False
Public strDefaultDataFrame As String = ""
Expand Down Expand Up @@ -133,84 +130,20 @@ Public Class dlgOneVariableSummarise
clsGtFunction = New RFunction
clsDummyFunction = New RFunction
clsSkimrFunction = New RFunction
clsSummaryOperator = New ROperator
clsPivotWiderFunction = New RFunction

clsTableTitleFunction = New RFunction
clsTabFootnoteTitleFunction = New RFunction
clsTableSourcenoteFunction = New RFunction
clsFootnoteTitleLocationFunction = New RFunction
clsFootnoteSubtitleLocationFunction = New RFunction
clsPipeOperator = New ROperator
clsTabFootnoteSubtitleFunction = New RFunction
clsFootnoteCellBodyFunction = New RFunction
clsSecondFootnoteCellBodyFunction = New RFunction
clsFootnoteCellFunction = New RFunction
clsSecondFootnoteCellFunction = New RFunction
clsTabStyleFunction = New RFunction
clsTabStyleCellTextFunction = New RFunction
clsTabStylePxFunction = New RFunction
clsTabStyleCellTitleFunction = New RFunction
clsJoiningPipeOperator = New ROperator
clsThemesTabOptionsFunction = New RFunction
clsgtExtraThemesFunction = New RFunction

clsGtTableROperator = New ROperator
clsGetGtTableFunction = New RFunction

ucrSelectorOneVarSummarise.Reset()

clsPipeOperator.SetOperation("%>%")
clsPipeOperator.bBrackets = False

clsThemesTabOptionsFunction.SetPackageName("gt")
clsThemesTabOptionsFunction.SetRCommand("tab_options")

clsgtExtraThemesFunction.SetPackageName("gtExtras")

clsTabStyleFunction.SetRCommand("tab_style")
clsTabStyleFunction.SetPackageName("gt")
clsTabStyleFunction.AddParameter("style", clsRFunctionParameter:=clsTabStyleCellTextFunction, iPosition:=0)
clsTabStyleFunction.AddParameter("location", clsRFunctionParameter:=clsTabStyleCellTitleFunction, iPosition:=1)

clsTabStyleCellTitleFunction.SetPackageName("gt")
clsTabStyleCellTitleFunction.SetRCommand("cells_title")
clsTabStyleCellTitleFunction.AddParameter("groups", Chr(34) & "title" & Chr(34), iPosition:=0)

clsTabStyleCellTextFunction.SetPackageName("gt")
clsTabStyleCellTextFunction.SetRCommand("cell_text")
clsTabStyleCellTextFunction.AddParameter("size", clsRFunctionParameter:=clsTabStylePxFunction, iPosition:=0)

clsTabStylePxFunction.SetPackageName("gt")
clsTabStylePxFunction.SetRCommand("px")
clsTabStylePxFunction.AddParameter("size", "18", bIncludeArgumentName:=False, iPosition:=0)

clsTableTitleFunction.SetPackageName("gt")
clsTableTitleFunction.SetRCommand("tab_header")

clsTabFootnoteTitleFunction.SetPackageName("gt")
clsTabFootnoteTitleFunction.SetRCommand("tab_footnote")

clsTabFootnoteSubtitleFunction.SetPackageName("gt")
clsTabFootnoteSubtitleFunction.SetRCommand("tab_footnote")

clsFootnoteCellFunction.SetPackageName("gt")
clsFootnoteCellFunction.SetRCommand("tab_footnote")

clsSecondFootnoteCellFunction.SetPackageName("gt")
clsSecondFootnoteCellFunction.SetRCommand("tab_footnote")

clsFootnoteTitleLocationFunction.SetPackageName("gt")
clsFootnoteTitleLocationFunction.SetRCommand("cells_title")

clsFootnoteSubtitleLocationFunction.SetPackageName("gt")
clsFootnoteSubtitleLocationFunction.SetRCommand("cells_title")

clsTableSourcenoteFunction.SetPackageName("gt")
clsTableSourcenoteFunction.SetRCommand("tab_source_note")

clsFootnoteCellBodyFunction.SetPackageName("gt")
clsFootnoteCellBodyFunction.SetRCommand("cells_body")

clsSecondFootnoteCellBodyFunction.SetPackageName("gt")
clsSecondFootnoteCellBodyFunction.SetRCommand("cells_body")
clsGetGtTableFunction.SetPackageName("gt")
clsGetGtTableFunction.SetRCommand("gt")

clsSkimrFunction.SetPackageName("skimr")
clsSkimrFunction.SetRCommand("skim_without_charts")
Expand All @@ -234,13 +167,13 @@ Public Class dlgOneVariableSummarise

clsGtFunction.SetPackageName("gt")
clsGtFunction.SetRCommand("gt")

clsSummaryOperator.SetOperation("%>%")
clsSummaryOperator.AddParameter("tableFun", clsRFunctionParameter:=clsSummaryTableFunction, iPosition:=0)
clsSummaryOperator.AddParameter("gttbl", clsRFunctionParameter:=clsGtFunction, iPosition:=2)
clsGtTableROperator.SetOperation("%>%")
clsGtTableROperator.bBrackets = False
clsGtTableROperator.AddParameter("tableFun", clsRFunctionParameter:=clsSummaryTableFunction, iPosition:=0)
clsGtTableROperator.AddParameter(strParameterName:="gt_tbl", clsRFunctionParameter:=clsGtFunction, iPosition:=1, bIncludeArgumentName:=False)

clsJoiningPipeOperator.SetOperation("%>%")
clsJoiningPipeOperator.AddParameter("mutable", clsROperatorParameter:=clsSummaryOperator, iPosition:=0)
clsJoiningPipeOperator.AddParameter("mutable", clsROperatorParameter:=clsGtTableROperator, iPosition:=0)
clsJoiningPipeOperator.SetAssignToOutputObject(strRObjectToAssignTo:="last_table",
strRObjectTypeLabelToAssignTo:=RObjectTypeLabel.Table,
strRObjectFormatToAssignTo:=RObjectFormat.Html,
Expand Down Expand Up @@ -285,6 +218,8 @@ Public Class dlgOneVariableSummarise
ucrSelectorOneVarSummarise.SetRCode(clsSummaryTableFunction, bReset)
ucrInputDisplayMissing.SetRCode(clsSummaryTableFunction, bReset)
ucrSaveSummary.SetRCode(clsSkimrFunction, bReset)
ucrSelectorOneVarSummarise.SetRCode(clsGetGtTableFunction, bReset)
ucrReceiverOneVarSummarise.SetRCode(clsGetGtTableFunction, bReset)

If bReset Then
ucrChkDisplayMissing.SetRCode(clsDummyFunction, bReset)
Expand Down Expand Up @@ -399,7 +334,7 @@ Public Class dlgOneVariableSummarise
ucrSaveSummary.SetCheckBoxText("Store Summary")
End If
cmdSummaries.Visible = rdoCustomised.Checked
cmdFormatTable.Visible = rdoCustomised.Checked
cmdTableOptions.Visible = rdoCustomised.Checked
End Sub

Private Sub FillListView()
Expand Down Expand Up @@ -432,26 +367,19 @@ Public Class dlgOneVariableSummarise
Next
End Sub

Private Sub cmdFormatTable_Click(sender As Object, e As EventArgs) Handles cmdFormatTable.Click
sdgFormatSummaryTables.SetRCode(clsNewTableTitleFunction:=clsTableTitleFunction, clsNewTabFootnoteTitleFunction:=clsTabFootnoteTitleFunction, clsNewTableSourcenoteFunction:=clsTableSourcenoteFunction, clsNewDummyFunction:=clsDummyFunction,
clsNewFootnoteCellFunction:=clsFootnoteCellFunction, clsNewSecondFootnoteCellBodyFunction:=clsSecondFootnoteCellBodyFunction,
clsNewPipeOperator:=clsPipeOperator, clsNewFootnoteTitleLocationFunction:=clsFootnoteTitleLocationFunction, clsNewFootnoteCellBodyFunction:=clsFootnoteCellBodyFunction,
clsNewFootnoteSubtitleLocationFunction:=clsFootnoteSubtitleLocationFunction, clsNewTabFootnoteSubtitleFunction:=clsTabFootnoteSubtitleFunction, clsNewJoiningOperator:=clsJoiningPipeOperator,
clsNewMutableOperator:=clsSummaryOperator, clsNewSecondFootnoteCellFunction:=clsSecondFootnoteCellFunction,
clsNewTabStyleCellTextFunction:=clsTabStyleCellTextFunction, clsNewTabStyleFunction:=clsTabStyleFunction, clsNewTabStylePxFunction:=clsTabStylePxFunction, clsNewThemesTabOptionFunction:=clsThemesTabOptionsFunction,
clsNewgtExtraThemesFunction:=clsgtExtraThemesFunction, bReset:=bResetFormatSubdialog)

sdgFormatSummaryTables.ShowDialog()
Private Sub cmdTableOptions_Click(sender As Object, e As EventArgs) Handles cmdTableOptions.Click
sdgTableOptions.Setup(ucrSelectorOneVarSummarise.strCurrentDataFrame, clsGtTableROperator)
sdgTableOptions.ShowDialog(Me)
bResetFormatSubdialog = False
End Sub

Private Sub Display_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlColumnFactor.ControlValueChanged
'If bRCodeSet Then
If rdoNoColumnFactor.Checked Then
clsSummaryOperator.RemoveParameterByName("col_factor")
clsGtTableROperator.RemoveParameterByName("col_factor")
clsDummyFunction.AddParameter("factor_cols", "NoColFactor", iPosition:=1)
Else
clsSummaryOperator.AddParameter("col_factor", clsRFunctionParameter:=clsPivotWiderFunction, iPosition:=1)
clsGtTableROperator.AddParameter("col_factor", clsRFunctionParameter:=clsPivotWiderFunction, iPosition:=1)
If rdoSummary.Checked Then
clsDummyFunction.AddParameter("factor_cols", "Sum", iPosition:=1)
clsPivotWiderFunction.AddParameter("names_from", "summary", iPosition:=0)
Expand Down

0 comments on commit 2fda5d3

Please sign in to comment.