Re: [R] Tk grid problem

2012-07-16 Thread j verzani
vincent guyader  gmail.com> writes:

> 
> Hi everybody,
> 
> I have a problem with the grid function in tk.
> I juste try to put 4 buttons like this:
> 
> ---
> |||
> ||   C|
> |   A||
> |||
> --   D|
> |||
> |   B||
> ---
> 
> A is 2x2
> C is 1x2
> B is 1x2
> D is 2x2
> 
> but the code bellow dont work :
> 
> require(tcltk)
> tt <- tktoplevel(borderwidth=10)
> 
> A.but <- tkbutton(tt,text="A",command=function()ls())
> B.but <- tkbutton(tt,text="B",command=function()ls())
> C.but <- tkbutton(tt,text="C",command=function()ls())
> D.but <- tkbutton(tt,text="D",command=function()ls())
> 
> tkgrid(A.but,row=1,column=1,columnspan=2,rowspan=2,sticky="nswe")
> tkgrid(B.but,row=3,column=1,columnspan=2,rowspan=1,sticky="nswe")
> tkgrid(C.but,row=1,column=3,columnspan=2,rowspan=1,sticky="wens")
> tkgrid(D.but,row=3,column=3,columnspan=2,rowspan=2,sticky="wens")
> 
> any idea?
> 

The row for D.but should be 2, not 3 though I would index at 0 not 1:



tkgrid(A.but,row=1-1,column=1-1,columnspan=2,rowspan=2,sticky="nswe")
tkgrid(B.but,row=3-1,column=1-1,columnspan=2,rowspan=1,sticky="nswe")
tkgrid(C.but,row=1-1,column=3-1,columnspan=2,rowspan=1,sticky="wens")
tkgrid(D.but,row=3-1-1,column=3-1,columnspan=2,rowspan=2,sticky="wens")


Then to get the buttons to expand into the allocated sace, you can configure 
the row and column weights:

sapply(0:3, function(i) {
  if(i < 3) tkgrid.rowconfigure(tt, i, weight = 1)
  tkgrid.columnconfigure(tt, i, weight = 1)
})





> thx
> 
> Vincent
> 
>   [[alternative HTML version deleted]]
> 
>

__
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] gWidgets - gtable returning multiple values

2012-06-16 Thread j verzani
michaelyb  gmail.com> writes:

> 
> To whoever is looking for the same thing as I was,
>  I found a solution, or
> sort of.
> Here is the code:
> 
> flavors<-c("vanilla", "chocolate", "strawberry") 
> 
> w <- gwindow("checkbox example") 
> gp <- ggroup(container=w) 
> glabel("Favorite flavors:",cont=gp) 
> cbg <- gtable(flavors, cont=gp, multiple=T) 
> 
> # Here is the trick
>  addHandlerClicked(cbg,handler=function(h,...){
> My_Flav<-svalue(cbg)
>  print(My_Flav)
> })
> 
> Select multiple lines, and you shall see all the selected rows.
> 

Can you check if the following runs? It worked for me so it may be
an older version (on gWIdgetsRGtk2 and gWidgetstcltk)

w <- gwindow(visible=FALSE)
g <- ggroup(cont=w, horizontal=FALSE)
tbl <- gtable(mtcars[1:5,], cont=g, multiple=TRUE, expand=TRUE)
b <- gbutton("click", cont=g, handler=function(h,...) {
   print(svalue(tbl))
 })
visible(w) <- TRUE


svalue(tbl, index=TRUE) <- 1:2
print(svalue(tbl, index=TRUE))


You should see 1 2 on the console and the first and second rows
should appear selected.

__
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] gslider-gwidgets

2012-05-29 Thread j verzani
karthicklakshman  gmail.com> writes:

> 
> Hello R lovers,
> 
> For my GUI, I am using gslider of Gwidgets. I need to add the "to=" value
> dynamically ie., maximum value from a data frame column(something like
> to=max(df[,3])).  But I am getting error message like 
> 

