[BioC] 2nd Re: widgetTools wFuns problem

mattia mattia.pelizzola at unimib.it
Fri Feb 3 16:44:36 CET 2006


Hi John,

I forgot to ask you if it is possible to give to "wFuns" not only a function 
but also some argument for this function (like the apply functions..).

In this case it would be very useful to me because I could set the name of the 
variable where to store the file names returned by "fileBrowser".
In this way I can put many Browse buttons in my widgets without overwriting 
the obtained file-names vectors.

for example:

tempFun <- function(fileName){files <- fileBrowser();multiassign(fileName,
paste(files,collapse=";"), env = .GlobalEnv)}

and then

browserButton<-button(wName="browserButton",wValue="Browse",wEnv=globalenv(
),wFuns=list(command=tempFun,fileName="fileList"){))

I tried but I have got an error message when I started the widget, since a 
function is expected:
Error in function ()  : attempt to apply non-function

Is there any documentation regarding what can be put in the "wFuns" argument?

thanks

Mattia

> Hi Jianhua,
>
> I did not know the "multiassign" function!
> I have slightly modified what you suggested, simply because I want to have
> the vector returned by fileBrowser saved in my globalenv, and not its
> components..
>
>
> tempFun <- function(){files <- fileBrowser();multiassign("fileList",
> paste(files,collapse=";"), env = .GlobalEnv)}
>
> browserButton<-button(wName="browserButton",wValue="Browse",wEnv=globalenv(
>),wFuns=list(command=tempFun))
>
> browserList<-list(browser=list(browserButton=browserButton))
>
> test<-widget(wTitle="test",pWidgets=browserList,env=globalenv())
> ...
> fileList<-strsplit(fileList,";")
>
>
> I don't know if using "paste(,collapse..)" and "strsplit" is the best
> solution but it works fine..
> Thanks a lot
>
> Mattia
>
> On Friday 03 February 2006 15:36, John Zhang wrote:
> > The files names got lost because you did not give instructions on what to
> > do with the file names. If you write the function like below:
> >
> >
> > require("Biobase")
> > tempFun <- function(){
> >   files <- fileBrowser()
> >   multiassign(paste("file", 1:length(files), sep = ""), files, env =
> > .GlobalEnv) }
> >
> > and then replace fileBrowser with tempFun in your code. The files
> > seleceted will be stored in .GlobalEnv as file1, file2, ...
> >
> > But would fileBrowser do what you what to achieve by those lines of code?
> >
> > >X-Original-To: jzhang at jimmy.harvard.edu
> > >Delivered-To: jzhang at jimmy.harvard.edu
> > >X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on
> > > hypatia.math.ethz.ch X-Spam-Level:
> > >X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_50 autolearn=no
> >
> > version=3.1.0
> >
> > >From: mattia <mattia.pelizzola at unimib.it>
> > >To: bioconductor at stat.math.ethz.ch
> > >Date: Thu, 2 Feb 2006 12:03:13 +0100
> > >User-Agent: KMail/1.8
> > >MIME-Version: 1.0
> > >Content-Disposition: inline
> > >Received-SPF: pass (hypatia.math.ethz.ch: 129.132.145.15 is
> > > authenticated by a
> >
> > trusted mechanism)
> >
> > >Received-SPF: none (hypatia: domain of mattia.pelizzola at unimib.it does
> > > not
> >
> > designate permitted sender hosts)
> >
> > >X-Virus-Scanned: by amavisd-new at stat.math.ethz.ch
> > >Subject: [BioC] widgetTools wFuns problem
> > >X-BeenThere: bioconductor at stat.math.ethz.ch
> > >X-Mailman-Version: 2.1.6
> > >List-Id: The Bioconductor Project Mailing List
> > > <bioconductor.stat.math.ethz.ch> List-Unsubscribe:
> > > <https://stat.ethz.ch/mailman/listinfo/bioconductor>,
> >
> > <mailto:bioconductor-request at stat.math.ethz.ch?subject=unsubscribe>
> >
> > >List-Archive: <https://stat.ethz.ch/pipermail/bioconductor>
> > >List-Post: <mailto:bioconductor at stat.math.ethz.ch>
> > >List-Help: <mailto:bioconductor-request at stat.math.ethz.ch?subject=help>
> > >List-Subscribe: <https://stat.ethz.ch/mailman/listinfo/bioconductor>,
> >
> > <mailto:bioconductor-request at stat.math.ethz.ch?subject=subscribe>
> >
> > >Content-Transfer-Encoding: 7bit
> > >X-PMX-Version: 4.7.1.128075, Antispam-Engine: 2.2.0.0, Antispam-Data:
> >
> > 2006.02.02.020605
> >
> > >X-PMX-Spam: Probability=7%, Report='__C230066_P1_5 0, __CD 0, __CT 0,
> > > __CTE 0,
> >
> > __CTYPE_CHARSET_QUOTED 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0,
> > __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __STOCK_CRUFT 0,
> > __USER_AGENT 0'
> >
> > >Hi,
> > >
> > >I have a problem with widgetTools.
> > >I created a simple button that I would like to be associated with the
> > >"fileBrowser" function (returning a vector of file names).
> > >
> > >>library(tkWidgets)
> > >>browserButton<-button(wName="browserButton",wValue="Browse",wEnv=global
> > >>en v(),w
> >
> > Funs=list(command=fileBrowser))
> >
> > >> browserList<-list(browser=list(browserButton=browserButton))
> > >> test<-widget(wTitle="test",pWidgets=browserList,env=globalenv())
> > >
> > >.. fileBrowser seems to work fine, I select some files, but I'm not able
> > > to retrieve the "returned" vector of file names..
> > >
> > >> test at pWidgets[[1]][[1]]@wValue
> > >
> > >[1] "Browse"
> > >
> > >Where does the file-names disappear?
> > >
> > >this is my configuration:
> > >
> > >R version 2.1.1, 2005-06-20, x86_64-unknown-linux-gnu
> > >
> > >attached base packages:
> > >[1] "tools"     "tcltk"     "methods"   "stats"     "graphics"
> > > "grDevices" [7] "utils"     "datasets"  "base"
> > >
> > >other attached packages:
> > >  tkWidgets      DynDoc  reposTools widgetTools
> > >   "1.5.23"     "1.5.5"    "1.5.19"     "1.4.7"
> > >
> > >
> > >thanks for any suggestion!
> > >
> > >Mattia
> > >
> > >
> > >--
> > >Mattia Pelizzola
> > >PhD Student
> > >Genopolis Consortium
> > >Milano-Bicocca University
> > >P.zza della Scienza 4
> > >20126 Milano (Italy)
> > >tel:+390264483556
> > >fax:+390264483552
> > >
> > >_______________________________________________
> > >Bioconductor mailing list
> > >Bioconductor at stat.math.ethz.ch
> > >https://stat.ethz.ch/mailman/listinfo/bioconductor
> >
> > Jianhua Zhang
> > Department of Medical Oncology
> > Dana-Farber Cancer Institute
> > 44 Binney Street
> > Boston, MA 02115-6084

-- 
Mattia Pelizzola
PhD Student
Genopolis Consortium
Milano-Bicocca University
P.zza della Scienza 4
20126 Milano (Italy)
tel:+390264483556
fax:+390264483552



More information about the Bioconductor mailing list