Paul Johnson
2012-Jan-28 19:59 UTC
[Rd] need gui matrix editor: does R Core team have advice on how?
Dear R-devel: Would R core team consider endorsing a graphical toolkit and trying to facilitate development of little GUI tools? I need a gui matrix editor for users that want to be able to write matrices that are later used to simulate data. Instead of teaching them to write a covariance matrix (for example, for mvtnorm), I want to tell them run a function that pops up a table they can fill in. The users need to be able to enter variable names in the matrix, so something that would accept a 0 0 0 b 0 c d e would be great. Something that would accept formulae like this would be even more great. a 0 0 0 b a^2 c d e I want this gui matrix editor to "just work" on Windows, Mac, Linux. I don't mind building this on top of some widget set, but it is important that the widget set be easily installable on the user end. That's why I wish R core would offer us some guidance or advice. I'm not a programmer, but I can learn to program with a library, as long as it is not a waste of time. I've been searching R archives and here's what I found so far. 1. tcl/tk Building on R tcltk2, for people that have the Tcl addon widget TkTable installed, there are several packages. in tcltk2 itself, there is a function tk2edit, and there are others that try to embellish. I've tried several of these, they seem to be not-quite done yet, one can't copy a rectangle, for example. But maybe I could learn how to fix them up and make yet another tktable based editor. Problem: requires user to have enough understanding to install the Tcl widget TkTable. And, for platforms like Windows, user has to install tcl/tk itself. On Linux and Mac, that is not as big of a hurdle, so far as I can tell. On Debian linux, I found that in a package libtktable that works, but I have no idea how tough that would be on other linux systems or Macintosh or Windows. Another problem is that tcl/tk editions change rapidly, and on several of our systems, we still don't have access to tcl/tk 8.5 (RedHat/Centos based clusters still running version 5 are like that). 2. Gtk Building on Rgtk, I found the package RGtk2Extras. This of course requires a function gtk tool chain, which used to be a big problem on the various platforms. But the function dfedit appears to be almost exactly what I'm looking for. I can create a character matrix and put in letters how I want, but I later face the problem of how to evaluate the matrix. Problem: even more than tcl/tk, GTK versions change and become incompatible, especially across platforms. What about QT or WX-Widgets. I gather RkWard is built on KDE, and hence Qt. I don't find matrix editors using those languages, but I don't know why not. Maybe this is impossible for R core to advise us because you may disagree on which widget library is best, but if there is some consensus, I would be glad to know because I would do whatever you recommend. I'm pretty sure that, if you said, "use library X, version XYZ", then the worldwide usage of R is sufficiently broad that people would step forward and help make sure those libraries are packaged for all OS. I mean, if there were no tktable package for any linux for which I make packages (RedHat, Fedora, Debian, Ubuntu), I would create the packages. But I'm not doing it now because I have no reason to believe that is a good path from here on out. -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas
Gabor Grothendieck
2012-Jan-28 21:33 UTC
[Rd] need gui matrix editor: does R Core team have advice on how?
On Sat, Jan 28, 2012 at 2:59 PM, Paul Johnson <pauljohn32 at gmail.com> wrote:> Dear R-devel: > > Would R core team consider endorsing a graphical toolkit and trying to > facilitate development of little GUI tools? > > I need a gui matrix editor for users that want to be able to write > matrices that are later used to simulate data. ?Instead of teaching > them to write a covariance matrix (for example, for mvtnorm), I want > to tell them run a function that pops up a table they can fill in. > > The users need to be able to enter variable names in the matrix, so > something that would accept > > a ?0 ?0 > 0 ?b ?0 > c ?d ?e > > would be great. ?Something that would accept formulae like this would > be even more great. > > a ?0 ?0 > 0 ?b ?a^2 > c ?d ?e > > I want this gui matrix editor to "just work" on Windows, Mac, Linux. I > don't mind building this on top of some widget set, but it is > important that the widget set be easily installable on the user end. > > That's why I wish R core would offer us some guidance or advice. ?I'm > not a programmer, but I can learn to program with a library, as long > as it is not a waste of time. > > I've been searching R archives and here's what I found so far. > > 1. tcl/tk > > Building on R tcltk2, for people that have the Tcl addon widget > TkTable installed, there are several packages. ?in tcltk2 itself, > there is a function tk2edit, and there are others that try to > embellish. ?I've tried several of these, they seem to be not-quite > done yet, one can't copy a rectangle, for example. But maybe I could > learn how to fix them up and make yet another tktable based editor. > > Problem: requires user to have enough understanding to install the Tcl > widget TkTable. ?And, for platforms like Windows, user has to install > tcl/tk itself.Regarding Windows, both the tcltk R package and tcl/tk itself are included with R for Windows and work out of the box without doing anything special. You can use addTclPath(libdir) to add additional locations to the tcl library search path so you can include additional tcl/tk packages in your R package and in conjunction with system.file(..., package = "myPackage") you can have them automatically accessed without the user having to do anything special. Also you can use all or nearly all of tcl's facilities including sourcing your own tcl code and you can issue tcl commands one by one from R too using the facilities of the tcltk package. There are also various other R packages that build on top of tcltk. I too think that a standard R installation should ensure that tcltk just works out of the box but that seems not to be the case for every R distribution although it is true for some (possibly most) including the standard Windows distribution. -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com