Skip to content

Commit

Permalink
Merge pull request #208 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
Pulling the latest from Main
  • Loading branch information
deaspo authored Jun 23, 2016
2 parents 98ce0d2 + 941730f commit 04849d6
Show file tree
Hide file tree
Showing 60 changed files with 1,402 additions and 559 deletions.
67 changes: 40 additions & 27 deletions instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,19 @@ Public Class RLink
Dim strNextDefault As String = ""
Dim clsGetDefault As New RFunction
Dim strExistingNames As String
Dim expPrefix As SymbolicExpression

clsGetDefault.SetRCommand("next_default_item")
clsGetDefault.AddParameter("prefix", Chr(34) & strPrefix & Chr(34))
strExistingNames = GetListAsRString(lstItems)
If strExistingNames <> "" Then
clsGetDefault.AddParameter("existing_names", GetListAsRString(lstItems))
End If
Return RunInternalScriptGetValue(clsGetDefault.ToScript()).AsCharacter(0)
expPrefix = RunInternalScriptGetValue(clsGetDefault.ToScript())
If Not expPrefix.Type = Internals.SymbolicExpressionType.Null Then
strNextDefault = expPrefix.AsCharacter(0)
End If
Return strNextDefault
End Function

Public Sub RunScript(strScript As String, Optional bReturnOutput As Integer = 0, Optional strComment As String = "")
Expand Down Expand Up @@ -428,14 +433,13 @@ Public Class RLink
End If
End Sub

Public Sub SelectColumnsWithMetadataProperty(lstView As ListView, strDataFrameName As String, strProperty As String, strValues As String())
Public Sub SelectColumnsWithMetadataProperty(ucrCurrentReceiver As ucrReceiverMultiple, strDataFrameName As String, strProperty As String, strValues As String())
Dim vecColumns As GenericVector
Dim chrCurrColumns As CharacterVector
Dim i, j, iTemp As Integer
Dim i As Integer
Dim clsGetItems As New RFunction
Dim clsIncludeList As New RFunction
Dim kvpInclude As KeyValuePair(Of String, String())
Dim lviTemp As ListViewItem

kvpInclude = New KeyValuePair(Of String, String())(strProperty, strValues)

Expand All @@ -449,19 +453,10 @@ Public Class RLink
clsIncludeList.AddParameter(kvpInclude.Key, GetListAsRString(kvpInclude.Value.ToList(), bWithQuotes:=False))
clsGetItems.AddParameter("include", clsRFunctionParameter:=clsIncludeList)
vecColumns = RunInternalScriptGetValue(clsGetItems.ToScript()).AsList

ucrCurrentReceiver.Clear()
For i = 0 To vecColumns.Count - 1
chrCurrColumns = vecColumns(i).AsCharacter
lstView.BeginUpdate()
For j = 0 To chrCurrColumns.Count - 1
For Each lviTemp In lstView.Items
If lviTemp.Text = chrCurrColumns(j) Then
lviTemp.Selected = True
Exit For
End If
Next
Next
lstView.EndUpdate()
ucrCurrentReceiver.Add(chrCurrColumns.ToArray())
Next
End If
End Sub
Expand Down Expand Up @@ -510,26 +505,40 @@ Public Class RLink
Return intColumnCount
End Function

Public Function GetModelNames() As List(Of String)
Public Function GetModelNames(Optional strDataFrameName As String = "") As List(Of String)
Dim chrModelNames As CharacterVector
Dim lstModelNames As New List(Of String)
chrModelNames = clsEngine.Evaluate(frmMain.clsRLink.strInstatDataObject & "$get_model_names()").AsCharacter
If chrModelNames IsNot Nothing Then
lstModelNames.AddRange(chrModelNames)
Dim clsGetModelNames As New RFunction
Dim expModelNames As SymbolicExpression

clsGetModelNames.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_model_names")
If strDataFrameName <> "" Then
clsGetModelNames.AddParameter("data_name", Chr(34) & strDataFrameName & Chr(34))
End If
expModelNames = RunInternalScriptGetValue(clsGetModelNames.ToScript())
If Not expModelNames.Type = Internals.SymbolicExpressionType.Null Then
chrModelNames = expModelNames.AsCharacter()
If chrModelNames.Length > 0 Then
lstModelNames.AddRange(chrModelNames)
End If
End If
Return lstModelNames
End Function

