Skip to content

Commit

Permalink
Merge pull request #314 from IDEMSInternational/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
Vitalis95 authored Jan 27, 2025
2 parents 93411cb + 830680e commit b8b7978
Show file tree
Hide file tree
Showing 21 changed files with 930 additions and 686 deletions.
4 changes: 2 additions & 2 deletions inno_install_script_64bit.iss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppVersion= {#GetStringFileInfo("instat\bin\x64\Release\instat.exe", "FileVersion")}
AppId={{5455FC1A-85BE-4679-B600-8A1A4FC3CDD9-{#SetupSetting("AppVersion")}}
AppName=R-Instat
AppVerName ={code:GetShortAppVersion|{#SetupSetting("AppVersion")}}
AppName=R-Instat {#SetupSetting("AppVersion")}
AppVerName =R-Instat {#SetupSetting("AppVersion")}

AppPublisher=African Maths Initiative
AppPublisherURL=http://r-instat.org/
Expand Down
2 changes: 1 addition & 1 deletion instat/Model/DataFrame/clsDataFramePage.vb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ Public Class clsDataFramePage

Dim strDisable As String = If(bDisable, "TRUE", "FALSE")
clsEnableDisableUndoRFunction.AddParameter("disable_undo", strDisable)
_clsRLink.RunScript(clsEnableDisableUndoRFunction.ToScript)
_clsRLink.RunScript(clsEnableDisableUndoRFunction.ToScript, bSkipScriptAndOutput:=True)

End Sub

Expand Down
2 changes: 1 addition & 1 deletion instat/Model/RCommand/clsPrepareFunctionsForGrids.vb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Public Class clsPrepareFunctionsForGrids
clsViewDataFrame.AddParameter("x", clsRFunctionParameter:=clsGetDataFrame)
clsGetDataFrame.SetAssignTo(_strDataFrame)
strTemp = clsViewDataFrame.ToScript(strScript)
_RLink.RunScript(strScript & strTemp, strComment:="Right click menu: View R Data Frame", bSeparateThread:=False)
_RLink.RunScript(strScript & strTemp, strComment:="Toolbar Option: View R Data Frame", bSeparateThread:=False)
End Sub
''' <summary>
''' insert new rows
Expand Down
9 changes: 6 additions & 3 deletions instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,8 @@ Public Class RLink
Optional bSeparateThread As Boolean = True,
Optional bShowWaitDialogOverride As Nullable(Of Boolean) = Nothing,
Optional bUpdateGrids As Boolean = True,
Optional bSilent As Boolean = False)
Optional bSilent As Boolean = False,
Optional bSkipScriptAndOutput As Boolean = False)

'if there is no script to run then just ignore and exit sub
If String.IsNullOrWhiteSpace(strScript) Then
Expand Down Expand Up @@ -999,8 +1000,10 @@ Public Class RLink
End If
End If

' If strOutput is empty or does not contain valid HTML files, add strOutput itself as an output
clsOutputLogger.AddOutput(strScriptWithComment, strOutput, bAsFile, bDisplayOutputInExternalViewer)
If Not bSkipScriptAndOutput Then
' 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
Expand Down
27 changes: 25 additions & 2 deletions instat/dlgName.vb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Public Class dlgName
Private clsStartwithFunction, clsRegexFunction, clsEndswithFunction, clsMatchesFunction, clsContainsFunction As New RFunction
Private WithEvents grdCurrentWorkSheet As Worksheet
Private dctRowsNewNameChanged As New Dictionary(Of Integer, String)
Private dctRowsCurrentName As New Dictionary(Of Integer, String)
Private dctRowsNewLabelChanged As New Dictionary(Of Integer, String)
Private dctNameRowsValues As New Dictionary(Of Integer, String)
Private dctCaseOptions As New Dictionary(Of String, String)
Expand Down Expand Up @@ -99,7 +100,7 @@ Public Class dlgName
ucrPnlCase.AddRadioButton(rdoAbbreviate, "abbreviate")
ucrPnlCase.AddRadioButton(rdoReplace, "stringr::str_replace")

ucrPnlSelectData.SetParameter(New RParameter("data", 0))

ucrPnlSelectData.AddRadioButton(rdoWholeDataFrame)
ucrPnlSelectData.AddRadioButton(rdoSelectedColumn)
ucrPnlSelectData.AddParameterValuesCondition(rdoWholeDataFrame, "checked", "whole")
Expand Down Expand Up @@ -189,6 +190,7 @@ Public Class dlgName
ucrSelectVariables.Reset()
dctRowsNewNameChanged.Clear()
dctRowsNewLabelChanged.Clear()
dctRowsCurrentName.Clear()
bCurrentCell = False
clsNewColNameDataframeFunction.SetRCommand("data.frame")

Expand Down Expand Up @@ -353,10 +355,14 @@ Public Class dlgName
If e.Range.Rows > 1 Then
For iRow As Integer = iStartRowIndex To grdCurrentWorkSheet.SelectionRange.EndRow
Dim strNewData As String = ValidateRVariable(grdCurrentWorkSheet.GetCellData(row:=iRow, col:=iColIndex), iColIndex)
Dim strOldData As String = grdCurrentWorkSheet.GetCellData(row:=iRow, col:=0)
GetOldNames(iRow, strOldData)
RenameColumns(strNewData, iRow, iColIndex)
Next
Else
Dim strNewData As String = ValidateRVariable(grdCurrentWorkSheet.GetCellData(row:=e.Range.Row, col:=iColIndex), iColIndex)
Dim strOldData As String = grdCurrentWorkSheet.GetCellData(row:=e.Range.Row, col:=0)
GetOldNames(e.Range.Row, strOldData)
RenameColumns(strNewData, iStartRowIndex, iColIndex)
End If
ValidateNamesFromDictionary(iColIndex)
Expand Down Expand Up @@ -406,18 +412,30 @@ Public Class dlgName
Private Sub grdCurrSheet_AfterCellEdit(sender As Object, e As CellAfterEditEventArgs) Handles grdCurrentWorkSheet.AfterCellEdit
Dim iCol As Integer = e.Cell.Column
Dim strNewData As String = ValidateRVariable(e.NewData, iCol)

Dim strFirstColumnData As String = grdCurrentWorkSheet(e.Cell.Row, 0).ToString()

GetOldNames(e.Cell.Row, strFirstColumnData)
RenameColumns(strNewData, e.Cell.Row, iCol)
ValidateNamesFromDictionary(iCol)
End Sub

Private Sub GetOldNames(iRow As Integer, strOldName As String)
If Not dctRowsCurrentName.ContainsKey(iRow) Then
dctRowsCurrentName.Add(iRow, strOldName)
Else
dctRowsCurrentName(iRow) = strOldName
End If
End Sub

Private Sub GetVariables(strNewData As String, iRowIndex As Integer, iColIndex As Integer)
If rdoMultiple.Checked Then
If iColIndex = 1 Then
If strNewData <> "" Then
AddChangedNewNameRows(iRowIndex, strNewData)

clsNewColNameDataframeFunction.AddParameter("cols", GetValuesAsVector(dctRowsNewNameChanged), iPosition:=0)
clsNewColNameDataframeFunction.AddParameter("index", "c(" & String.Join(",", dctRowsNewNameChanged.Keys.ToArray) & ")", iPosition:=1)
clsNewColNameDataframeFunction.AddParameter("old_names", GetValuesAsVector(dctRowsCurrentName), iPosition:=1)
clsDefaultRFunction.AddParameter("new_column_names_df", clsRFunctionParameter:=clsNewColNameDataframeFunction, iPosition:=8)
Else
clsNewColNameDataframeFunction.RemoveParameterByName("cols")
Expand Down Expand Up @@ -602,7 +620,9 @@ Public Class dlgName
rdoReplace.Visible = rdoWholeDataFrame.Checked
If rdoWholeDataFrame.Checked Then
ucrReceiverColumns.Visible = False
clsDummyFunction.AddParameter("checked", "whole", iPosition:=1)
Else
clsDummyFunction.AddParameter("checked", "selected", iPosition:=1)
ucrReceiverColumns.SetMeAsReceiver()
If rdoReplace.Checked Then
rdoMakeCleanNames.Checked = True
Expand Down Expand Up @@ -681,6 +701,8 @@ Public Class dlgName
Dim parsedValue As Boolean
Dim strNewData As String = ValidateRVariable(e.Text, iCol)
If Not strNewData.ToLower.Equals("t") AndAlso Not strNewData.ToLower.Equals("f") AndAlso Not IsNumeric(strNewData) AndAlso Not Boolean.TryParse(strNewData, parsedValue) Then
Dim strFirstColumnData As String = grdCurrentWorkSheet(e.Cell.Row, 0).ToString()
GetOldNames(e.Cell.Row, strFirstColumnData)
RenameColumns(strNewData, e.Cell.Row, iCol)
ValidateNamesFromDictionary(iCol)
End If
Expand Down Expand Up @@ -713,6 +735,7 @@ Public Class dlgName
clsDefaultRFunction.AddParameter(".cols", clsRFunctionParameter:=clsContainsFunction, iPosition:=3)
clsDefaultRFunction.AddParameter(".fn", "stringr::str_replace_all", iPosition:=2)
End Select

Else
clsDefaultRFunction.RemoveParameterByName("replacement")
clsDefaultRFunction.RemoveParameterByName(".cols")
Expand Down
Loading

0 comments on commit b8b7978

Please sign in to comment.