Skip to content

Commit

Permalink
Merge pull request #196 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
Vitalis95 authored Dec 11, 2023
2 parents 5f5e59c + 5439433 commit ede4f38
Show file tree
Hide file tree
Showing 39 changed files with 13,037 additions and 2,328 deletions.
14 changes: 14 additions & 0 deletions instat/Model/DataFrame/clsColumnMetaData.vb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Public Class clsColumnMetaData
Private Property _clsColsMetadataDataFrame As DataFrame
Private _hasChanged As Boolean

Private _useColumnSelectionInMetaData As Boolean

''' <summary>
''' holds the metadata change audit id
''' </summary>
Expand Down Expand Up @@ -107,8 +109,18 @@ Public Class clsColumnMetaData
_RLink = rLink
_strDataFrameName = strName
_hasChanged = True
_useColumnSelectionInMetaData = True
End Sub

Public Property UseColumnSelectionInMetaData() As Boolean
Get
Return _useColumnSelectionInMetaData
End Get
Set(value As Boolean)
_useColumnSelectionInMetaData = value
End Set
End Property

Private Function HasDataChanged() As Boolean
Dim clsVariablesMetadataChanged As New RFunction
Dim expTemp As SymbolicExpression
Expand Down Expand Up @@ -147,6 +159,8 @@ Public Class clsColumnMetaData
clsGetVariablesMetadata.SetRCommand(_RLink.strInstatDataObject & "$get_variables_metadata")
clsGetVariablesMetadata.AddParameter("convert_to_character", "TRUE")
clsGetVariablesMetadata.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34))
'TODO. why not apply or not the column selection at the R level.
clsGetVariablesMetadata.AddParameter("use_column_selection", If(UseColumnSelectionInMetaData, "TRUE", "FALSE"))
expTemp = _RLink.RunInternalScriptGetValue(clsGetVariablesMetadata.ToScript(), bSilent:=True)
If expTemp IsNot Nothing AndAlso expTemp.Type <> Internals.SymbolicExpressionType.Null Then
Return expTemp.AsDataFrame
Expand Down
14 changes: 13 additions & 1 deletion instat/Model/DataFrame/clsDataFramePage.vb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Public Class clsDataFramePage
Private _clsRDotNetDataFrame As DataFrame
Private _lstColumns As List(Of clsColumnHeaderDisplay)
Private _hasChanged As Boolean
Private _useColumnSelectionInDataView As Boolean

Private ReadOnly Property iColumnIncrements As Integer
Get
Expand Down Expand Up @@ -151,6 +152,7 @@ Public Class clsDataFramePage
_iColumnStart = 1
_iRowStart = 1
_hasChanged = True
_useColumnSelectionInDataView = True
End Sub

''' <summary>
Expand Down Expand Up @@ -184,6 +186,15 @@ Public Class clsDataFramePage
End If
End Sub

Public Property UseColumnSelectionInDataView() As Boolean
Get
Return _useColumnSelectionInDataView
End Get
Set(value As Boolean)
_useColumnSelectionInDataView = value
End Set
End Property

Private Function GetNoOfRowPages() As Integer
'Needs to be a function as the number of increments can be changed through options
Return Math.Ceiling(_iTotalRowCount / intRowIncrements)
Expand All @@ -201,7 +212,8 @@ Public Class clsDataFramePage
clsGetDataFrameRFunction.SetRCommand(_clsRLink.strInstatDataObject & "$get_data_frame")
clsGetDataFrameRFunction.AddParameter("convert_to_character", "TRUE")
clsGetDataFrameRFunction.AddParameter("use_current_filter", "TRUE")
clsGetDataFrameRFunction.AddParameter("use_column_selection", "TRUE")
'TODO. why not apply or not the column selection at the R level.
clsGetDataFrameRFunction.AddParameter("use_column_selection", If(UseColumnSelectionInDataView, "TRUE", "FALSE"))
clsGetDataFrameRFunction.AddParameter("max_cols", iColumnIncrements)
clsGetDataFrameRFunction.AddParameter("max_rows", intRowIncrements)
clsGetDataFrameRFunction.AddParameter("start_row", _iRowStart)
Expand Down
3 changes: 2 additions & 1 deletion instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ Public Class ucrDataViewReoGrid

