Re: [R] link for refernces

2012-08-26 Thread jverzani
punitha  wipro.com> writes:

> 
> Please can anyone suggest me some links which have complicated examples with
> code of *GUI in R(tcltk package),* 
> 

There is some code in the ProgGUIInR package:

http://cran.r-project.org/web/packages/ProgGUIinR/

The `browseTclTkFiles` function will let you  browse it easily.

--John

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to arrange the GUI's in window in tcltk package???

2012-08-25 Thread jverzani
punitha  wipro.com> writes:

> 
> Thank you steven,
> 
> tkpack is helping me in arranging the components in container.
> 
> and yes, i went through gwidgets package, i found it also good to design GUI
> in R.
> 


Try `tkraise`:

library(tcltk)
w1 <- tktoplevel()
tkpack(ttkbutton(w1, text="w1", command=function() {
  tkraise(w2)
}))

w2 <- tktoplevel()
tkpack(ttkbutton(w2, text="w2", command=function() {
  tkraise(w1)
}))




> --
> View this message in context: http://r.789695.n4.nabble.com/
> How-to-arrange-the-GUI-s-in-window-in-tcltk-
> package-tp4641279p4641294.html
> Sent from the R help mailing list archive at Nabble.com.
> 
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building Custom GUIs for R

2011-05-20 Thread jverzani
vioravis  gmail.com> writes:

> 
> I am looking to build simple GUIs based on the R codes I have. The main
> objective is to hide the scary R codes from non-programming people 
> and make it easier for them to try out different inputs.
> 

... snip ...


> Are there any tools currently available that enable us build GUIs??? (MATLAB
> has a GUI builder that enables the users build custom GUIs). 
> 


R has lots of packages to assist in making GUIs. Quickly, some are:

tcltk: a recommended package with R for quite awhile. See Rcmdr and GrapheR 
for two excellent packages that use it.

RGtk2: an add-on package to integrate R with the GTK libraries (as well 
cairoDevice).  See RGtk2DfEdit, playwith and latticist for example usage, 
and rattle to see how  GTK's GUI design tools can be integrated in.

qtbase: New, not yet on CRAN. Integrates R with Qt libraries. To see an 
example, 
fly out to San Franciso and catch a ride down to Google: 
http://www.meetup.com/R-Users/events/18876401/

The gWidgets packages provide an easier to learn but more limited 
interface to the above packages.

In addition, R can interface with other languages: rJava (deducer), 
rpy2(RedR), RCpp 
(http://dirk.eddelbuettel.com/blog/2011/03/25/#rinside_and_qt), ...

--John



> Can we make a exe of such GUI (with the R code) and let people use it
> without having to install R???
> 
> Any help on this would be much appreciated??
> 
> Thank you.
> 
> Ravi
> 
> --

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with Using gtext in gWidgetsWWW for Outputting Results to Webpage

2011-05-07 Thread jverzani
jverzani  gmail.com> writes:


I was remiss in not mentioning the use of the nifty hwriter package for 
formatting  tables for display through ghtml as an alternative to using 
gtext for what you want  to do. See the package description at:
http://www.embl.de/~gpau/hwriter/

--John

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with Using gtext in gWidgetsWWW for Outputting Results to Webpage

2011-05-07 Thread jverzani
Ron Fricker  nps.edu> writes:

Ron,

A few things. 

I am in the process of rewriting this package to use the new Rook package. 
The current  package is on r-forge as gWidgetsWWW2. It works for local use, 
but Rook  isn't yet integrated in with rapache to serve in a public way. 
(https://r-forge.r-project.org/R/?group_id=761)

Second, the gtext widget has two methods for setting the text: svalue<- will 
replace the current text, and sounds like what you want. The insert method 
can  be used to add to the current text, either at the beginning or 
end (It just calls svalue in the end). It sounds like you are using insert.

Third, I had some issue with "\n" in the text, so added a call to some 
internal  method stripSlashN to replace \n with . That might not be 
working for you. You can try to replace these yourself. The fact that 
gWidgetsWWW uses  proto (gWidgetsWWW2 doesn't) means you can 
hack some things. Here you  can bypass the stripSlashN call by 
redefining the method, doing something like:

t <- gtext("", ) ## your usual call
t$setValueJS <- function(.,...) {
  out <- sprintf("%s.setValue('%s');", .$asCharacter(), .$..data)
  return(out)
}

You might need some other function wrapping .$..data, which stores the 
raw data. (The \n caused problems when passed back to the browser. 
The gWidgetsWWW2 implementation bypasses this, so should work better 
going  forward.)

Finally, the font stuff isn't implemented. I think (but didn't check) you can 
use HTML markup within your text.


Feel free to email directly if you want to.

--John

.. snip ...

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] gtk, RGtk2 and error in callback: delet_event in mai window

2011-03-28 Thread jverzani
Cleber N. Borges  yahoo.com.br> writes:

> 
> Hello All,
> 
> I am trying to learn about the GUI in R (with GTK+Glade+RGtk2) and in my 
> test I don't get sucess in to make
> an callback to destroy the application...
> 
> When I try to define an function for "delet-event callback", I get the 
> error message:
> (with mouse click in X window)
> 
> *Error in function ()  : *
> *  unused argument(s) (, )*
> 
> So, somebody has a tips for me?
> Thanks in advanded
> 
> Cleber


The callback is expecting two variables to be passed in. If you aren't 
going to use them,  just put ... in  the signature:

window1_delete_event <- function(...) print('Work or dont work???')

... snip ...

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] User input in R program

