[Bioc-devel] Duplicated method names in purrr and GenomicRanges
Just an FYI, *if* all you're doing is rbind():ing those data frames, then you're better of doing: df <- do.call(rbind, dfs) than df <- Reduce(rbind, dfs) because the former is faster and more memory efficient:
dfs <- rep(list(iris), times=100) bench::mark(df <- Reduce(rbind, dfs))[,1:7]
# A tibble: 1 x 7 expression min median `itr/sec` mem_alloc `gc/sec` n_itr <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> <int> 1 df <- Reduce(rbind, dfs) 65.5ms 68.6ms 13.6 108MB 30.7 8 Warning message: Some expressions had a GC in every iteration; so filtering is disabled.
bench::mark(df <- do.call(rbind, dfs))[,1:7]
# A tibble: 1 x 7 expression min median `itr/sec` mem_alloc `gc/sec` n_itr <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> <int> 1 df <- do.call(rbind, dfs) 8.67ms 9.47ms 105. 14MB 49.5 34 /Henrik
On Fri, Sep 13, 2019 at 5:39 AM <bioinf at posteo.de> wrote:
Thank you for all of your answers. Michaels solution works fine for me. I had to merge a list of data.frames. Used the solution in this thread here: https://stackoverflow.com/questions/8091303/simultaneously-merge-multiple-data-frames-in-a-list Am 12.09.19 um 13:05 schrieb Michael Lawrence via Bioc-devel:
Third option: use Reduce() from base instead of purr::reduce(). On Thu, Sep 12, 2019 at 2:54 AM O'CALLAGHAN Alan <A.B.O'Callaghan at sms.ed.ac.uk> wrote:
Hi, Two options. First option: import either purrr::reduce or GenomicRanges::reduce, and call the other with [pkg]::reduce. Second option: remove the import for both of these. Use purrr::reduce and GenomicRanges::reduce to call both functions. I think the second option leads to clearer code and would be my definite preference. On 12/09/2019 10:07, bioinf at posteo.de wrote:
Dear all, I am developing a Bioconductor package and have a problem with two methods which have the same name. I am using the reduce() function from the R packages GenomicRanges and purrr. All methods from other packages are imported with @importFrom in all of my functions. During devtools::document() I get the following Warning: ... replacing previous import ?GenomicRanges::reduce? by ?purrr::reduce? when loading ?testPackage? ... Here are my NAMESPACE entries: # Generated by roxygen2: do not edit by hand export(mergeDataFrameList) export(reduceDummy) importFrom(GenomicRanges,GRanges) importFrom(GenomicRanges,reduce) importFrom(IRanges,IRanges) importFrom(dplyr,"%>%") importFrom(dplyr,left_join) importFrom(dplyr,mutate) importFrom(dplyr,pull) importFrom(magrittr,"%<>%") importFrom(purrr,reduce) importFrom(tibble,tibble) I am not using both reduce functions in the same function. To use the GenomicRanges reduce function, I have to call this function like this: GenomicRanges::reduce(). I understand the warning and why I have to call the reduce function like this. Is there a solution for this problem? Compiling a R package with warnings and calling functions like this is not the best way I guess. I am using R version 3.6.1 (2019-07-05) Thanks for help! Best, Tobias
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel