Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating #301

Merged
merged 12 commits into from
Nov 26, 2024
21 changes: 4 additions & 17 deletions instat/UserTables/sdgTableOptions.vb
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,12 @@ Public Class sdgTableOptions
' Themes

Private Sub SetupTheme(clsOperator As ROperator)
clsThemeRFunction = New RFunction

' Uncheck then the check radio button to forces the panel to raise its ControlValueChanged event
rdoSelectTheme.Checked = False
rdoSelectTheme.Checked = True

If Not clsOperator.ContainsParameter("theme_format") Then
Exit Sub
End If

clsThemeRFunction = clsOperator.GetParameter("theme_format").clsArgumentCodeStructure

If clsThemeRFunction.strRCommand = "tab_options" Then
rdoManualTheme.Checked = True
If clsOperator.ContainsParameter("theme_format") Then
clsThemeRFunction = clsOperator.GetParameter("theme_format").clsArgumentCodeStructure
Else
rdoSelectTheme.Checked = True
ucrCboSelectThemes.SetName(clsThemeRFunction.strRCommand)
clsThemeRFunction = New RFunction
clsThemeRFunction.SetPackageName("gtExtras")
End If

End Sub

Private Sub ucrPnlThemes_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlThemesPanel.ControlValueChanged
Expand Down
2 changes: 1 addition & 1 deletion instat/dlgLabelsLevels.vb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Public Class dlgLabelsLevels
ucrSelectorForLabels.Focus()


clsSumCountMissingFunction.SetRCommand("summary_count_missing")
clsSumCountMissingFunction.SetRCommand("summary_count_miss")

clsViewLabelsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$set_factor_levels")
ucrBase.clsRsyntax.SetBaseRFunction(clsViewLabelsFunction)
Expand Down
15 changes: 0 additions & 15 deletions instat/dlgSummaryTables.Designer.vb

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

15 changes: 12 additions & 3 deletions instat/dlgSummaryTables.vb
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,18 @@ Public Class dlgSummaryTables
End If

End Sub

Private Sub btnMoreOptions_Click(sender As Object, e As EventArgs) Handles btnMoreOptions.Click
sdgTableOptions.Setup(ucrSelectorSummaryTables.strCurrentDataFrame, clsJoiningPipeOperator)
Dim clsROperator As ROperator
If rdoFrequencyTable.Checked Then
clsROperator = clsFrequencyOperator
ElseIf rdoSummaryTable.Checked Then
clsROperator = clsSummaryOperator
Else
Exit Sub
End If

sdgTableOptions.Setup(ucrSelectorSummaryTables.strCurrentDataFrame, clsROperator)
sdgTableOptions.ShowDialog(Me)

End Sub
Expand All @@ -338,7 +348,7 @@ Public Class dlgSummaryTables
TestOKEnabled()
End Sub

Private Sub cmdFormatTable_Click(sender As Object, e As EventArgs) Handles cmdFormatTable.Click
Private Sub cmdFormatTable_Click(sender As Object, e As EventArgs)

Dim clsROperator As ROperator
If rdoFrequencyTable.Checked Then
Expand Down Expand Up @@ -385,7 +395,6 @@ Public Class dlgSummaryTables

Private Sub ucrPnlSummaryFrequencyTables_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlSummaryFrequencyTables.ControlValueChanged
cmdSummaries.Visible = rdoSummaryTable.Checked
cmdFormatTable.Location = New Point(286, If(rdoSummaryTable.Checked, 464, 273))

DialogueSize()
SettingParameters()
Expand Down
15 changes: 3 additions & 12 deletions instat/static/InstatObject/R/data_object_R6.R
Original file line number Diff line number Diff line change
Expand Up @@ -1567,19 +1567,10 @@ DataSheet$set("public", "sort_dataframe", function(col_names = c(), decreasing =
message("No sorting to be done.")
}
} else {
# Build the expressions using rlang for sorting columns
col_names_exp <- purrr::map(col_names, function(col_name) {
if (!(col_name %in% names(curr_data))) {
stop(col_name, " is not a column in the data.")
}
if (decreasing) dplyr::desc(rlang::sym(col_name)) else rlang::sym(col_name)
})

# Handle the case where sorting by row names and column names at the same time
if (by_row_names) warning("Cannot sort by columns and row names. Sorting will be done by given columns only.")

# Sort the data based on the expressions
self$set_data(dplyr::arrange(curr_data, !!!col_names_exp))
if (decreasing) self$set_data(dplyr::arrange(curr_data, dplyr::across(dplyr::all_of(col_names), desc)))
else self$set_data(dplyr::arrange(curr_data, dplyr::across(dplyr::all_of(col_names))))
}
self$data_changed <- TRUE
}
Expand Down
Loading