You update the items to select from using [<-, as in:

sl <- gslider(container=gwindow()) ## use defaults
sl[] <- seq(0, 2*pi, length=100)   ## new values

Of course, your sequence values will depend on the data frame you have
in mind



> Error in checkPtrType(object, "GtkWidget") : 
>   object of class NULL isn't a GtkWidget
> 
> Not sure what I am missing here!!!
> 
> Regards,
> karthick
>

__
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] set tkscale by tkentry

2012-05-24 Thread j verzani
Greg Snow <538280  gmail.com> writes:

> 
> I believe that what is happening is that when you try to edit the
> entry widget any intermediate values get sent to the slider widget
> which then checks to see if they are in the allowable range and if it
> is not then it sets the value to either the minimum and maximum and
> sends that back to the entry widget while you are still trying to edit
> it.  Even if you highlight a single digit and try to replace it with a
> different digit it first deletes the highlighted digit resulting in a
> number smaller than the minimum of the slider which then updates the
> entry widget to the minimum before the new digit can go in, then
> adding the new digit makes it larger than the slider maximum.
> 

Greg is right. You might try validating on focusout, rather than the key, 
but this is easy enough to do in R code, rather than let tcl do that work:

a <- 306870; b <- 3026741

tt<-tktoplevel()
varalpha <- tclVar(a)
charalpha <- tclVar(as.character(a))


scale <- tkscale(tt, from=a, to=b, resolution=1, label="alpha",
  variable=varalpha,
  showvalue=TRUE, orient="horiz")
ed <- tkentry(tt, textvariable=charalpha)

tkpack(ed)
tkpack(scale)

## connect
tkconfigure(scale, command=function(...) {
  tclvalue(charalpha) <- as.character(tclvalue(varalpha))
})

valid_input <- function(...) {
  val <- as.numeric(tclvalue(charalpha))
  if(a <= val & val <= b) {
message("set to ", val)
tclvalue(varalpha) <- val
  } else {
message("not valid...")
tkfocus(ed)
  }
}

tkbind(ed, "", valid_input)
tkbind(ed, "", valid_input)

__
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 close gwindow by automatially

2012-04-04 Thread j verzani
mrzung  gmail.com> writes:

> 
> Hi, all
> 
> I am using gWidgets for making gui, and in trouble with closing gwindow.
> 
> I want to close gwindow "A" by automatically when I click a button in
> gwindow "A" that loads another gwindow "B" .
> 
> for example.
> 
> A<-gwindow(visible=FALSE)
> open<-gbutton(cont=A,"open new
> window",handler=function(h,...){visible(B)<-TRUE})


In the handler just add the call dispose(A).

If you want, feel free to email me these questions.

--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] gWidgetstcltk gtext problem

2012-04-01 Thread j verzani
mrzung  gmail.com> writes:

> 
> hi, what I want to do is put a function result(output) into gtext area.
> short example is following,
> 
> require("gWidgetstcltk")
> options(guiToolkit = "tcltk")
> 
> win<-gwindow()
> input<-gedit("",con=win)
> run<-gbutton("run",con=win,handler=function(h,...){
> y<<-as.numeric(svalue(input))+1
> })
> outarea<-gtext("",con=win)
> 
> in this case, I want to put "y" value into "outarea" whenever click the
> "run" button.
> specifically, I want to solve this problem by gWidgetstcltk.
> 
> Thanks
> 


The following shows how you can do this. The main answer is 
use svalue<- to set the contents of the gtext area, or use 
insert() to append text. 

library(gWidgets)
options(guiToolkit="tcltk")

w <- gwindow("output", visible=FALSE)
g <- ggroup(cont=w, horizontal=FALSE)

g1 <- ggroup(cont=g)
input <- gedit("", cont=g1, expand=TRUE)
btn <- gbutton("run", cont=g1)
output <- gtext("", cont=g)

