Library Loading Error in TERR
I'm tryingto install a couple packages and see the below error pop up. Please advise.
TIBCO Enterprise Runtime for R returned an error: 'Error in .package.execute.initialization.function(ns, ".onLoad", dirn : error executing function '.onLoad' from package 'nlme' loaded from C:/Users/m/Documents/TERR/x86_64-pc-windows-library/4.2 : Error in readRDS(attr(packageDescription(pkgname), "file")) : file 'C:/Users/m/Documents/TERR/x86_64-pc-windows-library/4.2/nlme/DESCRIPTION' is corrupt'.
at Spotfire.Dxp.Data.DataFunctions.Executors.LocalFunctionClient.OnExecuting()
at Spotfire.Dxp.Data.DataFunctions.Executors.AbstractFunctionClient.<RunFunction>d__0.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.Executors.SPlusFunctionExecutor.<ExecuteFunction>d__0.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.<ExecuteFunction>d__6.MoveNext()
(4) Answers
If you have downloaded open-source R from the CRAN repository and installed it on the same machine as your Spotfire desktop client is installed on, you can use the REvaluate() function in TERR's optional built-in "RinR" package to send data and expressions to that open-source R instance for processing.
So your data function can use that open-source R instance to run functions from CRAN packages that do not work in TERR yet, then return the data frame result to the data function's TERR session, then return the data frame result from TERR to Spotfire as a data table.
Note that any packages you need in open-source R will need to be installed in that open-source R instance, and the expression your REvaluate() sends to the open-source R instance (as its "expr" argument) will need to include calls to 'library()' that load those packages into the open-source R session's search() path.
You may find the information from the following public Spotfire knowledge base article helpful for this task:
~~~~~~~~~~~~~~~~~~
https://support.tibco.com/s/article/ka11a000000Ht5fAAC/Tibco-KnowledgeAr...
How to use the "data" and "expr" arguments in the REvaluate() function from TERR's "RinR" package to send data and expressions out to an open source R session.
Details
TIBCO Enterprise Runtime for R (TERR) comes with an optional built-in "RinR" package, which makes it possible to send data and expressions (R commands) out to an open-source R instance that has been installed on the same machine. It helps to become acquainted with the "RinR" package's "REValuate()" function and its syntax using a simple round-trip example before providing a more complex R script in the function's "expr" argument. This article provides such an example. Note that this article assumes that you are already familiar with the R programming language.
Resolution
TIBCO Enterprise Runtime for R (TERR) comes with an optional built-in "RinR" package, which makes it possible to send data and expressions (R commands) out to an open-source R instance that has been installed on the same machine.
It helps to become acquainted with the "RinR" package's "REValuate()" function and its syntax using a simple round-trip example before providing a more complex R script in the function's "expr" argument.
For the same reason, this introductory example uses a TERR Console session without the additional steps involved in registering a Spotfire data function that uses TERR.
Do the following:
1) Download a compatible version of open-source R from the open-source R community's CRAN repository.
2) Install open-source R on the machine your Spotfire 7.0 or later desktop client is installed on.
3) Using Windows Explorer, copy the full path to the R executable (such as "C:\Program Files\R\R-3.2.3\bin\R.exe"), and paste it into a Notepad text editor session for editing. You will need to provide this path in a TERR-readable format in the test script shown below.
4) Use Notepad's "Edit > Replace" option to replace all backslashes ("\") in the path with forward slashes ("/") so that it will look something like the following after editing:
"C:/Program Files/R/R-3.2.3/bin/R.exe"
5) Open a new Notepad text editor session and paste the following round-trip test script into this second Notepad session:
######################################
library( "Sdatasets" )
library( "RinR" )
ActualPathToOpenSourceR <- "C:/Program Files/R/R-3.1.2/bin/R"
options( RinR_R_FULL_PATH = ActualPathToOpenSourceR )
Input_DataTable <- fuel.frame
dim( Input_DataTable )
TestData <- REvaluate(
data = list( result = Input_DataTable ),
expr =
{
result[ 1:10, ]
} )
TestData
dim( TestData )
######################################
6) Copy your edited actual path to the open-source R instance (with forward slashes ("/") as path delimiters) from the first Notepad session. Then paste it into the second line in the second Notepad session's TERR script. In this example, the line in the script that originally read as follows,
ActualPathToOpenSourceR <- "C:/Program Files/R/R-3.1.2/bin/R"
would read as follows after pasting the edited actual path to open-source R into it:
ActualPathToOpenSourceR <- "C:/Program Files/R/R-3.2.3/bin/R.exe"
In this example, the edited script would then look like the following:
######################################
library( "Sdatasets" )
library( "RinR" )
ActualPathToOpenSourceR <- "C:/Program Files/R/R-3.2.3/bin/R.exe"
options( RinR_R_FULL_PATH = ActualPathToOpenSourceR )
Input_DataTable <- fuel.frame
dim( Input_DataTable )
TestData <- REvaluate(
data = list( result = Input_DataTable ),
expr =
{
result[ 1:10, ]
} )
TestData
dim( TestData )
######################################
Note all of the following important syntax items.
- This example TERR script explicitly passes the "data" argument and the "expr" argument into 'REvaluate()' by name, and it also provides the "data" argument as a named list, using this syntax:
data = list( result = Input_DataTable ),
- The name provided in the named list is the object name that must be used when referring to that data object in the expression passed to open-source R via the 'REvaluate()' function's "expr" argument, as shown here:
expr =
{
result[ 1:10, ]
} )
- The expression that is sent to the open-source R instance via the "expr" argument must be enclosed in a pair of curly braces {}, as shown above.
7) Use your Spotfire 7.0 or later desktop client's "Tools > TERR Tools > Launch TERR Console" main-menu option to open a new TERR Console session. Then paste your edited version of this round-trip test of REvaluate() function syntax into the TERR Console session and press the Enter key.
The following as-run script shows how this example works in a TERR Console session that is running TERR 4.0.2:
==========================================================
TIBCO Software Inc. Confidential Information
Copyright (C) 2011-2015 TIBCO Software Inc. ALL RIGHTS RESERVED
TIBCO Enterprise Runtime for R version 4.0.2 for Microsoft Windows 64-bit
Type 'help()' for help.
Type 'q()' to quit.
>
>
>
>
> ######################################
> library( "Sdatasets" )
> library( "RinR" )
>
>
> ActualPathToOpenSourceR <- "C:/Program Files/R/R-3.2.3/bin/R.exe"
>
>
> options( RinR_R_FULL_PATH = ActualPathToOpenSourceR )
>
>
> Input_DataTable <- fuel.frame
>
>
> dim( Input_DataTable )
[1] 60 5
>
>
> TestData <- REvaluate(
+ data = list( result = Input_DataTable ),
+ expr =
+ {
+ result[ 1:10, ]
+ } )
>
>
> TestData
Weight Disp. Mileage Fuel Type
Eagle Summit 4 2560 97 33 3.030303 Small
Ford Escort 4 2345 114 33 3.030303 Small
Ford Festiva 4 1845 81 37 2.702703 Small
Honda Civic 4 2260 91 32 3.125000 Small
Mazda Protege 4 2440 113 32 3.125000 Small
Mercury Tracer 4 2285 97 26 3.846154 Small
Nissan Sentra 4 2275 97 33 3.030303 Small
Pontiac LeMans 4 2350 98 28 3.571429 Small
Subaru Loyale 4 2295 109 25 4.000000 Small
Subaru Justy 3 1900 73 34 2.941176 Small
>
>
> dim( TestData )
[1] 10 5
>
>
> ######################################
==========================================================
Note that the "data" and "expr" arguments in the "RinR" package's "RGraph()" function work the same as they do in the "REvaluate()" function.
Reference
Help file that is opened in a web browser when the following command is issued at the TERR Console command prompt:
help( "REvaluate", try.all.packages = TRUE )
Spotfire desktop help topics for "TERR Tools":
- Go to the online help for TIBCO Spotfire (desktop client / Analyst / Professional) 7.0:
https://docs.tibco.com/pub/spotfire/7.0.0/doc/html/index.htm
- In the left-hand pane of the help page, left-click on the [+] signs to expand the following tree of topics:
-- Tools
--- TERR Tools
- Double-click on the following topic, to display it in the right-hand pane of the help page:
---- TERR Tools - Details on Engine
~~~~~~~~~~~~~~~~~~
1 Comment
Thank you so much DougJ. It was really helpful and I could read the data from Googlesheet in TERR console. Could you please help me with creating a spotfire data table from this imported googlesheet data?
Thanks in advance!
KC,
Prashik