Public Function GetFilterNames(strDataFrameName As String) As List(Of String)
Dim expFilterNames As SymbolicExpression
Dim chrFilterNames As CharacterVector
Dim lstFilterNames As New List(Of String)
Dim clsGetFilterNames As New RFunction

clsGetFilterNames.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_filter_names")
clsGetFilterNames.AddParameter("data_name", Chr(34) & strDataFrameName & Chr(34))
chrFilterNames = RunInternalScriptGetValue(clsGetFilterNames.ToScript()).AsCharacter
If chrFilterNames IsNot Nothing Then
lstFilterNames.AddRange(chrFilterNames)
expFilterNames = RunInternalScriptGetValue(clsGetFilterNames.ToScript())
If Not expFilterNames.Type = Internals.SymbolicExpressionType.Null Then
chrFilterNames = expFilterNames.AsCharacter()
If chrFilterNames.Length > 0 Then
lstFilterNames.AddRange(chrFilterNames)
End If
End If
Return lstFilterNames
End Function
Expand All @@ -538,22 +547,26 @@ Public Class RLink
Dim chrGraphNames As CharacterVector
Dim lstGraphNames As New List(Of String)
Dim clsGetGraphNames As New RFunction
Dim expGraphNames As SymbolicExpression

clsGetGraphNames.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_graph_names")
If strDataFrameName <> "" Then
clsGetGraphNames.AddParameter("data_name", Chr(34) & strDataFrameName & Chr(34))
End If
chrGraphNames = RunInternalScriptGetValue(clsGetGraphNames.ToScript()).AsCharacter
If chrGraphNames IsNot Nothing Then
lstGraphNames.AddRange(chrGraphNames)
expGraphNames = RunInternalScriptGetValue(clsGetGraphNames.ToScript())
If Not expGraphNames.Type = Internals.SymbolicExpressionType.Null Then
chrGraphNames = expGraphNames.AsCharacter()
If chrGraphNames.Length > 0 Then
lstGraphNames.AddRange(chrGraphNames)
End If
End If
Return lstGraphNames
End Function

Public Function GetDataType(strDataFrameName As String, strColumnName As String) As String
Dim strDataType As CharacterVector
strDataType = clsEngine.Evaluate(frmMain.clsRLink.strInstatDataObject & "$get_data_type(data_name = " & Chr(34) & strDataFrameName & Chr(34) & ",col_name=" & Chr(34) & strColumnName & Chr(34) & ")").AsCharacter
strDataType = RunInternalScriptGetValue(frmMain.clsRLink.strInstatDataObject & "$get_data_type(data_name = " & Chr(34) & strDataFrameName & Chr(34) & ",col_name=" & Chr(34) & strColumnName & Chr(34) & ")").AsCharacter
Return strDataType(0)
End Function

End Class
End Class
13 changes: 9 additions & 4 deletions instat/clsROperator.vb
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,15 @@ Public Class ROperator
clsTempROperator.bForceIncludeOperation = bForceIncludeOperation
clsTempROperator.bAssignToIsPrefix = bAssignToIsPrefix

clsTempROperator.clsLeftFunction = clsLeftFunction.Clone
clsTempROperator.clsLeftOperator = clsLeftOperator.Clone
clsTempROperator.clsLeftParameter = clsLeftParameter.Clone

If clsLeftFunction IsNot Nothing Then
clsTempROperator.clsLeftFunction = clsLeftFunction.Clone
End If
If clsLeftOperator IsNot Nothing Then
clsTempROperator.clsLeftOperator = clsLeftOperator.Clone
End If
If clsLeftParameter IsNot Nothing Then
clsTempROperator.clsLeftParameter = clsLeftParameter.Clone
End If
For Each clsAdditionalParams In clsAdditionalParameters
clsTempROperator.AddAdditionalParameter(clsAdditionalParams.Clone)
Next
Expand Down
3 changes: 3 additions & 0 deletions instat/clsRecentFiles.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Public Class clsRecentFiles

End Class
4 changes: 2 additions & 2 deletions instat/dlgBarAndPieChart.Designer.vb

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

11 changes: 5 additions & 6 deletions instat/dlgBarAndPieChart.vb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ Public Class dlgBarAndPieChart
ucrBarChartSelector.Reset()
ucrBarChartSelector.Focus()
ucrFactorReceiver.SetMeAsReceiver()
'TODO These will be replaced by sdgLayerOptions
'set subdialog defaults
'sdgBarChart.SetDefaults()
'sdgPieChartOptions.SetDefaults()
End Sub
Private Sub InitialiseDialog()
ucrBase.clsRsyntax.SetOperation("+")
Expand All @@ -65,7 +61,7 @@ Public Class dlgBarAndPieChart


