The Spotfire data function will return integer columns in the TERR data frame to Spotfire as Integer columns in the data table. The following TERR expressions can be used to convert real numbers into integers before returning the data frame to Spotfire:
as.integer( trunc() )
as.integer( floor() )
as.integer( ceiling() )
as.integer()
These functions work the same way in TERR and in open-source R.
NOTE: Both in TERR and in open-source R, the trunc(), floor() and ceiling() functions return objects of class "numeric", which will become Real values in Spotfire. Wrapping calls to these functions in calls to as.integer() converts their results into "integer" values that will become Integer values in Spotfire.
The following are some example calls to those functions, along with the commands that open their help topics, using TERR 6.0.0:
pi
testVec <- c( pi, -pi )
testVec
as.integer( trunc(testVec) )
as.integer( floor(testVec) )
as.integer( ceiling(testVec) )
as.integer(testVec)
?trunc
?floor
?ceiling
?as.integer
=================================================
TIBCO Software Inc. Confidential Information
Copyright (C) 2011-2020 TIBCO Software Inc. ALL RIGHTS RESERVED
TIBCO Enterprise Runtime for R version 6.0.0 for Microsoft Windows 64-bit
Type 'help()' for help.
Type 'q()' to quit.
>
>
> pi
[1] 3.141593
>
>
> testVec <- c( pi, -pi )
>
>
> testVec
[1] 3.141593 -3.141593
>
>
> as.integer( trunc(testVec) )
[1] 3 -3
>
>
> as.integer( floor(testVec) )
[1] 3 -4
>
>
> as.integer( ceiling(testVec) )
[1] 4 -3
>
>
> as.integer(testVec)
[1] 3 -3
>
>
=================================================