visible(w) <- TRUE

run <- function(h,...) {
  val <- svalue(input)
  svalue(output) <- as.numeric(val) + 1
}

sapply(list(btn, input), addHandlerChanged, handler=run )

__
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 adjust gui window size

2012-03-22 Thread j verzani
mrzung  gmail.com> writes:

> 
> hi, i'm trying to make gui function by "aDialog" FUN.
> What i want to do is adjusting the window size.
> 
> my function is ,
> 
> aa<- aDialog(items=list(
> ps=numericItem(),
> number=numericItem(),
> term=numericItem()
> ),
> OK_handler=function(.) { # . is reference to dlg object
> values <- .$to_R()
> do.call("KOD",values)
> }
> )
> 
> how can i adjust the size of the window?


You are much better off pointing out this uses the traitr package, 
as otherwise one wouldn't know where to begin. In this case, 
there isn't a straightforward way, but this hack will let you do it:

 size(aa$widget_list$toplevel) <- c(600, 600)

I haven't worked on that package for awhile, as it didn't get many users.

__
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] Singleton pattern

2012-03-16 Thread j verzani
David Cassany  transmuralbiotech.com> writes:

> 
> Hi all,
> 
> I know it may not have much sense thinking about a Singleton Pattern in an
> R application which doesn't use any OOP facilities, however I'm curious to
> know if anybody faced the same issue. I've been googling but using
> "singleton pattern" as a key word leads to typical OOP languages like Java
> or C++ among others.
> 

While it isn't too hard to implement the Singleton pattern using reference 
classes, I would think for what you want to do the memoise package can 
be used. Create a wrapper function to return the objects and the cached
value will be returned each time.


> So my problem is that I'd like to ensure some very big objects aren't
> copied again and again in some other variables. In the worst case I'll
> check all code by myself to ensure it but in this case the application
> won't force programmers to take it in consideration which is what I am
> really looking for.
> 
> Any advice will be highly appreciated :P
> 
> Thanks!

__
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] (no subject)

2012-03-08 Thread j verzani
Mark Heckmann  gmx.de> writes:

> 
> When using a gtkDrawingArea as a Cairo device I very often 
> encounter the error:  "figure margins  too large" 
> Even for the below "getting started" example from 
> http://www.ggobi.org/rgtk2/   this is the case.


This can be avoided with the following:

library(RGtk2)
library(cairoDevice)
win = gtkWindow(show=FALSE)
da = gtkDrawingArea()
da$setSizeRequest(700, 700)

da$AddEvents(GdkEventMask["all-events-mask"])
gSignalConnect(da, "map-event", function(...) {
  asCairoDevice(da)
  return(TRUE)
})

win$add(da)
win$show()

plot(1:10)



.. snip ..
> 
> 
> Mark Heckmann
> Blog: www.markheckmann.de
> R-Blog: http://ryouready.wordpress.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] An R interface to Model Building

2012-01-03 Thread j verzani
Brett Magill  sbcglobal.net> writes:


> 
> Hello all,
> 
> To anyone who is interested, I'm trying to learn a bit more about
> developing applications in R with user interfaces.  I've been playing
> around with gWidgets to develop a model building interface.
> 
> I'd appreciate any comments, suggestions, or guidance on how to better
> structure my R code and organize the programming task.  In addition,
> any suggestions for features and improvement to this fledgling project
> would be welcomed.
> 



You should look at http://cran.r-project.org/web/packages/R2STATS/index.html 
to look and see what Yvonnick has done already on this type of project.

--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] gWidgets: how to remove that is box drawn when moving the mouse with pressed button

2011-12-18 Thread j verzani
Mark Heckmann  gmx.de> writes:

> 
> Hi,
> 
> how can I omit the box drawn from the starting position to the 
> current position of the mouse when clicking and it over a GTK 
> graphics object? I have seen that in the 'playwith' package the box 
> changes to an arrow when using the 'pan' button. But I do not find 
> the corresponding line in the code to implement that. 