ucrSaveBar.SetDataFrameSelector(ucrBarChartSelector.ucrAvailableDataFrames)
ucrSaveBar.strPrefix = "Graph"
'ucrSaveBar.strPrefix = "Graph"
ucrSaveBar.ucrInputGraphName.SetItemsTypeAsGraphs()
ucrSaveBar.ucrInputGraphName.SetDefaultTypeAsGraph()
End Sub
Expand All @@ -74,7 +70,7 @@ Public Class dlgBarAndPieChart
End Sub

Public Sub TestOKEnabled()
If ucrFactorReceiver.IsEmpty Then
If ucrFactorReceiver.IsEmpty Or (ucrSaveBar.chkSaveGraph.Checked And ucrSaveBar.ucrInputGraphName.IsEmpty) Then
ucrBase.OKEnabled(False)
Else
If rdoBarChart.Checked = True Then
Expand Down Expand Up @@ -113,13 +109,15 @@ Public Class dlgBarAndPieChart
Private Sub grpSelection_CheckedChanged(sender As Object, e As EventArgs) Handles rdoBarChart.CheckedChanged, rdoPieChart.CheckedChanged

If rdoBarChart.Checked = True Then
ucrSaveBar.strPrefix = "Bar"
clsRgeom_barchart.RemoveParameterByName("width")
ucrBase.clsRsyntax.RemoveOperatorParameter("polar")
cmdBarChartOptions.Visible = True
cmdPieChartOptions.Visible = False
ucrSecondReceiver.Visible = True
lblSecondFactor.Visible = True
ElseIf rdoPieChart.Checked = True Then
ucrSaveBar.strPrefix = "Pie"
clsRgeom_barchart.AddParameter("width", "1")
clsTempRFunc.SetRCommand("coord_polar")
clsTempRFunc.AddParameter("theta", Chr(34) & "y" & Chr(34))
Expand Down Expand Up @@ -152,5 +150,6 @@ Public Class dlgBarAndPieChart
ucrBase.clsRsyntax.SetAssignTo("last_graph", strTempDataframe:=ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph")
ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False
End If
TestOKEnabled()
End Sub
End Class
10 changes: 5 additions & 5 deletions instat/dlgBoxPlot.designer.vb

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

13 changes: 6 additions & 7 deletions instat/dlgBoxPlot.vb
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,26 @@ Public Class dlgBoxplot
ucrSecondFactorReceiver.SetIncludedDataTypes({"factor"})

sdgLayerOptions.SetRSyntax(ucrBase.clsRsyntax)
'sdgLayerOptions.SetGeomFunction(clsRgeom_boxplotFunction)
'sdgLayerOptions.SetAesFunction(clsRaesFunction

ucrVariablesAsFactorForBoxplot.SetFactorReceiver(ucrByFactorsReceiver)
ucrVariablesAsFactorForBoxplot.SetSelector(ucrSelectorBoxPlot)
ucrVariablesAsFactorForBoxplot.SetIncludedDataType({"numeric"})


ucrSaveBoxplot.SetDataFrameSelector(ucrSelectorBoxPlot.ucrAvailableDataFrames)
ucrSaveBoxplot.strPrefix = "Graph"
ucrSaveBoxplot.strPrefix = "Boxplot"
ucrSaveBoxplot.ucrInputGraphName.SetItemsTypeAsGraphs()
ucrSaveBoxplot.ucrInputGraphName.SetDefaultTypeAsGraph()
End Sub

Private Sub TestOkEnabled()
If Not ucrVariablesAsFactorForBoxplot.IsEmpty Then
ucrBase.OKEnabled(True)
Else

If ucrVariablesAsFactorForBoxplot.IsEmpty Or (ucrSaveBoxplot.chkSaveGraph.Checked And ucrSaveBoxplot.ucrInputGraphName.IsEmpty) Then
ucrBase.OKEnabled(False)
Else
ucrBase.OKEnabled(True)
End If
End Sub

Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click
sdgPlots.ShowDialog()
End Sub
Expand Down Expand Up @@ -168,5 +166,6 @@ Public Class dlgBoxplot
ucrBase.clsRsyntax.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorBoxPlot.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph")
ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False
End If
TestOkEnabled()
End Sub
End Class
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.

Loading

0 comments on commit 04849d6

Please sign in to comment.