Skip to content

Commit

Permalink
Merge pull request #94 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
Updating master
  • Loading branch information
maxwellfundi authored May 15, 2017
2 parents b1d986f + 7090ca7 commit 12707f9
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
5 changes: 4 additions & 1 deletion instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ Public Class RLink
bInstatObjectExists = True
End Sub

Public Sub FillListView(lstView As ListView, strType As String, Optional lstIncludedDataTypes As List(Of KeyValuePair(Of String, String())) = Nothing, Optional lstExcludedDataTypes As List(Of KeyValuePair(Of String, String())) = Nothing, Optional strDataFrameName As String = "", Optional strHeading As String = "Variables", Optional strExcludedItems As String() = Nothing, Optional strDatabaseQuery As String = "")
Public Sub FillListView(lstView As ListView, strType As String, Optional lstIncludedDataTypes As List(Of KeyValuePair(Of String, String())) = Nothing, Optional lstExcludedDataTypes As List(Of KeyValuePair(Of String, String())) = Nothing, Optional strDataFrameName As String = "", Optional strHeading As String = "Variables", Optional strExcludedItems As String() = Nothing, Optional strDatabaseQuery As String = "", Optional strNcFilePath As String = "")
Dim vecColumns As GenericVector
Dim chrCurrColumns As CharacterVector
Dim i As Integer
Expand Down Expand Up @@ -527,6 +527,9 @@ Public Class RLink
Case "database_variables"
clsGetItems.SetRCommand(strInstatDataObject & "$get_database_variable_names")
clsGetItems.AddParameter("query", Chr(34) & strDatabaseQuery & Chr(34))
Case "nc_dim_variables"
clsGetItems.SetRCommand(strInstatDataObject & "$get_nc_variable_names")
clsGetItems.AddParameter("file", Chr(34) & strNcFilePath & Chr(34))
End Select
clsGetItems.AddParameter("as_list", "TRUE")
lstView.Clear()
Expand Down
7 changes: 4 additions & 3 deletions instat/dlgOneWayFrequencies.vb
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ Public Class dlgOneWayFrequencies
clsSjTab.SetPackageName("sjPlot")
clsSjTab.SetRCommand("sjtab")

clsSjTab.AddParameter("show.summary", "FALSE")
clsSjTab.AddParameter("digits", 0)

clsSjTab.AddParameter("show.summary", "FALSE", iPosition:=7)
clsSjTab.AddParameter("digits", 0, iPosition:=10)
clsSjTab.AddParameter("ignore.strings", "FALSE", iPosition:=11)
clsSjTab.AddParameter("auto.grp.strings ", "FALSE", iPosition:=12)
clsSjPlot.SetPackageName("sjPlot")
clsSjPlot.SetRCommand("sjplot")
clsPlotGrid.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorOneWayFreq.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph")
Expand Down
17 changes: 17 additions & 0 deletions instat/static/InstatObject/R/instat_object_R6.R
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,23 @@ instat_object$set("public", "get_database_variable_names", function(query, data_
}
)

instat_object$set("public", "get_nc_variable_names", function(file = "", as_list = FALSE, ...) {
if(file == "") {
vars <- ""
}
else {
nc_file <- nc_open(file)
vars <- names(nc_file$dim)
}
if(as_list) {
out <- list()
out[["dim variables"]] <- vars
return(out)
}
else return(vars)
}
)

instat_object$set("public", "has_database_connection", function() {
return(!is.null(self$get_database_connection()))
}
Expand Down
14 changes: 14 additions & 0 deletions instat/ucrReceiver.vb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Public Class ucrReceiver

Public strDatabaseQuery As String = ""

Private strPrvNcFilePath As String = ""

Public bAddParameterIfEmpty As Boolean = False
'If the control is used to set a parameter that is a string i.e. column = "ID"
Protected bParameterIsString As Boolean = False
Expand Down Expand Up @@ -91,6 +93,18 @@ Public Class ucrReceiver

End Sub

Public Property strNcFilePath As String
Get
Return strPrvNcFilePath
End Get
Set(strFilePath As String)
strPrvNcFilePath = strFilePath
If Selector IsNot Nothing Then
Selector.LoadList()
End If
End Set
End Property

Public Overridable Function GetVariables(Optional bForceAsDataFrame As Boolean = False) As RFunction
Dim clsGetVariablesFunc As New RFunction
Return clsGetVariablesFunc
Expand Down
4 changes: 2 additions & 2 deletions instat/ucrSelector.vb
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ Public Class ucrSelector
strExclud = lstVariablesInReceivers.ToArray
End If
If CurrentReceiver.bTypeSet Then
frmMain.clsRLink.FillListView(lstAvailableVariable, strType:=CurrentReceiver.GetItemType(), lstIncludedDataTypes:=lstCombinedMetadataLists(0), lstExcludedDataTypes:=lstCombinedMetadataLists(1), strHeading:=CurrentReceiver.strSelectorHeading, strDataFrameName:=strCurrentDataFrame, strExcludedItems:=strExclud, strDatabaseQuery:=CurrentReceiver.strDatabaseQuery)
frmMain.clsRLink.FillListView(lstAvailableVariable, strType:=CurrentReceiver.GetItemType(), lstIncludedDataTypes:=lstCombinedMetadataLists(0), lstExcludedDataTypes:=lstCombinedMetadataLists(1), strHeading:=CurrentReceiver.strSelectorHeading, strDataFrameName:=strCurrentDataFrame, strExcludedItems:=strExclud, strDatabaseQuery:=CurrentReceiver.strDatabaseQuery, strNcFilePath:=CurrentReceiver.strNcFilePath)
Else
frmMain.clsRLink.FillListView(lstAvailableVariable, strType:=strType, lstIncludedDataTypes:=lstCombinedMetadataLists(0), lstExcludedDataTypes:=lstCombinedMetadataLists(1), strHeading:=CurrentReceiver.strSelectorHeading, strDataFrameName:=strCurrentDataFrame, strExcludedItems:=strExclud, strDatabaseQuery:=CurrentReceiver.strDatabaseQuery)
frmMain.clsRLink.FillListView(lstAvailableVariable, strType:=strType, lstIncludedDataTypes:=lstCombinedMetadataLists(0), lstExcludedDataTypes:=lstCombinedMetadataLists(1), strHeading:=CurrentReceiver.strSelectorHeading, strDataFrameName:=strCurrentDataFrame, strExcludedItems:=strExclud, strDatabaseQuery:=CurrentReceiver.strDatabaseQuery, strNcFilePath:=CurrentReceiver.strNcFilePath)
End If
Else
frmMain.clsRLink.FillListView(lstAvailableVariable, strType:=strType, lstIncludedDataTypes:=lstIncludedMetadataProperties, lstExcludedDataTypes:=lstExcludedMetadataProperties, strDataFrameName:=strCurrentDataFrame)
Expand Down

0 comments on commit 12707f9

Please sign in to comment.