Skip to content

Commit

Permalink
Merge pull request #1498 from stevekogo/PCA
Browse files Browse the repository at this point in the history
Fixing PCA and CCA dialogues
  • Loading branch information
dannyparsons authored Jun 23, 2016
2 parents 8eab643 + 819df4b commit 941730f
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 37 deletions.
22 changes: 12 additions & 10 deletions instat/dlgCanonicalCorrelationAnalysis.Designer.vb

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

8 changes: 6 additions & 2 deletions instat/dlgCanonicalCorrelationAnalysis.vb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ Public Class dlgCanonicalCorrelationAnalysis
End If
End Sub

Private Sub ucrSelectorCCA_DataFrameChanged() Handles ucrSelectorCCA.DataFrameChanged
AssignName()
End Sub

Private Sub ucrBaseCCA_ClickReset(sender As Object, e As EventArgs) Handles ucrBaseCCA.ClickReset
SetDefaults()
End Sub
Expand Down Expand Up @@ -97,11 +101,11 @@ Public Class dlgCanonicalCorrelationAnalysis

Public Sub AssignName()
If chkSaveResult.Checked AndAlso ucrResultName.GetText() <> "" Then
ucrBaseCCA.clsRsyntax.SetAssignTo(ucrResultName.GetText(), strTempModel:=ucrResultName.GetText())
ucrBaseCCA.clsRsyntax.SetAssignTo(ucrResultName.GetText(), strTempModel:=ucrResultName.GetText(), strTempDataframe:=ucrSelectorCCA.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem)
ucrBaseCCA.clsRsyntax.bExcludeAssignedFunctionOutput = False
strModelName = ucrResultName.GetText()
Else
ucrBaseCCA.clsRsyntax.SetAssignTo("last_CCA", strTempModel:="last_CCA")
ucrBaseCCA.clsRsyntax.SetAssignTo("last_CCA", strTempModel:="last_CCA", strTempDataframe:=ucrSelectorCCA.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem)
ucrBaseCCA.clsRsyntax.bExcludeAssignedFunctionOutput = False
strModelName = "last_CCA"
End If
Expand Down
36 changes: 19 additions & 17 deletions instat/dlgPrincipalComponentAnalysis.Designer.vb

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

16 changes: 10 additions & 6 deletions instat/dlgPrincipalComponentAnalysis.vb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Public Class dlgPrincipalComponentAnalysis
ucrReceiverMultiplePCA.Selector = ucrSelectorPCA
ucrReceiverMultiplePCA.SetDataType("numeric")
ucrResultName.SetDefaultTypeAsModel()
ucrResultName.SetPrefix("PCA")

ucrBasePCA.iHelpTopicID = 187
End Sub

Expand All @@ -53,6 +53,7 @@ Public Class dlgPrincipalComponentAnalysis
ucrResultName.Visible = True
chkScaleData.Checked = True
ucrBasePCA.clsRsyntax.AddParameter("graph", "FALSE")
ucrResultName.SetName("PCA")
sdgPrincipalComponentAnalysis.SetDefaults()
TestOKEnabled()
End Sub
Expand All @@ -66,6 +67,10 @@ Public Class dlgPrincipalComponentAnalysis
End If
End Sub

Private Sub ucrSelectorPCA_DataFrameChanged() Handles ucrSelectorPCA.DataFrameChanged
AssignName()
End Sub

Private Sub ucrBasePCA_ClickReset(sender As Object, e As EventArgs) Handles ucrBasePCA.ClickReset
SetDefaults()
End Sub
Expand Down Expand Up @@ -97,7 +102,7 @@ Public Class dlgPrincipalComponentAnalysis
sdgPrincipalComponentAnalysis.ShowDialog()
End Sub

Private Sub ucrResultName_NameChanged() Handles ucrResultName.NameChanged
Private Sub ucrResultName_NameChanged()
AssignName()
End Sub

Expand All @@ -112,11 +117,12 @@ Public Class dlgPrincipalComponentAnalysis

