R combo box for selecting numbe of clusterring

70 Views Asked by At

How to fill a combo box with numbers like 2,3,4,5 ,when the user select the number , after that a button coded with clustering will take the value from the combo box to do the selected number of clustering.

Need help .

1

There are 1 best solutions below

0
On

In case someone wants an answer, here is a sketch using gWidgets2:

w <- gwindow()
g <- gvbox(cont=w)
e <- gedit("5", cont=g, coerce=as.integer)
cb <- gcombobox(1:5, cont=g)
b <- gbutton("do clustering", cont=g)

addHandlerChanged(e, handler=function(h,...) {
  ## check svalue(e) is non-NA
  cb[] <- seq_len(svalue(e))
})

addHandlerClicked(b, handler=function(h,...) {
  print(sprintf("Do clustering with %s", svalue(cb)))
})