Skip to content

Commit

Permalink
Merge pull request #129 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
update new data frame
  • Loading branch information
conlooptechnologies authored Feb 3, 2020
2 parents d2e65a0 + 3378499 commit eff9c59
Show file tree
Hide file tree
Showing 464 changed files with 44,950 additions and 32,798 deletions.
6 changes: 3 additions & 3 deletions docs/Download.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@
<div class="col-lg-8 col-lg-offset-2 text-center">
<h2 class="section-heading">Download R-Instat</h2>
<hr class="light">
<p>If this is your first time downloading R-Instat, we recommend you <a href="http://bit.ly/2Jl5Byo" style="color:blue;" target="_blank">download the Complete Installer</a>. The Complete Installer is the same version of R-Instat as the Basic Installer but also includes the required version of R (3.6.0 currently) to run R-Instat.</p>
<p>If this is your first time downloading R-Instat, we recommend you <a href="http://bit.ly/33O7Z87" style="color:blue;" target="_blank">download the Complete Installer</a>. The Complete Installer is the same version of R-Instat as the Basic Installer but also includes the required version of R (3.6.0 currently) to run R-Instat.</p>
<p>If you do not know if you have the latest version of R, download the Complete Installer. The Basic Installer does not include R.</p>
<p>R-Instat is currently a Windows only application. However, it can be accessed on Mac or Linux through use of a Virtual Windows Machine.</p>
<p><a href="http://bit.ly/2Jl5Byo" style="color:blue;" target="_blank">R-Instat 0.5.4 Complete Installer (.exe 577MB)</a></p>
<p><a href="http://bit.ly/2ph63H1" style="color:blue;" target="_blank">R-Instat 0.5.4 Basic Installer (.msi 499MB)</a></p>
<p><a href="http://bit.ly/33O7Z87" style="color:blue;" target="_blank">R-Instat 0.5.5 Complete Installer (.exe 594MB)</a></p>
<p><a href="http://bit.ly/2sI7CiE" style="color:blue;" target="_blank">R-Instat 0.5.5 Basic Installer (.msi 516MB)</a></p>

<h2 class="section-heading">Installation & Documentation</h2>
<hr class="light">
Expand Down
2 changes: 1 addition & 1 deletion instat/clsGridLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Public Class clsGridLink
clsGetCombinedMetadata.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_combined_metadata")
clsSetMetadataChanged.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$set_metadata_changed")

If frmMain.clsRLink.bInstatObjectExists Then
If frmMain.clsRLink.bInstatObjectExists AndAlso frmMain.clsRLink.GetDataFrameCount() > 0 Then
expTemp = frmMain.clsRLink.RunInternalScriptGetValue(clsDataChanged.ToScript())
If expTemp IsNot Nothing AndAlso expTemp.Type <> Internals.SymbolicExpressionType.Null Then
bRDataChanged = expTemp.AsLogical(0)
Expand Down
1,040 changes: 534 additions & 506 deletions instat/clsRCodeStructure.vb

Large diffs are not rendered by default.

50 changes: 37 additions & 13 deletions instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ Public Class RLink
Dim clsPNGFunction As New RFunction
Dim strTempAssignTo As String = ".temp_val"
Dim bSuccess As Boolean
Dim bError As Boolean = False

strTempGraphsDirectory = System.IO.Path.Combine(System.IO.Path.GetTempPath() & "R_Instat_Temp_Graphs")
strOutput = ""
Expand Down Expand Up @@ -558,7 +559,7 @@ Public Class RLink
strSplitScript = Left(strScript, strScript.Trim(Environment.NewLine.ToCharArray).LastIndexOf(Environment.NewLine.ToCharArray))
If strSplitScript <> "" Then
Try
Evaluate(strSplitScript, bSilent:=bSilent, bSeparateThread:=bSeparateThread, bShowWaitDialogOverride:=bShowWaitDialogOverride)
bError = Not Evaluate(strSplitScript, bSilent:=bSilent, bSeparateThread:=bSeparateThread, bShowWaitDialogOverride:=bShowWaitDialogOverride)
Catch e As Exception
MsgBox(e.Message & Environment.NewLine & "The error occurred in attempting to run the following R command(s):" & Environment.NewLine & strScript, MsgBoxStyle.Critical, "Error running R command(s)")
End Try
Expand All @@ -567,12 +568,16 @@ Public Class RLink
strCapturedScript = "capture.output(" & strSplitScript & ")"
End If
Try
Evaluate(strTempAssignTo & " <- " & strCapturedScript, bSilent:=bSilent, bSeparateThread:=bSeparateThread, bShowWaitDialogOverride:=bShowWaitDialogOverride)
expTemp = GetSymbol(strTempAssignTo)
If expTemp IsNot Nothing Then
strTemp = String.Join(Environment.NewLine, expTemp.AsCharacter())
If strTemp <> "" Then
strOutput = strOutput & strTemp & Environment.NewLine
If Not bError Then
If Evaluate(strTempAssignTo & " <- " & strCapturedScript, bSilent:=bSilent, bSeparateThread:=bSeparateThread, bShowWaitDialogOverride:=bShowWaitDialogOverride) Then
expTemp = GetSymbol(strTempAssignTo)
Evaluate("rm(" & strTempAssignTo & ")", bSilent:=True)
If expTemp IsNot Nothing Then
strTemp = String.Join(Environment.NewLine, expTemp.AsCharacter())
If strTemp <> "" Then
strOutput = strOutput & strTemp & Environment.NewLine
End If
End If
End If
End If
Catch e As Exception
Expand All @@ -592,27 +597,27 @@ Public Class RLink
End If
End Sub

