首页 > 解决方案 > 将参数传递给 R 环境中的函数,(gWidget)

问题描述

我有一个数据表列表:

PID_short   PID_full
   420      44101445
   419      44101375
   418      44101344
   417      44100125
   ...        ...
    3       44054648
    2       68049258
    1       68051786

这是我的代码:

require(gWidgets)

w <- gwindow("bigfoot") 
g <- ggroup(cont = w, horizontal = FALSE) 
g1 <- ggroup(cont = w) 
g2 <- ggroup(cont = w)
Vl <- list () 

fr3 <- gframe ("", cont=g, horizontal=TRUE) 
l3 <- glayout ( cont = fr3 , expand=TRUE) 
l3 [1,1] <- NbS <- glabel("PID_short", cont = l3) 
l3 [1,2] <- (Vl$NbS <- gcombobox ((c(1:420)), cont = l3)) 

ok <- gbutton("OK", cont = g, handler=rbC) 

fr4 <- gframe ("", cont=g, horizontal=FALSE) 
l4 <- glayout (cont=fr4, expand = TRUE) 
l4 [1,1] <- Dm <- glabel("PID_full", cont = l4) 
l4 [1,2] <- (Vl$Dm <- gedit("", cont = l4))

好的,我希望当我420在 gcombobox 中选择并按下ok时,PID_full会告诉我44101445,就像在表格中一样,等等。

但是我不知道如何将参数传递给函数,因为我实际上是 R 的新手。有人可以帮助我吗?我希望我提供了一个明确的信息......如果有任何不清楚的地方,我会更新它,非常感谢,将不胜感激。

标签: ruser-interfacerstudiogwidgets

解决方案


推荐阅读