Skip to content

Commit

Permalink
Merge pull request #41 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
Pulling changes from the main
  • Loading branch information
deaspo committed Feb 1, 2016
2 parents cdf4eb7 + 4f659e5 commit e3e0162
Show file tree
Hide file tree
Showing 49 changed files with 1,645 additions and 1,205 deletions.
2 changes: 1 addition & 1 deletion instat/clsGridLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Public Class clsGridLink
For i = 0 To lstDataNames.Length - 1
strDataName = lstDataNames.AsCharacter(i)
If (bGrdDataExists And frmMain.clsRLink.clsEngine.Evaluate(frmMain.clsRLink.strInstatDataObject & "$get_data_changed(data_name = " & Chr(34) & strDataName & Chr(34) & ")").AsLogical(0)) Then
dfTemp = frmMain.clsRLink.clsEngine.Evaluate(frmMain.clsRLink.strInstatDataObject & "$get_data(" & Chr(34) & strDataName & Chr(34) & ")").AsDataFrame
dfTemp = frmMain.clsRLink.clsEngine.Evaluate(frmMain.clsRLink.strInstatDataObject & "$get_data_frame(" & Chr(34) & strDataName & Chr(34) & ")").AsDataFrame
FillSheet(dfTemp, strDataName, grdData)
frmMain.clsRLink.clsEngine.Evaluate(frmMain.clsRLink.strInstatDataObject & "$set_data_frames_changed(" & Chr(34) & strDataName & Chr(34) & ", FALSE)")
End If
Expand Down
2 changes: 1 addition & 1 deletion instat/clsRFunction.vb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Public Class RFunction
bToBeAssigned = False
Else
strScript = strScript & frmMain.clsRLink.strInstatDataObject & "$import_data(data_tables = list(" & strAssignToDataFrame & "=" & strAssignTo & "))" & vbCrLf
strAssignTo = frmMain.clsRLink.strInstatDataObject & "$get_data(data_name = " & Chr(34) & strAssignToDataFrame & Chr(34) & ")"
strAssignTo = frmMain.clsRLink.strInstatDataObject & "$get_data_frame(data_name = " & Chr(34) & strAssignToDataFrame & Chr(34) & ")"
bIsAssigned = True
bToBeAssigned = False
End If
Expand Down
40 changes: 25 additions & 15 deletions instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,29 @@ Public Class RLink
Dim i As Integer

If bInstatObjectExists Then
lstCurrColumns = clsEngine.Evaluate(strInstatDataObject & "$get_column_names(" & Chr(34) & strDataFrame & Chr(34) & ")").AsList
If cboColumns IsNot Nothing Then
cboColumns.Items.Clear()
For i = 0 To lstCurrColumns.Length - 1
cboColumns.Items.Add(lstCurrColumns.AsCharacter(i))
Next
ElseIf lstColumns IsNot Nothing Then
lstColumns.Items.Clear()
If lstColumns.Columns.Count = 0 Then
lstColumns.Columns.Add("Available Data")
If clsEngine IsNot Nothing Then
lstCurrColumns = clsEngine.Evaluate(strInstatDataObject & "$get_column_names(" & Chr(34) & strDataFrame & Chr(34) & ")").AsList
If cboColumns IsNot Nothing Then
cboColumns.Items.Clear()
For i = 0 To lstCurrColumns.Length - 1
cboColumns.Items.Add(lstCurrColumns.AsCharacter(i))
Next
ElseIf lstColumns IsNot Nothing Then
lstColumns.Items.Clear()
If lstColumns.Columns.Count = 0 Then
lstColumns.Columns.Add("Available Data")
End If
For i = 0 To lstCurrColumns.Length - 1
lstColumns.Items.Add(lstCurrColumns.AsCharacter(i))
Next
lstColumns.Columns(0).Width = -2
End If
For i = 0 To lstCurrColumns.Length - 1
lstColumns.Items.Add(lstCurrColumns.AsCharacter(i))
Next
lstColumns.Columns(0).Width = -2
End If
End If

End Sub

Public Function GetDefaultNames(strPrefix As String)
Public Function GetDefaultColumnNames(strPrefix As String)
Dim lstNextDefaults As GenericVector = Nothing

If bInstatObjectExists Then
Expand Down Expand Up @@ -216,4 +219,11 @@ Public Class RLink
End If
End Sub

Public Function GetDataFrameLength(strDataFrameName As String) As Integer
Dim intLength As Integer
If clsEngine IsNot Nothing Then
intLength = clsEngine.Evaluate(frmMain.clsRLink.strInstatDataObject & "$length_of_data(" & Chr(34) & strDataFrameName & Chr(34) & ")").AsInteger(0)
End If
Return intLength
End Function
End Class
2 changes: 1 addition & 1 deletion instat/clsRSyntax.vb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Public Class RSyntax
clsRFunction = clsBaseFunction
End If
clsParam.SetArgumentName(strParameterName)
If Not strParameterName = "" Then
If Not strParameterValue = "" Then
clsParam.SetArgumentValue(strParameterValue)
End If
If Not clsRFunctionParameter Is Nothing Then
Expand Down
13 changes: 7 additions & 6 deletions instat/dlgBoxPlot.vb
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ Public Class dlgBoxplot