.. snip ..

Unfortunately I have that hard coded in with no means to turn it off. I 
"borrowed" the idea from playwith, so  should be able to integrate
 in what you describe. At the least, I should allow the user to remove
the rubber banding.

--J

> Thanks!
> Mark
> 
> Mark Heckmann
> Blog: www.markheckmann.de
> R-Blog: http://ryouready.wordpress.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] how to view/edit large matrix/array in R?

2011-12-06 Thread j verzani
Michael  gmail.com> writes:

> 
> head, tail and fix commands don't really work well if I have large
> matrix/array for which I would like to be able to scroll up and dow, left
> and right ...
> 
> Could anybody please help me?
> 
> Thanks
> 
>   [[alternative HTML version deleted]]
> 
> 


You might look into the RGtk2Extras package and find the dfedit. You could
also embed that in some custom GUI to show variables, as you want. The 
package requires RGtk2, and hence the Gtk libraries to be installed. 
The data frame editor there can gracefully handle large data sets.

__
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 GUI using traitr to display multiple data

2010-05-20 Thread j verzani
Amitoj S. Chopra  gmail.com> writes:

> 
> 
> Hello to everyone.
> 
> I am constructing a GUI table using traitr with multiple buttons that
> respond to different codes. Such as I am doing titration of a protein, and I
> want the script to run and then the end to be displayed in a window. The
> window will have a button for data and graphs, where when you click on the
> data button the data will be displayed and when you click on the graph
> button the graphs will be displayed. Do you know how to set up different
> buttons with functions using the traitr GUI for R? Thanks!

There are two ways. You can use a buttonItem or to add a button to a dialog,
just use the buttons property and define a handler. Here are both in an example:


dlg <- aDialog(items=list(a = buttonItem("click me", show_label=FALSE,
action=function(.,...) print("clicked"))
 ),
   buttons=c("OK","Cancel","Help","Some other"),
   Someother_handler=function(.) print("some other button"))
dlg$make_gui()

__
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] GUI commands to call for a protein from protein data bank

2010-05-19 Thread j verzani
Amitoj S. Chopra  gmail.com> writes:

> 
> 
> Thank you it worked perfectly. I just needed to close the window that was
> the problem. Do you know how to close the window automatically and why does
> that matter? Thanks!
> 
> Amitoj

Not sure why this makes a difference, but if it does great. As to
programattically closing a dialog, the method close_gui is available, as in
dlg$close_gui(). (The proto methods for an object dlg are shown in a web page by
calling dlg$show_help().)

--John

..snipped..

__
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] GUI commands to call for a protein from protein data bank

2010-05-18 Thread j verzani
Amitoj S. Chopra  gmail.com> writes:

> 
> 
> What I am trying to do is use GUI function, traitr, and to call for a pdb
> file and save it and then display it. I want to call for it by taking it
> from the user and then displaying it on the screen. I am having problems
> with that. The line pdb <- read.pdb(""ProteinCode) where proteincode should
> be the name of the protein, for example 1ly2, but it always ends up being
> protein. My question is how to you make the input for read.pdb actually be
> the input by the user and not protein code. I want to be able to type 1ly2,
> and for the program to actually display the contents of 1ly2. Thanks!
> 

I'm just guessing, but you might try this for your OK_handler:

OK_handler=function(.) {
  pdb <- read.pdb(.$get_ProteinCode())
}

(Or use yours, but drop the quotes around "ProteinCode".)

That doesn't modify pdb outside the scope of the handler, so likely you need to
do something else with it.

--John


> Code:
> 
> dlg <- aDialog(items=list(
> ProteinCode=stringItem("")
> ),
> OK_handler=function(.) { # . is reference to dlg object
> values <- .$to_R()
> f <- function(ProteinCode)
> pdb <- read.pdb("ProteinCode")
> do.call(f, values)
> }
> )
> dlg$make_gui()