2011-01-21 Thread jverzani
christiaan pauw  gmail.com> writes:

> 
> HI Everybody
> 
> Does anyone know of documentation about different ways of obtaining user
> input in R. I have used readline() but I wondered is there are sophisticated
> packages that does things like validate answers or generate selection
> lists.

You might consider the gWidgets package. Like rpanel, there are many functions 
that make this kind of thing quite easy to implement.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Playwith-problem with loading

2010-11-16 Thread jverzani
Fencl, Martin  eawag.ch> writes:

> 
> Helllo,
> I am having trouble with running the library Playwith in the R-2.12.0. running
under 32bit Windows XP.
> After calling the library the error message "The procedure entry point
gdk_cairo_reset_clip could not
> be located in the dynamic library libgdk-win32-2.0-0.dll." occurs and the R
asks for instaling the GTK+
> package. However the instalation of GTK+ thorugh the R fails. I have installed
GTK+ by installing GIMP 2.0
> version 2.6.10 and set the path of environment variables. But it still does
not work. It seems to be that the
> problem is in gtk2 (which I also installed).
> Thank you for any hints!
> 
> > library(playwith)
> Loading required package: lattice
> Loading required package: cairoDevice
> Loading required package: gWidgetsRGtk2
> Loading required package: gWidgets
> Error in inDL(x, as.logical(local), as.logical(now), ...) : 
>   unable to load shared object
'C:/PROGRA~1/R/R-212~1.0/library/RGtk2/libs/i386/RGtk2.dll':
>   LoadLibrary failure:  The specified procedure could not be found.

This is an issue that has arisen with the new RGtk2 package. For most (but not
all) the solution has been to a) remove the current gtk libraries b) install the
newest ones from sourceforge and c) reinstall RGtk2. For you, it may be that you
need only to set the path appropriately. 


> 
> Failed to load RGtk2 dynamic library, attempting to install it.
> trying URL
'http://downloads.sourceforge.net/gtk-win/gtk2-runtime-2.22.0-2010-10-21-ash.exe?download'
> Content type 'application/x-msdos-program' length 7820679 bytes (7.5 Mb)
> opened URL
> downloaded 7.5 Mb
> 
> Learn more about GTK+ at http://www.gtk.org
> If the package still does not load, please ensure that GTK+ is installed and
that it is on your PATH
> environment variable
> IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN
> Error : .onAttach failed in attachNamespace() for 'gWidgetsRGtk2', details:
>   call: .Call(name, ..., PACKAGE = PACKAGE)
>   error: C symbol name "S_gtk_icon_factory_new" not in DLL for package "RGtk2"
> Error: package 'gWidgetsRGtk2' could not be loaded
> > 
> 
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] drilling down data on charts

2010-10-14 Thread jverzani
Greg Snow  imail.org> writes:

> 
> It is not clear what exactly you want.  Try looking at the functions
TkPredict, TkSpline, and TkApprox in the
> TeachingDemos package to see if any of those do what you want.
> 
> If not, give a bit more of a description and include some sample data.
> 

You could program something by using locator() perhaps although as 
Greg mentions
it isn't clear what you want.

