tags:

views:

53

answers:

2

Dear all,

can anyone point me to a good start for developing a JGR dependable R application? Roughly speaking I want to do something that enhances the JGR menu by some options just like Deducer (btw now available with ggplot2!!) does (of course I want to do it in a much much simpler way). Basically the application is a GUI for rendering periodical reports that use Sweave .Rnw as some "templating language", but have some frequently changing text.

So ...

1) Is it reasonable to connect it to R / JGR ? or should I just create some stand-alone Java program or Python script that does the job... ?

2) Which part should be written in Java and which in R ? I checked Deducer's source code and found quite a bit of JAVA... which parts would you recommend doing in JAVA ?

3) Can you point me to other packages, and less complex than Deducer that use JGR, so hopefully I can learn from their code?

4) Is there another way to add some menu to the standard R GUI, that would work on "all" OS (Linux, Windows, Mac OS X) ?

Thx for any suggestions, pointers and do-NOT-do-it shouts in adavance!

+1  A: 

OK, I'm going to answer the 1st and the 4th one:

Ad 1. IMHO, it's not "reasonable" to create GUI for Sweave... If I'm writing a report, I'd like to do something like:

There were gathered \Sexpr{length(na.omit(x))} valid responses, 
with mean of \Sexpr{mean(x, na.rm = TRUE)} and 
standard deviation \Sexpr{sd(x, na.rm = TRUE)}.

<<qqplot, echo = FALSE, fig = TRUE>>==
qqplot(x)
qqnorm(x)
@

LyX already does that (though I use Emacs with ESS and AUCTeX). I mean, you can write a JAVA GUI and facilitate some features... but you must dazzle if you want to get noticed, otherwise, you're destined to invent what's already invented. But you can contribute... just... don't start from scratch without a good reason.

Ad 4. Yes, there is: RApache and/or RServe. You can mash-up R with some nifty JS library (like ExtJS) and do something like Jeroen Ooms did in his ggplot2/stockplot/lme4/IRT tool application(s). brew package is quite useful. There are drawbacks: you need server access, Internet access on the client, but it's cross-platform and server is a beast of a machine, so imagine what it be like to crunch some big data on desktop machine... server/cloud can do it in an eye-blink time.

Since I don't know how to write a single bloody thing in JAVA, HTML/CSS/JavaScript/PHP/MySQL/etc. with R is my weapon of choice.

So there...

Good luck!

aL3xa
Thx. This is great, I really hope to get several more like this. Here are a few notes: - I do not want to revent WYSIWYG for LaTeX, the guys @Lyx done it better, involving JGR was what I wanted to do to prevent starting from scratch- I do know RApache, brew and Jeroen Ooms fantastic stuff. I did not know RServe and will definitely check it (and also have a closer look to the others again).
ran2
Hell, I think RServe might be exactly what I need.. thx a bunch!
ran2
That's right, RServe has JAVA client... and a client doesn't necessarily have to be a browser! =) Though you can write JAVA applets that will execute in the browser. About Sweave... you can contribute, R definitely needs user-friendly report preparation system.
aL3xa
I hope I can create something good enough to contribute, but if there's anything where I can finally start to contribute it's at this point.
ran2
+2  A: 

For your answer to 4 one can use gWidgetsWWW to create an interactive web page to gather the users input. It can be run on a server with RApache or standalone using the help page web server for R. Here is an example web page. (To run standalone, save this somewhere, say /tmp/test.R, and load with localServerStart("/tmp/test.R")

runSweave <- function(...) {
  ## replace with real deal
  ## point is l holds values:
  values <- sapply(l, svalue, simplify=FALSE)
  gmessage(message=sprintf("Run sweave using inputs %s and %s", values$one,values$two), parent=w)
}

runAbout <- function(...) {
  gmessage("A simple GUI for running a report", parent=w)
}

w <- gwindow("Write a report")
l <- list()

actions <- list(run=gaction(label="run",  handler=runSweave, parent=w),
                about=gaction(label="about", handler=runAbout, parent=w))

gmenu(actions, cont=w)

g <- ggroup(cont=w, horizontal=FALSE)
ghtml(boilerplate <- paste("Lorem ipsum dolor sit amet, consectetur adipisicing elit,",
                           "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
                           "Ut enim ad minim",
                           sep="</br>"),
      cont=g)

l$one <- gedit("Enter text here", cont=g)
ghtml(boilerplate, cont=g)
l$two <- gedit("Enter more text here", cont=g)

gstatusbar("thats it...", cont=g)
visible(w) <- TRUE
jverzani