Private Sub ucrReceiveBoxplotVariable_ValueChanged(sender As Object, e As EventArgs)
If Not (ucrReceiverDataToPlot.lstSelectedVariables.SelectedItem = "") Then
ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverDataToPlot.GetVariables())
ucrBase.OKEnabled(True)
Else
ucrBase.OKEnabled(False)
End If
'TODO fix this
'If Not (ucrReceiverDataToPlot.lstSelectedVariables.SelectedItem = "") Then
' ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverDataToPlot.GetVariables())
' ucrBase.OKEnabled(True)
'Else
' ucrBase.OKEnabled(False)
'End If
End Sub
End Class
4 changes: 3 additions & 1 deletion instat/dlgColumnStats.vb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ Public Class dlgColumnStats

Private Sub ucrReceiverMultiple_Leave(sender As Object, e As EventArgs) Handles ucrReceiverMultiple.Leave
Dim objItem As Object
Dim temp_obj As ListBox.ObjectCollection = ucrReceiverMultiple.lstSelectedVariables.Items
'TODO fix this
Dim temp_obj As New Object
'Dim temp_obj As ListBox.ObjectCollection = ucrReceiverMultiple.lstSelectedVariables.Items
If ucrReceiverMultiple.lstSelectedVariables.Items.Count > 0 Then
For Each objItem In temp_obj
ucrBase.clsRsyntax.AddParameter("data_temp$" & objItem & "", "x")
Expand Down
5 changes: 3 additions & 2 deletions instat/dlgCorrelation.vb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ Public Class dlgCorrelation

Private Sub ucrReceiverMultiple_Leave(sender As Object, e As EventArgs) Handles ucrReceiverMultiple.Leave
If ucrReceiverMultiple.lstSelectedVariables.Items.Count = 2 Then
ucrBase.clsRsyntax.AddParameter("x", "data$" & ucrReceiverMultiple.lstSelectedVariables.Items.Item(0) & "")
ucrBase.clsRsyntax.AddParameter("y", "data$" & ucrReceiverMultiple.lstSelectedVariables.Items.Item(1) & "")
'TODO fix this
'ucrBase.clsRsyntax.AddParameter("x", "data$" & ucrReceiverMultiple.lstSelectedVariables.Items.Item(0) & "")
'ucrBase.clsRsyntax.AddParameter("y", "data$" & ucrReceiverMultiple.lstSelectedVariables.Items.Item(1) & "")
End If

End Sub
Expand Down
3 changes: 2 additions & 1 deletion instat/dlgFreqTables.vb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Public Class dlgFreqTables
End Sub

Private Sub ucrReceiverMultiple_Leave(sender As Object, e As EventArgs) Handles ucrReceiverMultiple.Leave
ucrBase.clsRsyntax.AddParameter("x", "data$" & ucrReceiverMultiple.lstSelectedVariables.SelectedItem & "")
'TODO fix this
'ucrBase.clsRsyntax.AddParameter("x", "data$" & ucrReceiverMultiple.lstSelectedVariables.SelectedItem & "")
End Sub
End Class
6 changes: 3 additions & 3 deletions instat/dlgRandomSample.vb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Public Class dlgRandomSample
' Setting distribution type and base function as distribution function
ucrDistWithParameters.SetRDistributions()
ucrBase.clsRsyntax.clsBaseFunction = ucrDistWithParameters.clsCurrRFunction
ucrDistWithParameters.AddParameter("n", ucrDataFrameSelector.strDataFrameLength)
ucrDistWithParameters.AddParameter("n", ucrDataFrameSelector.iDataFrameLength)

' Setting link between DataFrameSelector and NewColumnNameSelector
' TODO tidy these links up
ucrDataFrameSelector.SetColumnList(ucrNewColumnNameSelector)
'ucrDataFrameSelector.SetColumnList(ucrNewColumnNameSelector)
ucrNewColumnNameSelector.SetDataFrameSelector(ucrDataFrameSelector)
ucrNewColumnNameSelector.SetPrefix("Rand")

Expand All @@ -38,7 +38,7 @@ Public Class dlgRandomSample
End Sub

Private Sub ucrDataFrameSelector_Leave(sender As Object, e As EventArgs) Handles ucrDataFrameSelector.Leave
ucrDistWithParameters.AddParameter("n", ucrDataFrameSelector.strDataFrameLength)
ucrDistWithParameters.AddParameter("n", ucrDataFrameSelector.iDataFrameLength)
End Sub

Private Sub ucrNewColumnNameSelector_Leave(sender As Object, e As EventArgs) Handles ucrNewColumnNameSelector.Leave
Expand Down
2 changes: 1 addition & 1 deletion instat/dlgRegularSequence.vb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Public Class dlgRegularSequence
frmMain.clsRLink.SetOutput(txtGetPreview)
dtpSelectorA.Visible = False
dtpSelectorB.Visible = False
ucrSelectDataFrame.SetColumnList(ucrColName)
'ucrSelectDataFrame.SetColumnList(ucrColName)

ucrBase.clsRsyntax.SetAssignTo(strAssignToName:=ucrColName.cboColumnName.Text, strTempDataframe:=ucrSelectDataFrame.cboAvailableDataFrames.Text, strTempColumn:=ucrColName.cboColumnName.Text)
End Sub
Expand Down
48 changes: 24 additions & 24 deletions instat/dlgSite.Designer.vb

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

Loading

0 comments on commit e3e0162

Please sign in to comment.