Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can R produce on-the-fly graphs for website?

Tags:

sql-server

r

I use a Flex/ColdFusion/MSSQl combo to take input from users to generate charts for a website . Is this possible in R? I have used RODBC and sqlQuery as a way of producing static graphs but cannot seem to find a way of doing it dynamically. Over to you JU

like image 465
pssguy Avatar asked Jun 20 '11 20:06

pssguy


People also ask

Can R create graphs?

In R, graphs are typically created interactively. The plot( ) function opens a graph window and plots weight vs. miles per gallon. The next line of code adds a regression line to this graph.

Which of the following is recommended type of graphs in R?

The most commonly used graphs in the R language are scattered plots, box plots, line graphs, pie charts, histograms, and bar charts. R graphs support both two dimensional and three-dimensional plots for exploratory data analysis.

How do I export an interactive plot in R?

Method 2: R Code The simplest method is to use the export function from the plotly package. You simply specify which graph to save (called fig in our example) and specify the file location, name, and type with the file argument. This function can save plotly graphs as . png, .


1 Answers

Of course you can, you can use fantastic Apache module that allows stateless execution of R scripts - RApache. You can define an R script and catch (unserialize) plot parameters (e.g. via JSON or URL encoded string), plot the graph, and load result(s) with AJAX. That's pretty much what I did in my app.

If you're not satisfied with R graph capabilities (and I'm sure that's so not gonna happen), you can try out googleVis or canvas packages. The first one is "only" a library for GoogleVis API for R, and I'm sure you'll like the later if you're familiar with HTML5 canvas. Some lads found it useful.

So, the final answer is, yes, you can!. You only need to decide whether you're going to generate graphs on client or server-side. Of course, even if you decide to generate graphs on the client side, you must massage your data in R and return it in serialized form (JSON or XML encoded). I know that ExtJS 4 also has good interface for creating client-side graphs, but I haven't used it much (read: "at all").

like image 150
aL3xa Avatar answered Sep 21 '22 02:09

aL3xa