__
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 for web browser

2010-05-04 Thread j verzani
Lanna Jin  gmail.com> writes:

> 
> 
> Hi Everyone,
> 
> Does anyone know of any projects for running an interactive R session within
> a web browser?
> I'm looking for something similar to the one on the Ruby website
> (http://tryruby.org), except for R.
> 
> Thanks for your responses in advance!
> 

You can run R code through the sage software. (Sage is a CAS and also an
interface to numerous open-source software packages.)  The main interface for
sage is through a notebook within a web browser. A freely accessible notebook
server can be found at www.sagenb.org. Recent work involves integrating R's
plotting features within the notebook. 


> Lanna
> 
> -
> Lanna Jin
> 
> lannajin  gmail.com
> 510-898-8525

__
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] rpad ?

2010-03-23 Thread j verzani
sjaffe  riskspan.com> writes:



> 
> 
> Sharpie wrote:
> > 
> > You could try Sage:
> > 
> >   http://www.sagemath.org
> > 
> 
> Yes, I've tried Sage (briefly) and it is very interesting. But what I'm
> looking for here is a client-server system that allows multiple users to
> access the results of R without exposing the details.



You might find gWidgetsWWW able to do what you want. Some demos are here:

www.math.csi.cuny.edu/gWidgetsWWW

--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 make this sequence: 1,2,3,4,5,4,3,2,1

2010-03-05 Thread j verzani
kensuguro  gmail.com> writes:

> 
> 
> so basically, it's impossible to do with just seq() and rep()..  Doesn't seem
> like a good question for chapter 1...
> 
> Also, problem 1.13 is even more crazy..  it asks you to build the fibonacci
> sequence.  Now I'm a programmer, and so went way ahead in the book to see
> how functions were written, and just wrote my own function, but again, in
> chapter 1?  (only covered c(), seq(), and rep() at this point)  What away
> kick start a book.  Is "Using R project for Introductory Statistics" known
> to jump around or have out of sequence practice problems?  Otherwise it
> seems to be written very well.


Sorry about that one. On the errata page I have:

page 16, exercise 1.12 #5
This one is most easily done using c() and the sequence operator :. (Please
ignore request to use just seq and rep.) 

As for 1.13, I just wanted someone to use c() for that one. I don't even define
the Fibonacci sequence, I only wanted some context to a sequence of numbers that
is not an arithmetic progression.

Not sure if the rest of the book "jumps around", but if it seems to to you, I'm
very open to comments about improvements. Just email.

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] SimpleR and UsingR

2010-02-06 Thread j verzani
Uwe Dippel  uniten.edu.my> writes:

> 
> Having found the online version of SimpleR, I wanted to to download the 
> respective data:
> "The data sets for these notes are available from the CSI math 
> department (http://www.math.csi.cuny.edu/Statistics/R/simpleR)
> and must be installed prior to this."
> 

Sorry for the confusion. You install the UsingR package and then load the same
package. Try instead:

install.packages("UsingR")
library("UsingR")


--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] Using tcltk or other graphical widgets to view zoo time series objects

2010-01-28 Thread j verzani
Research  ath.forthnet.gr> writes:

> 
> Dear all,
> 
> I am looking at the R-help entry below:
> 
> http://finzi.psych.upenn.edu/R/Rhelp02/archive/26640.html
> 
> I have a more complicatedt problem. I have a zoo time series frame with 
> 100+ sequences.
> 
> I want to cycle through them back and forth and compare them to the 1st 
> column at any time.
> 

The playwith solution is shorter but this GUI mockup using gWidgets might be
more flexible:

library(gWidgets)

make_plot <- function(i, ...) {
  ## your plot goes here
  cat(i)
  plot(1, i)
}
do_something <- function(i,..) {
  cat("clicked on", i, "\n")
}