1 Comment
Thank you so much DougJ. It was really helpful and I could read the data from Googlesheet in TERR console. Could you please help me with creating a spotfire data table from this imported googlesheet data?
Thanks in advance!
KC,
Prashik
This is also a known issue, which has not been resolved at this point.
The user-contributed "purrr" package from the open-source R community's CRAN repository installs in TERR 4.3, but it does not load:
>
>
> packageVersion( "purrr" )
[1] '0.2.3'
>
>
> library( purrr )
Warning message:
In library.dynam(chname = chname, package = package, lib.loc... : Could not load foreign binary C:/Users/abcde/Documents/TERR/x86_64-pc-windows-library/4.3/purrr/libs/x64/purrr.dll: The specified procedure could not be found.
Error in .loadNamespaceImpl(package, path, keep.source, partial) : error executing useDynLib for dynamic library 'purrr' from package 'purrr' loaded from C:/Users/abcde/Documents/TERR/x86_64-pc-windows-library/4.3 : Error in library.dynam(chname = chname, package = package, lib.loc = ... : Foreign binary purrr could not be loaded
>
>
1 Comment
Thank you for the reply.
Is there any way by which I can directly calll data frames from R to spotfire as a data table? Basically trying to read googlesheet data table as a Input to spotfire data table.
Any kinda help is appreciated.
Many thanks in advance!

1 Comment
Thank you for the reply.
Is there any way by which I can directly calll data frames from R to spotfire as a data table? Basically trying to read googlesheet data table as a Input to spotfire data table.
Any kinda help is appreciated.
Many thanks in advance!
This is a known issue in TERR 4.2 with the user-contributed "nlme" package from the open-source R community's CRAN repository.
It is fixed in TERR 4.3 and later.
Applying the latest cumulative hotfixes to supported versions of Spotfire Server and the Spotfire client will upgrade the Spotfire Analyst desktop client's built-in local TERR engine to TERR 4.3 or later.
Applying the latest cumulative hotfix to supported versions of TIBCO Spotfire Statistics Services (TSSS) will upgrade its built-in TERR engine to TERR 4.3 or later.

Try using TERR 4.3
I got same error on TERR 4.2. See attahced (TERR4.2.PNG)
This issue fixed in TERR 4.3. See attached (TERR4.3.PNG)
Attachment | Size |
---|---|
![]() | 53.35 KB |
![]() | 16.66 KB |

Similar Questions
Haven't found what you are looking for?
Existing Best Answer
This Question already has a 'Best Answer'. If you believe this answer is better, you must first uncheck the current Best Answer
1 Comment
I am also facing the same issue while intalling Library "googlesheets"and throwing below error
TIBCO Enterprise Runtime for R returned an error: 'Error in .loadNamespaceImpl(package, path, keep.source, partial) : error executing useDynLib for dynamic library 'purrr' from package 'purrr' loaded from C:/Users/WaghPr02/Documents/TERR/x86_64-pc-windows-library/4.3 : Error in library.dynam(chname = chname, package = package, lib.loc = ... : Foreign binary purrr could not be loaded'.
at Spotfire.Dxp.Data.DataFunctions.Executors.LocalFunctionClient.OnExecuting(FunctionClient funcClient)
at Spotfire.Dxp.Data.DataFunctions.Executors.AbstractFunctionClient.<RunFunction>d__0.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.Executors.SPlusFunctionExecutor.<ExecuteFunction>d__0.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.<ExecuteFunction>d__6.MoveNext()
TIBCO Enterprise Runtime for R returned an error: 'Error in .loadNamespaceImpl(package, path, keep.source, partial) : error executing useDynLib for dynamic library 'purrr' from package 'purrr' loaded from C:/Users/WaghPr02/Documents/TERR/x86_64-pc-windows-library/4.3 : Error in library.dynam(chname = chname, package = package, lib.loc = ... : Foreign binary purrr could not be loaded'.
at Spotfire.Dxp.Data.DataFunctions.Executors.LocalFunctionClient.OnExecuting(FunctionClient funcClient)
at Spotfire.Dxp.Data.DataFunctions.Executors.AbstractFunctionClient.<RunFunction>d__0.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.Executors.SPlusFunctionExecutor.<ExecuteFunction>d__0.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.<ExecuteFunction>d__6.MoveNext()
Anyone knows how to solve this problem?
Many Thanks in advance!