This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"R" graph output

 
Augusto Sellhorn
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Robert;

Just read the intro to your book, very interesting stuff. This is the first time I've read about the "R" language, but it sounds like something I should be looking at since part of my job is to find interesting ways to visualize data.

Now the graphs you create in "R", how are they output, are they displayed on a top level window when you run "R" programs or is there more control for the output, say save it is a PNG, or output to a stream? I'm just wondering how you capture the graphical output if you wanted to say show the results in a webpage.

Oh and BTW, is "R" a JVM language? I get the impression it is not, but just wondering ...

Thanks!

Augusto
 
Robert Kabacoff
author
Ranch Hand
Posts: 33
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Augusto,

When you run R interactively, you have the choice of directing a graph to device window (the default) and/or saving it to a pdf, png, jpeg or postscript file. Multiple images can be saved in a single pdf. On windows, you can also save the image as a windows metafile (wmf) or bmp file.

So for example, if I execute the command
plot(mygraph)
at an interactive prompt, a window will pop open with the graph displayed. I can save the file to multiple formats from menu options in that window.

If I execute the command
png("mygraph.png")
at an interactive prompt, the graph is saved to the file mygraph.png.

If you run an R script in batch, then you would want to write the graph to a file.

BTW, there are R packages (e.g., R2HTML) that will help you to embed R graphics in web pages easily.

R is not a JVM language.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic