Error in file.choose() : file choice cancelled
2
0
Entering edit mode
clarisbaby • 0
@clarisbaby-14317
Last seen 6.7 years ago

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.

package development bioconductor rstudio rmarkdown vignettes • 4.0k views
ADD COMMENT
0
Entering edit mode
@martin-morgan-1513
Last seen 5 months ago
United States

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 COMMENT
0
Entering edit mode
clarisbaby • 0
@clarisbaby-14317
Last seen 6.7 years ago

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 COMMENT

Login before adding your answer.

Traffic: 448 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6