Along those lines, in addition to the above mentioned packages, 
you might want to look at some packages that use cairoDevice 
to create interactive graphic displays. For example, you might 
find ready made features in playwith or you can use gWidgetsRGtk2 
to create something on your own.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R user interface

2010-06-17 Thread jverzani
Shubha Vishwanath Karanth  ambaresearch.com> writes:

> 
> Hi R,
> 
> I have a an excel file with a lot of data. I need to create an user
> interface in R, which has one single screen. It needs to contain a right
> pane containing the click buttons for different countries (say). If the
> user clicks a country, then a chart needs to be created for that
> country, taking the data from Excel. Is this possible and which package
> helps me in doing this? Many thanks in advance.
> 
> Thanks and Regards,
> 

If you don't mind installing the GTK libraries, then the traitr package can be
used here without too much difficulty.  Here is what you can do for your request
(a stripped down version of a demo in the vignette)

## sample data, replace me
d <- data.frame(country=c("US","US","Canada","Mexico"),
x = rnorm(1:4),
y = rnorm(1:4))

library(traitr)
library(gWidgets) ## also gWidgetsRGtk2, cairoDevice
options(guiToolkit="RGtk2")

countries <- unique(d$country)

dlg <- aDialog(items=list(
 output=graphicDeviceItem(),
 countryFilter=choiceItem(value=countries, values=countries,
   multiple=TRUE, show_label=FALSE)
 ),
   help_string="Use filter to narrow",
   ## this is called when the countryFilter checkbox is clicked
   property_countryFilter_value_changed=function(.,...)
 .$make_plot(),
   ## this draws the plot
   make_plot=function(.) {
 countries <- .$get_countryFilter()
 ## adapt this:
 plot(y ~ x, data=d, subset=country %in% countries)
   })
view <- aPanedGroup(aContainer("output"),
aFrame(label="Filter by:",
   aFrame("countryFilter", label="Country")),
horizontal=TRUE
)
dlg$make_gui(gui_layout=view)
dlg$make_plot()


> Shubha Karanth 
> 
> This e-mail may contain confidential and/or privileged i...{{dropped:13}}
> 
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] re trieve user input from an tcl/tk interface

2009-09-29 Thread jverzani
einsundeins  gmail.com> writes:

> 
> 
> Hello everyone,
> 
> this is my first post here and I hope I signed up correctly and someone will
> take me by the hand and help me out. I am new to R and cannot figure out
> what to do here...
> 
> ... I want to have an User Interface that requests input. I want to save
> this input to a variable to use it later on. I was able to do this with a
> modalDiaglog (
> http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/modalDialog.html like
> this ) but I cannot figure out how to do this with multiple values to be
> read.
> 
> I want to run a rather simple simulation and the user has to be able to set
> multiple parameters (say, number of trials and stimuli). The onOK-function
> should then "collect" these parameters and save them to variables (I guess). 
> 

Dear Florian, you may want to look at the gWidgetstcltk package which makes such
things a bit easier than plain tcltk. Here is one way with a modal dialog:

f <- function() {
  library(gWidgets)
  options("guiToolkit"="tcltk")
  dlg <- gbasicdialog()
  tbl <- glayout(cont = dlg)
  tbl[1,1] <- "trials"
  tbl[1,2] <- (trials <- gedit("100", coerce.with=as.numeric, cont = tbl))
  tbl[2,1] <- "Stimuli"
  tbl[2,2] <- (stimuli <- gedit(10, coerce.with=as.numeric, cont = tbl))
  visible(dlg, set=TRUE)

  return(sapply(list(trials, stimuli), svalue))
}


> 
> Best regards,
> Florian

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] any advice on web interfaces to R?

2009-09-23 Thread jverzani
Mitchell Maltenfort  gmail.com> writes:

> 
> I saw http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-Web-Interfaces
> and I'm still not sure yet which platform (Linux, Windows, etc.) I'll
> be working on -- and no, it's not under my control to pick.
> 
> I was wondering if anyone out there had good advice, that would save
> me time and stomach acid, on how to set up a web browser to send a
> list of commands to an R and put the resulting table or graph in a web
> page.
> 
> Thanks!
> 
> 

It isn't cross platform (no windows) but RApache is a very good framework for
this. Take a look at http://www.jeroenooms.com/stockplot.html to see a fancy
use. For an alternative interface, where no web programming is needed, you can
look at http://www.math.csi.cuny.edu/gWidgetsWWW/.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.