w <- gwindow("Plot example")
g <- ggroup(cont=w, horizontal=FALSE)
i <- gslider(from=2, to=100, by=1, cont=g, handler=function(h,...) {
  make_plot(svalue(h$obj))
})
b <- gbutton("do something", cont=g, handler=function(h,...) {
  do_something(svalue(i))
})


That will work with tcltk and RGtk2. If you have RGtk2 installed, then you might
also like this GUI template using traitr:


library(gWidgets)
options(guiToolkit="RGtk2")
require(traitr)

dlg <- aDialog(items=list(
 i=rangeItem(value=2, from=2, to=100, by=1),
 g=graphicDeviceItem()
 ),
   buttons="Details...",
   property_i_value_changed=function(., value, old_value) {
 make_plot(value)
   },
   Details_handler = function(.) {
 do_something(.$to_R()$i)
   })
dlg$make_gui()
 
 




> I need also a button to click when I need the viewed-selected sequence 
> (that is being compared to the 1st column one) to be manipulated
> (by some algorithm or be saved individually etc. etc.)...
> 
> I am trying to modify the code at the above link but somehow I can not 
> make it to work with zoo time series objects.
> 
> Any help would be greatly appreciated.
> 
> Thanks in advance,
> Costas
> 
> __ Information from ESET Smart Security, version of virus signature
database 4813 (20100128) __
> 
> The message was checked by ESET Smart Security.
> 
> http://www.eset.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] gWidgets: loading problem

2010-01-15 Thread j verzani
Walther, Alexander  googlemail.com> writes:

> 
> Dear list,
> 
> i try to set up a GUI with gWidgets. For this project, RGtk2 is
> required. By loading the package, i encounter the following error prompt:
> 
> ---C Symbolname "S_gtk_icon_factory_new" not in DLL for package "RGtk2"-
--
> 

This sounds like an RGtk2 issue and for that it depends on your system. Can you 
load RGtk2 by itself and issue some command, say gtkWindow()? If not, that is 
where to look.

> Any suggestions how to fix this? And: is there a good resource for
> gWidgets templates on the web?
> 

There is a vignette with the package, and some examples at 
www.math.csi.cuny.edu/pmg/gWidgets/Examples. As well, there are some 
examples at www.math.csi.cuny.edu/gWidgetsWWW that should work here as 
well. Those might get you started.

--John


> Best regards
> 
> Alex
> 
>

__
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 put ggobi display into a GUI window setup by gWidgets

2009-11-30 Thread j verzani
jerry83  yahoo.com> writes:

Jerry, see below:

> 
> 
> Hi John,
> 
> Thanks A LOT for your reply and the code. What I want to do is to include the
ggobi display window to the widget
> window setup by me. I tried add before but it said can not do it for
GGobiScatterplotDisplay. Do you have
> any idea about add displays?
> 
> Thanks again for your help.
>  
> 
> 
> From: jverzaniNWBKZ [via R]  n4.nabble.com>
> 
> Sent: Sun, November 29, 2009 5:19:43 PM
> Subject: Re: [R] how to put ggobi display into a GUI window setup by gWidgets
> 
> jerry83  yahoo.com> writes: 
> 
> > 
> > 
> > Hi, 
> > 
> > I want to put a ggobi display into a GUI window setup by gWidgets, but 
> > error 
> > occur said it is not a S4 object. 
> > 
> > Does anyone have any idea about how to put it in or maybe it can not be put 
> > into a widget at all? 
> > 
> > Thanks A LOT! 
> 
> To embed a GTK widget into gWidgets isn't too hard, just call the add method. 
> I'm not sure how  to get the GTK object you want from the ggobi 
> interface. Below is an example that you might be able to modify: 
> 
> ## 
> library(RGtk2) 
> library(rggobi) 
> library(gWidgets) 
> options(guiToolkit="RGtk2") 
> 
> ## ggoobi object 
> x <- ggobi(mtcars) 
> 
> ## grab child from main window. Modify (how?) to get 
> ## other widgets 
> toplevel <- ggobi_gtk_main_window(x) 
> child <- toplevel[[1]]  # toplevel has only one child 
> toplevel$remove(child)  # remove child if keeping toplevel 
> toplevel$destroy()      # or destroy if not 
> 
> ## add to a gWidget instance using gWidgetsRGtk2: 
> w <- gwindow("A gwidget's window") 
> g <- ggroup(cont = w, expand=TRUE) 
> add(g, child, expand=TRUE) 
> 
> --John 
> 