Public Function RunInternalScriptGetValue(strScript As String, Optional strVariableName As String = ".temp_value", Optional bSilent As Boolean = False, Optional bSeparateThread As Boolean = True, Optional bShowWaitDialogOverride As Nullable(Of Boolean) = Nothing) As SymbolicExpression
Public Function RunInternalScriptGetValue(strScript As String, Optional strVariableName As String = ".temp_value", Optional bSilent As Boolean = False, Optional bSeparateThread As Boolean = True, Optional bShowWaitDialogOverride As Nullable(Of Boolean) = Nothing, Optional ByRef strError As String = "") As SymbolicExpression
Dim expTemp As SymbolicExpression
Dim strCommand As String

expTemp = Nothing
'TODO Bug here if strScript is multiple lines. Wrong value will be returned
strCommand = strVariableName & "<-" & strScript
strCommand = strVariableName & " <- " & strScript
If clsEngine IsNot Nothing Then
Evaluate(strCommand, bSilent:=bSilent, bSeparateThread:=bSeparateThread, bShowWaitDialogOverride:=bShowWaitDialogOverride)
Evaluate(strCommand, bSilent:=bSilent, bSeparateThread:=bSeparateThread, bShowWaitDialogOverride:=bShowWaitDialogOverride, strError:=strError)
expTemp = GetSymbol(strVariableName, bSilent:=True)
'Very important to remove the variable after getting it othewise could be returning wrong variable later if a command gives an error
Evaluate("rm(" & strVariableName & ")", bSilent:=bSilent, bSeparateThread:=bSeparateThread)
End If
Return expTemp
End Function

Public Function RunInternalScriptGetOutput(strScript As String, Optional bSilent As Boolean = False, Optional bSeparateThread As Boolean = True, Optional bShowWaitDialogOverride As Nullable(Of Boolean) = Nothing) As CharacterVector
Public Function RunInternalScriptGetOutput(strScript As String, Optional bSilent As Boolean = False, Optional bSeparateThread As Boolean = True, Optional bShowWaitDialogOverride As Nullable(Of Boolean) = Nothing, Optional ByRef strError As String = "") As CharacterVector
Dim chrTemp As CharacterVector
Dim expTemp As SymbolicExpression

expTemp = RunInternalScriptGetValue("capture.output(" & strScript & ")", bSilent:=bSilent, bSeparateThread:=bSeparateThread, bShowWaitDialogOverride:=bShowWaitDialogOverride)
expTemp = RunInternalScriptGetValue("capture.output(" & strScript & ")", bSilent:=bSilent, bSeparateThread:=bSeparateThread, bShowWaitDialogOverride:=bShowWaitDialogOverride, strError:=strError)
Try
chrTemp = expTemp.AsCharacter()
Catch ex As Exception
Expand Down Expand Up @@ -641,14 +646,15 @@ Public Class RLink
End If
End Function

Private Function Evaluate(strScript As String, Optional bSilent As Boolean = False, Optional bSeparateThread As Boolean = True, Optional bShowWaitDialogOverride As Nullable(Of Boolean) = Nothing) As Boolean
Private Function Evaluate(strScript As String, Optional bSilent As Boolean = False, Optional bSeparateThread As Boolean = True, Optional bShowWaitDialogOverride As Nullable(Of Boolean) = Nothing, Optional ByRef strError As String = "") As Boolean
Dim thrRScript As Threading.Thread
Dim thrDelay As Threading.Thread
Dim thrWaitDisplay As Threading.Thread
Dim evtWaitHandleWaitDisplayDone As New System.Threading.AutoResetEvent(False)
Dim evtWaitHandleDelayDone As New System.Threading.AutoResetEvent(False)
Dim bReturn As Boolean = True
Dim i As Integer = 1
Dim strTempError As String = ""
Dim strTempFile As String
Dim bErrorMessageOpen As Boolean = False
Dim bCurrentShowWaiting As Boolean
Expand Down Expand Up @@ -716,6 +722,7 @@ Public Class RLink
MsgBox(ex.Message & Environment.NewLine & "The error occurred in attempting to run the following R command(s):" & Environment.NewLine & strScript, MsgBoxStyle.Critical, "Error running R command(s)")
bErrorMessageOpen = False
End If
strTempError = ex.Message
bReturn = False
End Try
End Sub)
Expand Down Expand Up @@ -758,12 +765,14 @@ Public Class RLink
If Not bSilent Then
MsgBox(ex.Message & Environment.NewLine & "The error occurred in attempting to run the following R command(s):" & Environment.NewLine & strScript, MsgBoxStyle.Critical, "Error running R command(s)")
End If
strTempError = ex.Message
bReturn = False
End Try
Else
bReturn = False
End If
bRCodeRunning = False
strError = strTempError
Return bReturn
End Function

Expand Down Expand Up @@ -1078,6 +1087,21 @@ Public Class RLink
Return bExists
End Function

Public Function GetDataFrameCount() As Integer
Dim iCount As Integer
Dim clsDataFrameCount As New RFunction
Dim expCount As SymbolicExpression

clsDataFrameCount.SetRCommand(strInstatDataObject & "$dataframe_count")
expCount = RunInternalScriptGetValue(clsDataFrameCount.ToScript(), bSilent:=True)
If expCount IsNot Nothing AndAlso Not expCount.Type = Internals.SymbolicExpressionType.Null Then
iCount = expCount.AsInteger(0)
Else
iCount = 0
End If
Return iCount
End Function

Public Function GetDataFrameLength(strDataFrameName As String, Optional bUseCurrentFilter As Boolean = False) As Integer
Dim iLength As Integer
Dim clsDataFrameLength As New RFunction
Expand Down
56 changes: 52 additions & 4 deletions instat/dlgBarAndPieChart.Designer.vb

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

Loading

0 comments on commit eff9c59

Please sign in to comment.