Product: TIBCO Spotfire®
Example TERR / RinR / RGraph() data function that returns a column of R qqnorm() graphs in a Spotfire data table
Example TERR / RinR / RGraph() data function that returns a column of R qqnorm() graphs in a Spotfire data table.
The example TERR / RinR / RGraph() data function in the attached DXP file (Filename: "qqnormGraphsInDataTableColumn.dxp") returns a column of R qqnorm() graphs in a Spotfire data table and displays the graphs in a Table visualization.
The DXP file's "qqnormGraphs" data function expects the "FuelFrame" data table as the 'FuelFrame' input data frame for its TERR script and returns the script's output 'qqnormGraphsDF' data frame as its "qqnormGraphsTable" output data table.
This is the TERR script:
library( RinR )
PathToOpenSourceR <- "C:/Program Files/R/R-3.3.2/bin/x64/R"
if( ! file.exists( PathToOpenSourceR ) )
stop( paste( "The specified path to open-source R (", PathToOpenSourceR, "does not exist in this environment. Please specify a valid path, including the name of the executable, such as 'R.exe', in the data function's TERR script." ) )
options( RinR_R_FULL_PATH = PathToOpenSourceR )
FuelFrameSplit <- split( FuelFrame$Mileage, FuelFrame$Type )
X = FuelFrameSplit,
FUN = function(X)
data = list( X = X ),
height = 680,
width = 680,
par( mar = c(8, 6, 6, 4) + 0.1 )
qqnorm( X, pch = 16, col = "blue", cex = 3,
cex.main = 3, cex.axis = 2.5, cex.lab = 3)
qqline( X, col = "red", lwd = 3)
} ) )
VehicleType = names( qqnormGraphsList ),
PlotImage = seq( along = qqnormGraphsList ),
stringsAsFactors = FALSE )
qqnormGraphsDF[["PlotImage"]] <- qqnormGraphsList
Information on TERR functions used in this example can be found in the help files that are opened by the following TERR commands:
help( "RGraph", try.all.packages = T )
Information on R graphics functions used in the example TERR script's call to RinR::RGraph() can be found in the help files that are opened by the following open-source R commands:
Note that R graphics are not implemented in TERR at this point, so the following command would not create a graph in TERR:
qqnorm( Sdatasets::fuel.frame$Mileage )
Disclaimer: The code in this article is only a sample to be used as a reference. It is not intended to be used "As Is" in a Production environment. Always test in a Development environment. Make modifications to the code in accordance with your implementation specifications that best suit your business requirements. Refer to the reference(s) cited in this article for usage of the functions and methods used in the code.
Article is closed for comments.