grdData.CurrentWorksheet.Columns = visiblePage.lstColumns.Count

If GetCurrentDataFrameFocus.clsFilterOrColumnSelection.bColumnSelectionApplied Then
If GetCurrentDataFrameFocus.clsFilterOrColumnSelection.bColumnSelectionApplied AndAlso
GetCurrentDataFrameFocus.clsVisibleDataFramePage.UseColumnSelectionInDataView Then
variableTextColour = Color.Red
Else
variableTextColour = Color.DarkBlue
Expand Down
3 changes: 2 additions & 1 deletion instat/clsDistribution.vb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Public Class Distribution
Public strDFunctionName As String = ""
Public strExactName As String = ""
Public strGLMFunctionName As String = ""
Public strAOVFunctionName As String = ""

Public bIncluded As Boolean = True
Public bNumeric As Boolean = False
Expand Down Expand Up @@ -77,7 +78,7 @@ Public Class Distribution
End Sub

Public Function IsDistributionFunction(strFunctionName As String) As Boolean
Dim strNames() As String = {strRFunctionName, strPFunctionName, strQFunctionName, strDFunctionName, strExactName, strGLMFunctionName}
Dim strNames() As String = {strRFunctionName, strPFunctionName, strQFunctionName, strDFunctionName, strExactName, strGLMFunctionName, strAOVFunctionName}
Return strNames.Contains(strFunctionName)
End Function
End Class
Expand Down
5 changes: 5 additions & 0 deletions instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ Public Class RLink
''' <summary> The graph display option (e.g. 'view_output_window' or 'view_separate_window'). </summary>
Public strGraphDisplayOption As String = "view_output_window"

''' <summary> If true then show all the selected columns to the selector listview. </summary>
Public bUseColumnSelection As Boolean = False


''' <summary> The current grid (the worksheet that appears similar to a spreadsheet on the
''' left-hand side of the display). </summary>
Expand Down Expand Up @@ -1390,6 +1393,8 @@ Public Class RLink
Select Case strType
Case "column"
clsGetItems.SetRCommand(strInstatDataObject & "$get_column_names")
'TODO. why not apply or not the column selection at the R level.
clsGetItems.AddParameter("use_current_column_selection", If(bUseColumnSelection, "TRUE", "FALSE"))
Case "metadata"
clsGetItems.SetRCommand(strInstatDataObject & "$get_metadata_fields")
Case "filter"
Expand Down
10 changes: 8 additions & 2 deletions instat/clsRegressionDefaults.vb
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,20 @@ Public Class clsRegressionDefaults
End Property
Public Shared ReadOnly Property clsDefaultGlmFunction As RFunction
Get

Dim clsDefaultGlmFunc As New RFunction

clsDefaultGlmFunc.SetRCommand("glm")
Return clsDefaultGlmFunc
End Get
End Property

Public Shared ReadOnly Property clsDefaultAovFunction As RFunction
Get
Dim clsDefaultAovFunc As New RFunction
clsDefaultAovFunc.SetRCommand("aov")
Return clsDefaultAovFunc
End Get
End Property

Public Shared ReadOnly Property clsDefaultRGraphicsOperator As ROperator
Get

Expand Down
2 changes: 1 addition & 1 deletion instat/dlgBoxPlot.vb
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ Public Class dlgBoxplot
Else
ucrVariablesAsFactorForBoxplot.Add(clsParam.strArgumentValue)
End If
ElseIf clsParam.strArgumentName = "colour" Then
ElseIf clsParam.strArgumentName = "fill" Then
ucrSecondFactorReceiver.Add(clsParam.strArgumentValue)
End If
Next
Expand Down
Loading

0 comments on commit ede4f38

Please sign in to comment.