From 1d65fa4105824808481dc57f310475c55c6f66ca Mon Sep 17 00:00:00 2001 From: patowhiz Date: Thu, 7 Apr 2022 14:14:37 +0300 Subject: [PATCH 1/5] Contains translation changes for the dialog --- instat/translations/rInstatTranslations.db | Bin 4849664 -> 4849664 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/instat/translations/rInstatTranslations.db b/instat/translations/rInstatTranslations.db index f5be91b6a18afa866816851fe8def01b3a80faff..28831b6b25b37cb1058cf3c1f8326b4a180f1ccd 100644 GIT binary patch delta 529 zcmYk%y-!n79LDjUdr!GmutnuXN`b2uFXiA1sE7zHN)?TXgE}xkavB6e(r_Cou-4&* zwS?g$7=oJAxH!s*e}ZvhbTPy@JGkoLm(Ag`Jo!CO@~hQ8I5pI}MYx@r7U3%$X%T5B z(r%<>q~nop`lP-0p?G7wiucTE^37bu^JUz|vgYuQO55Fv*AsVQG4pxdTb8~Ig5$h< ztFYnW1QIxjX0+fGl1QNyr*Q^n(S~+(pcCiNg*1*gGw4At`rzX{F5n`v=*J}l7(fn# zwy>eTbvbUyr0c5Bt+#x%6LmEz9Cy}Mx7AP4D!<1P!F=b7@=&9VFLLJXftzkGu2;${ z3#IC!|1{iO%Qvzzc$_n0NA;Sczbct5hEKxk^OvR7wK7Nca7SgN7`MNSdhLk7q<(kI z+8?{>tMFzT{W6&UuWOpW#1rOVYAh+28Y9xCCiCx{t-XDPAza24T*WmEV+7Z612-{> jTNuM_jN=X_Fo`@0n8ID$!!(Mxj|Z5+L%X;CXhHu2>HWks delta 487 zcmYMsyGue*0LSrru1Bx-(4Lm2scGHn^e(lRTG_j?#i8IpP?Kq3O$|0&+`?!$^bjF1 z`Um3B-_X?95)#b~tu^$srQx%DfAGuaAJjY)yGZ)NlO*XgZg667)!-(BQ-hlgZh7R| zeTJM0Evs#-%Bk4NYJM7|`mlKUW^Q?%)x2ia;ulZH+5uG*B~a^Kg~W*lRJPJv>MgU?Co{)~xo{;!^{xNO{8#16 zCG${Xm7jv$sN_gEzMLufe$AeVIKN?=biXn|r6U%5a%geeF^ k1fnnvGcXHtFb^?^Ljo3H5tbkc%di5gum Date: Sat, 16 Apr 2022 12:31:12 +0300 Subject: [PATCH 2/5] makes columns unique --- instat/static/InstatObject/R/data_object_R6.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index 8364ada5e3d..726a4f345da 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -145,9 +145,9 @@ DataSheet$set("public", "set_data", function(new_data, messages=TRUE, check_name if(check_names) { # "T" should be avoided as a column name but is not checked by make.names() if("T" %in% names(new_data)) names(new_data)[names(new_data) == "T"] <- ".T" - valid_names <- make.names(iconv(names(new_data), to = "ASCII//TRANSLIT", sub = ".")) + valid_names <- make.names(iconv(names(new_data), to = "ASCII//TRANSLIT", sub = "."), unique = TRUE) if(!all(names(new_data) == valid_names)) { - warning("Not all column names are syntactically valid. make.names() and iconv() will be used to force them to be valid.") + warning("Not all column names are syntactically valid or unique. make.names() and iconv() will be used to force them to be valid and unique.") names(new_data) <- valid_names } } From 34e9c3abbb750971c1f08c9a7be8316f71add62e Mon Sep 17 00:00:00 2001 From: Antoine Ntalumeso Date: Sat, 16 Apr 2022 20:43:13 +0200 Subject: [PATCH 3/5] Minor code change --- instat/dlgMergeAdditionalData.vb | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/instat/dlgMergeAdditionalData.vb b/instat/dlgMergeAdditionalData.vb index 030ce96efad..552120ec9a2 100644 --- a/instat/dlgMergeAdditionalData.vb +++ b/instat/dlgMergeAdditionalData.vb @@ -20,7 +20,7 @@ Imports RDotNet Public Class dlgMergeAdditionalData Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsInsertColumnFunction, clsGetColumnsFromData As New RFunction + Private clsInsertColumnFunction, clsGetColumnsFromData, clsImportDataFunction, clsListFunction As New RFunction Private lstJoinColumns As New List(Of String) Private clsLeftJoinFunction As New RFunction Private clsByListFunction As New RFunction @@ -72,6 +72,8 @@ Public Class dlgMergeAdditionalData clsInsertColumnFunction = New RFunction clsGetColumnsFromData = New RFunction clsGetVariablesFunction = New RFunction + clsImportDataFunction = New RFunction + clsListFunction = New RFunction ucrToDataFrame.Reset() ucrFromDataFrame.Reset() @@ -79,6 +81,11 @@ Public Class dlgMergeAdditionalData ucrInputSaveDataFrame.SetName("merge") ucrInputCheckInput.Reset() + clsImportDataFunction.SetRCommand("data_book$import_data") + clsImportDataFunction.AddParameter("data_tables", clsRFunctionParameter:=clsListFunction) + + clsListFunction.SetRCommand("list") + clsGetVariablesFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") clsLeftJoinFunction.SetPackageName("dplyr") @@ -92,9 +99,8 @@ Public Class dlgMergeAdditionalData clsInsertColumnFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") - SetDataFrameAssign() - ucrBase.clsRsyntax.SetBaseRFunction(clsInsertColumnFunction) + ucrBase.clsRsyntax.SetBaseRFunction(clsImportDataFunction) bResetSubdialog = True End Sub @@ -144,10 +150,10 @@ Public Class dlgMergeAdditionalData cmdCheckUnique.Visible = False SetInputCheckVisibility(False) Else + clsListFunction.ClearParameters() clsLeftJoinFunction.SetAssignTo(ucrToDataFrame.cboAvailableDataFrames.Text) - clsInsertColumnFunction.AddParameter("data_name", Chr(34) & ucrToDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) - clsInsertColumnFunction.AddParameter("col_data", clsRFunctionParameter:=clsLeftJoinFunction, iPosition:=1) - ucrBase.clsRsyntax.SetBaseRFunction(clsInsertColumnFunction) + clsListFunction.AddParameter(ucrToDataFrame.cboAvailableDataFrames.Text, clsRFunctionParameter:=clsLeftJoinFunction, iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsImportDataFunction) ucrInputSaveDataFrame.Visible = False cmdCheckUnique.Visible = True End If From a688114c87abad1363801464aeaa917a33fa47f7 Mon Sep 17 00:00:00 2001 From: Antoine Ntalumeso Date: Sun, 17 Apr 2022 09:16:41 +0200 Subject: [PATCH 4/5] Minor bug fix --- instat/dlgMergeAdditionalData.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/dlgMergeAdditionalData.vb b/instat/dlgMergeAdditionalData.vb index 552120ec9a2..b112dcfe9ee 100644 --- a/instat/dlgMergeAdditionalData.vb +++ b/instat/dlgMergeAdditionalData.vb @@ -45,7 +45,7 @@ Public Class dlgMergeAdditionalData End Sub Private Sub InitialiseDialog() - ucrToDataFrame.SetParameter(New RParameter("y", 1)) + ucrToDataFrame.SetParameter(New RParameter("x", 0)) ucrToDataFrame.SetParameterIsRFunction() ucrToDataFrame.SetLabelText("To Data Frame:") @@ -90,7 +90,7 @@ Public Class dlgMergeAdditionalData clsLeftJoinFunction.SetPackageName("dplyr") clsLeftJoinFunction.SetRCommand("left_join") - clsLeftJoinFunction.AddParameter("x", clsRFunctionParameter:=clsGetColumnsFromData, iPosition:=0) + clsLeftJoinFunction.AddParameter("y", clsRFunctionParameter:=clsGetColumnsFromData, iPosition:=1) clsByListFunction.SetRCommand("c") From 5f8d047fc7d6c135206ef275a7348034f37f3de5 Mon Sep 17 00:00:00 2001 From: Antoine Ntalumeso Date: Sun, 17 Apr 2022 09:25:27 +0200 Subject: [PATCH 5/5] Cleaned the codes --- instat/dlgMergeAdditionalData.vb | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/instat/dlgMergeAdditionalData.vb b/instat/dlgMergeAdditionalData.vb index b112dcfe9ee..610ad7becc7 100644 --- a/instat/dlgMergeAdditionalData.vb +++ b/instat/dlgMergeAdditionalData.vb @@ -20,7 +20,7 @@ Imports RDotNet Public Class dlgMergeAdditionalData Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsInsertColumnFunction, clsGetColumnsFromData, clsImportDataFunction, clsListFunction As New RFunction + Private clsInsertColumnFunction, clsGetColumnsFromData As New RFunction Private lstJoinColumns As New List(Of String) Private clsLeftJoinFunction As New RFunction Private clsByListFunction As New RFunction @@ -72,8 +72,6 @@ Public Class dlgMergeAdditionalData clsInsertColumnFunction = New RFunction clsGetColumnsFromData = New RFunction clsGetVariablesFunction = New RFunction - clsImportDataFunction = New RFunction - clsListFunction = New RFunction ucrToDataFrame.Reset() ucrFromDataFrame.Reset() @@ -81,11 +79,6 @@ Public Class dlgMergeAdditionalData ucrInputSaveDataFrame.SetName("merge") ucrInputCheckInput.Reset() - clsImportDataFunction.SetRCommand("data_book$import_data") - clsImportDataFunction.AddParameter("data_tables", clsRFunctionParameter:=clsListFunction) - - clsListFunction.SetRCommand("list") - clsGetVariablesFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") clsLeftJoinFunction.SetPackageName("dplyr") @@ -100,7 +93,7 @@ Public Class dlgMergeAdditionalData clsInsertColumnFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") SetDataFrameAssign() - ucrBase.clsRsyntax.SetBaseRFunction(clsImportDataFunction) + ucrBase.clsRsyntax.SetBaseRFunction(clsInsertColumnFunction) bResetSubdialog = True End Sub @@ -150,10 +143,10 @@ Public Class dlgMergeAdditionalData cmdCheckUnique.Visible = False SetInputCheckVisibility(False) Else - clsListFunction.ClearParameters() clsLeftJoinFunction.SetAssignTo(ucrToDataFrame.cboAvailableDataFrames.Text) - clsListFunction.AddParameter(ucrToDataFrame.cboAvailableDataFrames.Text, clsRFunctionParameter:=clsLeftJoinFunction, iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsImportDataFunction) + clsInsertColumnFunction.AddParameter("data_name", Chr(34) & ucrToDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsInsertColumnFunction.AddParameter("col_data", clsRFunctionParameter:=clsLeftJoinFunction, iPosition:=1) + ucrBase.clsRsyntax.SetBaseRFunction(clsInsertColumnFunction) ucrInputSaveDataFrame.Visible = False cmdCheckUnique.Visible = True End If