Here is some code to grab the display for a new display. I don't know
how to get the initial display or even how to suppress it, but I'm
not a ggobi user at this point.

library(RGtk2)
library(rggobi)
library(gWidgets)
options(guiToolkit="RGtk2")

x <- ggobi(mtcars)
## not sure how to get the initial display,
## here we create a new display and move that
disp <- display(x[1]) ## see display.GGobiData

## find table in the display heirarchy
table <- disp[[2]]

## plot is third child (rulers are first two)
plotWidget <- table[[3]]$getWidget()
table$remove(plotWidget)
## hide window that held display. Destroy() causes errors
disp$getParent()$hide() 

## now we need to declass things so that gWidgets will 
## recognize. The S3 classes from RGtk2 that gWidgets 
## knows about are declared in package (should be 
## dynamic, but aren't)

class(plotWidget) <- class(plotWidget)[-(1:3)]

w <- gwindow("A gwidget's window")
g <- ggroup(cont = w, expand=TRUE)
add(g, plotWidget, expand=TRUE)



> __ 
> [hidden email] 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. 
> 
> 
> 
> View message @
>
http://n4.nabble.com/how-to-put-ggobi-display-into-a-GUI-window-setup-by-gWidgets-tp930529p930927.html

> To unsubscribe from how to put ggobi display into a GUI window setup by
gWidgets, click here. 
>

__
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 put ggobi display into a GUI window setup by gWidgets

2009-11-29 Thread j verzani
jerry83  yahoo.com> writes:

> 
> 
> Hi,
> 
> I want to put a ggobi display into a GUI window setup by gWidgets, but error
> occur said it is not a S4 object.
> 
> Does anyone have any idea about how to put it in or maybe it can not be put
> into a widget at all?
> 
> Thanks A LOT!



To embed a GTK widget into gWidgets isn't too hard, just call the add method.
I'm not sure how  to get the GTK object you want from the ggobi 
interface. Below is an example that you might be able to modify:

## 
library(RGtk2)
library(rggobi)
library(gWidgets)
options(guiToolkit="RGtk2")

## ggoobi object
x <- ggobi(mtcars)

## grab child from main window. Modify (how?) to get 
## other widgets
toplevel <- ggobi_gtk_main_window(x)
child <- toplevel[[1]]  # toplevel has only one child
toplevel$remove(child)  # remove child if keeping toplevel
toplevel$destroy()  # or destroy if not

## add to a gWidget instance using gWidgetsRGtk2:
w <- gwindow("A gwidget's window")
g <- ggroup(cont = w, expand=TRUE)
add(g, child, expand=TRUE)

--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] r online

2009-03-24 Thread j verzani
Dirk Eddelbuettel  debian.org> writes:

> 
> 
> On 24 March 2009 at 12:06, Thomas Steiner wrote:
> | Hi,
> | I'd like to execute simple commands and functions in R through a
> | website, is there any service like this somewhere?
> | I only found http://www.osvisions.com/r-online/ but it does not work
> | (last update 2003) and the links to releated websites only give errors
> | (if I calculate 7+3).
> | Thanks for help & hints,
> 
> Please read the R FAQ which has an entire section devoted to this that I
> include below, copied and pasted from the txt version of the R
> FAQ. Personally, I'd go with Rpad.


To add to the FAQ that Dirk quotes:

