Question: Error in file.choose() : file choice cancelled
0
gravatar for clarisbaby
23 months ago by
clarisbaby0
clarisbaby0 wrote:

Hey everyone!!

I am trying to build a package for RNA-seq analysis combining different existing packages in bioconductor and am facing problem while Writing Vignettes for the package. On including R code for function that contains file.choose() option in the Vignettes following error is obtained while trying to build and reload the package

==> devtools::document(roclets=c('rd', 'collate', 'namespace', 'vignette'))

Updating RNAseq documentation
Loading RNAseq
Updating vignettes
Rebuilding Introduction_to_RNASeq.Rmd
Quitting from lines 36-39 (Introduction_to_RNASeq.Rmd) 
Error in file.choose() : file choice cancelled
Calls: suppressPackageStartupMessages ... withCallingHandlers -> withVisible -> eval -> eval -> frqc -> file.choose
Execution halted

Exited with status 1.

It would be very helpful if anyone could suggest how to include functions that contain file.choose() while writing vignettes.

Thanks in advance.

ADD COMMENTlink modified 23 months ago • written 23 months ago by clarisbaby0
Answer: Error in file.choose() : file choice cancelled
0
gravatar for Martin Morgan
23 months ago by
Martin Morgan ♦♦ 23k
United States
Martin Morgan ♦♦ 23k wrote:

Questions about package development should be directed to the bioc-devel mailing list.

file.choose() implies user interaction, so obviously cannot be evaluated by a vignette.

You don't provide enough detail, but if this were a function you wrote. Usually the file that the vignette is supposed to process is available, e.g., in the package inst/extdata folder or as a separate ExperimentData package. One could write code like

if (interactive()) {
    bam = file.choose()
} else {
    bam = system.file(...)
}

or try and hide these details from the user using an echo=FALSE block for the above code, followed by an eval=FALSE block with bam = file.choose(). In either case the return value would be passed to the function in question as an argument. If the function in question does not allow a user-supplied argument, it should be revised to allow one, e.g.,

fun = function(bam) {
    if (missing(bam))
        bam = file.choose()
    ...
}

If file.choose() is used in a third-party package and is not written in a way that it can be avoided, then contact the maintainer and report a bug that requires fixing. If the maintainer is not responsive, give serious consideration to whether the package in question is a good bet for a long-term dependency.

ADD COMMENTlink written 23 months ago by Martin Morgan ♦♦ 23k
Answer: Error in file.choose() : file choice cancelled
0
gravatar for clarisbaby
23 months ago by
clarisbaby0
clarisbaby0 wrote:

Thank You so much @Martin Morgan. 

if (interactive()) {
    bam = file.choose()
} else {
    bam = system.file(...)
}

this command worked perfectly and solved the error. I am really sorry for being so vauge in my question. I will surely take your suggestion while posting any question next time. 

Thanks again.

ADD COMMENTlink modified 23 months ago • written 23 months ago by clarisbaby0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 120 users visited in the last hour