Date Posted:
Product: TIBCO Spotfire®
Product: TIBCO Spotfire®
Problem:
How to dynamically change real values to integer values for a data table that is generated from an R or TERR data frame via Spotfire data function.
Solution:
How to dynamically change real values to integer values for a data table that is generated from an R or TERR data frame via Spotfire data function.
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 functions can be used to convert real numbers into integers before returning the data frame to Spotfire:
trunc()
floor()
ceiling()
as.integer()
These functions work the same way in TERR and in open-source R. The following are some example calls to those functions and their help topics, using TERR 4.4.0:
=================================================
TIBCO Software Inc. Confidential Information
Copyright (C) 2011-2017 TIBCO Software Inc. ALL RIGHTS RESERVED
TIBCO Enterprise Runtime for R version 4.4.0 for Microsoft Windows 64-bit
Type 'help()' for help.
Type 'q()' to quit.
>
>
Copyright (C) 2011-2017 TIBCO Software Inc. ALL RIGHTS RESERVED
TIBCO Enterprise Runtime for R version 4.4.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
>
>
> trunc( testVec )
[1] 3 -3
>
>
> floor( testVec )
[1] 3 -4
>
>
> ceiling( testVec )
[1] 4 -3
>
>
> as.integer( testVec )
[1] 3 -3
>
>
>
> ?trunc
> ?floor
> ?ceiling
> ?as.integer
>
=================================================
The help topics that are opened by the following TERR commands:
?trunc
?floor
?ceiling
?as.integer
Comments
0 comments
Article is closed for comments.