The Sage project has an online "notebook" server at sagenb.org that allows one
to use numerous open source math programs including R. Sage can be installed
locally as well. (The R feature seems to be broken at the moment though, but it
does work on a local install.)

The gWidgetsWWW package (needs testing still) provides an interface to Rpad that
you could use to quickly create a web page to interpret R commands, e.g. the
simplistic http://www.math.csi.cuny.edu/gWidgetsWWW/ex-cli.html. However,
graphics are easier done using Rpad, than 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.


Re: [R] How to set up a function for "Central Limit Theorem"

2009-03-23 Thread j verzani
Greg Snow  imail.org> writes:

> 
> There is also the clt.examp function in the TeachingDemos package.
> 


An interactive demo can also be found at http://www.math.csi.cuny.edu/gWidgetsWWW/ex-clt.html>http://www.math.csi.cuny.edu/gWidgetsWWW/ex-clt.html.

__
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] Need suggestions about GUI

2008-01-23 Thread j verzani
ronggui  gmail.com> writes:

> 
> There is a problem with font<- .
> 
> g<-gtext(con=T)
> 
> enter some text, and select a chunk of text.
> 
> font(g) <- c("color"="red")
> 
> Now I would like to change the color back into "black". But font(g) <-
> c("color"="black") does not work.
> 
> Thanks
> 

This is now fixed for RGtk2 as of version 0.0-29 (which was just uploaded to
CRAN). I'm not sure font<- alone does what you want. It only changes colors. 
You might need to look at RGtk2's gtkTextBufferRemoveTag to remove colors.

--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] Need suggestions about GUI

2008-01-21 Thread j verzani
ronggui  gmail.com> writes:

> Thanks.
> 
> gWidgets is quite good. However, I want to get the selection text chunk as
> well as the index, but the index arguments does not work for gtext.
> 
> > obj<-gtext(cont=T)
> > svalue(obj,drop=T)
> [1] "cde"
> > svalue(obj,drop=T,index=T)
> [1] "cde"
> 



The svalue method has the index argument for the widgets where you might want to
return the  index or value such with a radio button group or combobox. For
gtext, the drop argument when TRUE returns just the text selected by the mouse,
otherwise the entire text buffer is returned. 

library(gWidgets)
options("guiToolkit"="RGtk2")
obj = gtext("sadfsad",cont=T)
svalue(obj)   ## returns: "sadfsad\n"
svalue(obj,drop=TRUE)  ## returns  ""
## now highlight some text
svalue(obj,drop=TRUE) ## returns "dfsa"

If you want to email me a bit more detail as to what you are trying to do, I can
let you know if gWidgets can work for you.

--John
> 

> 2008/1/21, Gabor Grothendieck  gmail.com>:
> >
> > You can find examples of using tcltk here:
> >
> > http://www.sciviews.org/_rgui/tcltk/
> >
> > Also the gwidgets package is a toolkit independent
> > layer that can run on top of tcltk or RGtk and it is described
> > with many examples here:
> >
> > http://wiener.math.csi.cuny.edu/pmg/gWidgets
> >
> > On Jan 21, 2008 4:02 AM, ronggui  gmail.com> wrote:
> > > What I want to do is:
> > > 1, creat a text box, insert text into that box.
> > > 2, select chunk of of the text by mouse, and link it to a lable. so I
> > would
> > > like a way to get that chunk of text.
> > >
> > > Can I do such job with tcltk?  Any relavant tutorial materials?
> > >
> > > Thanks
> > >
> > > --
> > > HUANG Ronggui
> > >
> > > Bachelor of Social Work, Fudan University, China
> > >
> > > Master of sociology, Fudan University, China
> > >
> > > Ph.D. Student , CityU of HK,
> > >
> > http://www.cityu.edu.hk/sa/psa_web2006/students/rdegree/huangronggui.html
> > >
> > >[[alternative HTML version deleted]]
> > >
> > > __
> > > 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.
> > >
> >
>

__
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.