Private Sub AssignName()
If chkSaveResult.Checked AndAlso ucrResultName.GetText() <> "" Then
ucrBasePCA.clsRsyntax.SetAssignTo(ucrResultName.GetText(), strTempModel:=ucrResultName.GetText())
ucrBasePCA.clsRsyntax.SetAssignTo(ucrResultName.GetText(), strTempModel:=ucrResultName.GetText(), strTempDataframe:=ucrSelectorPCA.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem)
ucrBasePCA.clsRsyntax.bExcludeAssignedFunctionOutput = False
strModelName = ucrResultName.GetText()
Else
ucrBasePCA.clsRsyntax.SetAssignTo("last_PCA", strTempModel:="last_PCA")
ucrBasePCA.clsRsyntax.SetAssignTo("last_PCA", strTempModel:="last_PCA", strTempDataframe:=ucrSelectorPCA.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem)
ucrBasePCA.clsRsyntax.bExcludeAssignedFunctionOutput = False
ucrBasePCA.clsRsyntax.bExcludeAssignedFunctionOutput = False
strModelName = "last_PCA"
End If
Expand All @@ -125,6 +131,4 @@ Public Class dlgPrincipalComponentAnalysis
Private Sub ucrBasePCA_clickok(sender As Object, e As EventArgs) Handles ucrBasePCA.ClickOk
sdgPrincipalComponentAnalysis.PCAOptions()
End Sub


End Class
3 changes: 2 additions & 1 deletion instat/sdgCanonicalCorrelation.vb
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ Public Class sdgCanonicalCorrelation

Private Sub Cancor()
clsRCanCor.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_from_model")
clsRCanCor.AddParameter("data_name", Chr(34) & dlgCanonicalCorrelationAnalysis.ucrSelectorCCA.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34))
clsRCanCor.AddParameter("model_name", Chr(34) & dlgCanonicalCorrelationAnalysis.strModelName & Chr(34))
clsRCanCor.AddParameter("value1", Chr(34) & "cancor" & Chr(34))
frmMain.clsRLink.RunScript(clsRCanCor.ToScript(), 2)
End Sub

Private Sub Coef()
clsRCoef.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_from_model")
clsRCoef.AddParameter("data_name", Chr(34) & dlgCanonicalCorrelationAnalysis.ucrSelectorCCA.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34))
clsRCoef.AddParameter("model_name", Chr(34) & dlgCanonicalCorrelationAnalysis.strModelName & Chr(34))
clsRCoef.AddParameter("value1", Chr(34) & "coef" & Chr(34))
frmMain.clsRLink.RunScript(clsRCoef.ToScript(), 2)
Expand Down Expand Up @@ -96,5 +98,4 @@ Public Class sdgCanonicalCorrelation
clsRGraphics.RemoveParameter("columns")
End If
End Sub

End Class
3 changes: 3 additions & 0 deletions instat/sdgPrincipalComponentAnalysis.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ Public Class sdgPrincipalComponentAnalysis

Private Sub EigenValues()
clsREigenValues.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_from_model")
clsREigenValues.AddParameter("data_name", Chr(34) & dlgPrincipalComponentAnalysis.ucrSelectorPCA.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34))
clsREigenValues.AddParameter("model_name", Chr(34) & dlgPrincipalComponentAnalysis.strModelName & Chr(34))
clsREigenValues.AddParameter("value1", Chr(34) & "eig" & Chr(34))
frmMain.clsRLink.RunScript(clsREigenValues.ToScript(), 2)
End Sub

Private Sub EigenVectors()
clsREigenVectors.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_from_model")
clsREigenVectors.AddParameter("data_name", Chr(34) & dlgPrincipalComponentAnalysis.ucrSelectorPCA.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34))
clsREigenVectors.AddParameter("model_name", Chr(34) & dlgPrincipalComponentAnalysis.strModelName & Chr(34))
clsREigenVectors.AddParameter("value1", Chr(34) & "ind" & Chr(34))
clsREigenVectors.AddParameter("value2", Chr(34) & "contrib" & Chr(34))
Expand All @@ -46,6 +48,7 @@ Public Class sdgPrincipalComponentAnalysis

Private Sub Scores()
clsRScores.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_from_model")
clsRScores.AddParameter("data_name", Chr(34) & dlgPrincipalComponentAnalysis.ucrSelectorPCA.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34))
clsRScores.AddParameter("model_name", Chr(34) & dlgPrincipalComponentAnalysis.strModelName & Chr(34))
clsRScores.AddParameter("value1", Chr(34) & "ind" & Chr(34))
clsRScores.AddParameter("value2", Chr(34) & "coord" & Chr(34))
Expand Down
2 changes: 1 addition & 1 deletion instat/static/InstatObject/R/instat_object_R6.R
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ instat_object$set("public", "get_objects", function(data_name, object_name, incl
else out = curr_objects
}
else out = self$get_data_objects(data_name)$get_objects(object_name = object_name, type = type)
if(as_list) {
if(as_list) {
lst = list()
lst[[data_name]][[object_name]] <- out
return(lst)
Expand Down

0 comments on commit 941730f

Please sign in to comment.