The Spotfire Community is moving to TIBCOmmunity and this forum location has closed. During the transition, you can still search the old forums but posting has been disabled. We encourage you to pick up the discussion at the new Spotfire community on TIBCOmmunity.
Drawing plots using R - TIBCO Spotfire Community

Drawing plots using R

Last post Thu, Jul 25 2013 8:05 AM by amitd. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • Mon, Oct 11 2010 6:54 PM

    Drawing plots using R

     Hello everyone...

     Here's that example I showed at the Spotfire User Conference last week of drawing a plot from R and displaying it in a text area.

    Essentially a user would select the columns they're interested in doing a correlation analysis. This uses a R library called corrgram

    The input is a data table and the output is a plot of type value. The input table uses an expression to get all of the columns from the data table so the user can select them in a drop down box. The output is a document property called plotImage that is a binary type.

    In the text area to display the image, it's a property label that references the plotImage property...

    library(corrgram)
    # plot correlation matrix
    var <- colnames(input.table)
    corr.input <- input.table[,var]
    t = tempfile()
    grDevices::png(file=t,width = 1000, height = 1000)
    corrgram(corr.input, order=TRUE,
             main="Correlograms",
             panel=panel.ellipse,
             text.panel=panel.txt)
    grDevices::dev.off()
    output <- data.frame(r=readBin(file(t, open="rb"), what="raw", n=(file.info(t)$size)))
    unlink(t)
     

    Filed under:
  • Sat, May 7 2011 10:20 PM In reply to

    Re: Drawing plots using R

    Hi,

    Can you please provide "yeast heat shock.csv " file. I tried to open attached zipped file but spotfire file requires this file.

     

    Thanks

    Achalesh

     

  • Mon, May 9 2011 2:16 AM In reply to

    Re: Drawing plots using R

    the dataset was derived from here... just dump it to a file and then replace the data table with that one http://www.bioconductor.org/packages/release/data/experiment/html/yeastCC.html
  • Mon, Jun 27 2011 2:04 AM In reply to

    Re: Drawing plots using R

    Hello Stephen

    I am new to spotfire ,I am trying to execute the DF in spotfire . I want same output as discussed above but using S+ scripts

    so can you please tell me how to write the S+ script for the above mentioned input and output

    Clarify me this as well,In order to run the S+ scripts in tibco spotfire professional do we need to deploy any packages ??? 

    Thanks

    SAI

  • Fri, Jun 28 2013 5:25 AM In reply to

    Re: Drawing plots using R

    Hello Stephan

     

    I also have similar doubt but.. more basic as to I am new for the statistical part in tibco spotfir.

    So can you please help me as to how to add our own data funtion in R lirary. so that we just need to call that function rather than writing the entire script  in the R script editter

  • Wed, Jul 24 2013 10:35 PM In reply to

    • amitd
    • Not Ranked
    • Joined on Wed, Jul 17 2013
    • Posts 3

    Re: Drawing plots using R

    Hi Stephen, Thank you for sharing the code. When I run the above code, I get following message. Could not execute function call. TIBCO Spotfire Statistics Services returned an error: 'library(pkg, character.only = TRUE) : there is no package called 'corrgram''. at Spotfire.Dxp.Data.DataFunctions.Executors.SPlusFunctionExecutor.d__12.MoveNext() at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.d__6.MoveNext() So, I added install.packages ("corrgram") in the code, but, still the same issue. Can you help?
    Filed under:
  • Thu, Jul 25 2013 7:00 AM In reply to

    Re: Drawing plots using R

    It is likely because you installed the corrgram package as yourself? you can do this something like this to specify a specific location install.packages("zoo", lib="C:/software/Rpackages") then in your script you need to do this.. .libPaths( c( .libPaths(),"C:/software/Rpackages"))
  • Thu, Jul 25 2013 7:42 AM In reply to

    • amitd
    • Not Ranked
    • Joined on Wed, Jul 17 2013
    • Posts 3

    Re: Drawing plots using R

    Thanks Stephen for the reply. It may be a dumb question, but do you specify install.packages inside your R data function script? Typically, when I write R code, it is part of the code.
  • Thu, Jul 25 2013 7:48 AM In reply to

    Re: Drawing plots using R

    it depends... if you have many users wanting to run a specific package then it makes sense to install it once in a shared library.. The tibco stats server shouldn't be running as you but as some app user... so you could install it as them or probably best to install it as you and specify the location..
  • Thu, Jul 25 2013 8:05 AM In reply to

    • amitd
    • Not Ranked
    • Joined on Wed, Jul 17 2013
    • Posts 3

    Re: Drawing plots using R

    Thanks. Typically in my company, not a large number of people use R inside Spotfire. So, assuming that I am the only one who needs it for now, will my R script look something like this? install.packages("zoo", lib="C:/software/Rpackages") # I assume this is the directory pointing to Tibco. libPaths( c( .libPaths(),"C:/software/Rpackages")) library(corrgram) # plot correlation matrix var
Page 1 of 1 (10 items)
┬ęCopyright 2000-2011 TIBCO Software Inc | Privacy Policy | Terms of Use I Blog I Contact Us I Content Center