[Bioc-devel] Namespace issues with ggbio 1.13.6 from AnnotationDbi 1.27.6 not exporting 'cols'
Hello, Currently I'm unable to load ggbio 1.13.6 (BioC-devel) due to some namespace issues. The basic error is: Error : object ‘cols’ is not exported by 'namespace:AnnotationDbi' Error: package or namespace load failed for ‘ggbio’ I'm reporting this because a user reported a similar issue with a package I'm developing (see https://github.com/lcolladotor/derfinder/pull/22). Thanks, Leo The log is shown below: $ R --vanilla R version 3.1.0 (2014-04-10) -- Spring Dance Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin10.8.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. library(ggbio) Loading required package: BiocGenerics Loading required package: parallel Attaching package: ‘BiocGenerics’ The following objects are masked from ‘package:parallel’: clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following object is masked from ‘package:stats’: xtabs The following objects are masked from ‘package:base’: anyDuplicated, append, as.data.frame, as.vector, cbind, colnames, do.call, duplicated, eval, evalq, Filter, Find, get, intersect, is.unsorted, lapply, Map, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce, rep.int, rownames, sapply, setdiff, sort, table, tapply, union, unique, unlist Loading required package: ggplot2 Find out what's changed in ggplot2 with news(Version == 0.9.3.1, package = ggplot2) Error : object ‘cols’ is not exported by 'namespace:AnnotationDbi' Error: package or namespace load failed for ‘ggbio’ sessionInfo() R version 3.1.0 (2014-04-10) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] parallel stats graphics grDevices utils datasets methods [8] base other attached packages: [1] ggplot2_0.9.3.1 BiocGenerics_0.11.2 loaded via a namespace (and not attached): [1] AnnotationDbi_1.27.6 BatchJobs_1.2BBmisc_1.6 [4] Biobase_2.25.0 BiocParallel_0.7.0 biomaRt_2.21.0 [7] Biostrings_2.33.8biovizBase_1.13.7bitops_1.0-6 [10] brew_1.0-6 BSgenome_1.33.5 cluster_1.15.2 [13] codetools_0.2-8 colorspace_1.2-4 DBI_0.2-7 [16] dichromat_2.0-0 digest_0.6.4 fail_1.2 [19] foreach_1.4.2Formula_1.1-1GenomeInfoDb_1.1.5 [22] GenomicAlignments_1.1.10 GenomicFeatures_1.17.6 GenomicRanges_1.17.14 [25] graph_1.43.0 grid_3.1.0 gridExtra_0.9.1 [28] gtable_0.1.2 Hmisc_3.14-4 IRanges_1.99.13 [31] iterators_1.0.7 lattice_0.20-29 latticeExtra_0.6-26 [34] MASS_7.3-33 munsell_0.4.2plyr_1.8.1 [37] proto_0.3-10 RColorBrewer_1.0-5 Rcpp_0.11.1 [40] RCurl_1.95-4.1 reshape2_1.4 Rsamtools_1.17.14 [43] RSQLite_0.11.4 rtracklayer_1.25.8 S4Vectors_0.0.6 [46] scales_0.2.4 sendmailR_1.1-2 splines_3.1.0 [49] stats4_3.1.0 stringr_0.6.2survival_2.37-7 [52] tools_3.1.0 VariantAnnotation_1.11.5 XML_3.98-1.1 [55] XVector_0.5.6zlibbioc_1.11.1 source(http://bioconductor.org/biocLite.R;) Bioconductor version 3.0 (BiocInstaller 1.15.5), ?biocLite for help biocVersion() [1] ‘3.0’ packageVersion(ggbio) [1] ‘1.13.6’ ___ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
Re: [Bioc-devel] Namespace issues with ggbio 1.13.6 from AnnotationDbi 1.27.6 not exporting 'cols'
I think it caused by this importClassesFrom(OrganismDbi, OrganismDb) when comment out, it has no error, I am working on it right now On Thu, May 22, 2014 at 2:21 PM, Leonardo Collado Torres lcoll...@jhsph.edu wrote: Hello, Currently I'm unable to load ggbio 1.13.6 (BioC-devel) due to some namespace issues. The basic error is: Error : object âcolsâ is not exported by 'namespace:AnnotationDbi' Error: package or namespace load failed for âggbioâ I'm reporting this because a user reported a similar issue with a package I'm developing (see https://github.com/lcolladotor/derfinder/pull/22). Thanks, Leo The log is shown below: $ R --vanilla R version 3.1.0 (2014-04-10) -- Spring Dance Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin10.8.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. library(ggbio) Loading required package: BiocGenerics Loading required package: parallel Attaching package: âBiocGenericsâ The following objects are masked from âpackage:parallelâ: clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following object is masked from âpackage:statsâ: xtabs The following objects are masked from âpackage:baseâ: anyDuplicated, append, as.data.frame, as.vector, cbind, colnames, do.call, duplicated, eval, evalq, Filter, Find, get, intersect, is.unsorted, lapply, Map, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce, rep.int, rownames, sapply, setdiff, sort, table, tapply, union, unique, unlist Loading required package: ggplot2 Find out what's changed in ggplot2 with news(Version == 0.9.3.1, package = ggplot2) Error : object âcolsâ is not exported by 'namespace:AnnotationDbi' Error: package or namespace load failed for âggbioâ sessionInfo() R version 3.1.0 (2014-04-10) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] parallel stats graphics grDevices utils datasets methods [8] base other attached packages: [1] ggplot2_0.9.3.1 BiocGenerics_0.11.2 loaded via a namespace (and not attached): [1] AnnotationDbi_1.27.6 BatchJobs_1.2BBmisc_1.6 [4] Biobase_2.25.0 BiocParallel_0.7.0 biomaRt_2.21.0 [7] Biostrings_2.33.8biovizBase_1.13.7bitops_1.0-6 [10] brew_1.0-6 BSgenome_1.33.5 cluster_1.15.2 [13] codetools_0.2-8 colorspace_1.2-4 DBI_0.2-7 [16] dichromat_2.0-0 digest_0.6.4 fail_1.2 [19] foreach_1.4.2Formula_1.1-1GenomeInfoDb_1.1.5 [22] GenomicAlignments_1.1.10 GenomicFeatures_1.17.6 GenomicRanges_1.17.14 [25] graph_1.43.0 grid_3.1.0 gridExtra_0.9.1 [28] gtable_0.1.2 Hmisc_3.14-4 IRanges_1.99.13 [31] iterators_1.0.7 lattice_0.20-29 latticeExtra_0.6-26 [34] MASS_7.3-33 munsell_0.4.2plyr_1.8.1 [37] proto_0.3-10 RColorBrewer_1.0-5 Rcpp_0.11.1 [40] RCurl_1.95-4.1 reshape2_1.4 Rsamtools_1.17.14 [43] RSQLite_0.11.4 rtracklayer_1.25.8 S4Vectors_0.0.6 [46] scales_0.2.4 sendmailR_1.1-2 splines_3.1.0 [49] stats4_3.1.0 stringr_0.6.2survival_2.37-7 [52] tools_3.1.0 VariantAnnotation_1.11.5 XML_3.98-1.1 [55] XVector_0.5.6zlibbioc_1.11.1 source(http://bioconductor.org/biocLite.R;) Bioconductor version 3.0 (BiocInstaller 1.15.5), ?biocLite for help biocVersion() [1] â3.0â packageVersion(ggbio) [1] â1.13.6â -- Tengfei Yin, PhD Seven Bridges Genomics sbgenomics.com 625 Mt. Auburn St. Suite #208 Cambridge, MA 02138 (617) 866-0446 [[alternative HTML version deleted]] ___ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
Re: [Bioc-devel] Namespace issues with ggbio 1.13.6 from AnnotationDbi 1.27.6 not exporting 'cols'
OrganismDbi 1.7.2 (available via biocLite()) has already fixed this so you shouldn't have to change anything. Dan - Original Message - From: Tengfei Yin tengfei@sbgenomics.com To: Leonardo Collado Torres lcoll...@jhsph.edu Cc: bioc-devel@r-project.org Sent: Thursday, May 22, 2014 12:10:29 PM Subject: Re: [Bioc-devel] Namespace issues with ggbio 1.13.6 from AnnotationDbi 1.27.6 not exporting 'cols' I think it caused by this importClassesFrom(OrganismDbi, OrganismDb) when comment out, it has no error, I am working on it right now On Thu, May 22, 2014 at 2:21 PM, Leonardo Collado Torres lcoll...@jhsph.edu wrote: Hello, Currently I'm unable to load ggbio 1.13.6 (BioC-devel) due to some namespace issues. The basic error is: Error : object ‘cols’ is not exported by 'namespace:AnnotationDbi' Error: package or namespace load failed for ‘ggbio’ I'm reporting this because a user reported a similar issue with a package I'm developing (see https://github.com/lcolladotor/derfinder/pull/22). Thanks, Leo The log is shown below: $ R --vanilla R version 3.1.0 (2014-04-10) -- Spring Dance Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin10.8.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. library(ggbio) Loading required package: BiocGenerics Loading required package: parallel Attaching package: ‘BiocGenerics’ The following objects are masked from ‘package:parallel’: clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following object is masked from ‘package:stats’: xtabs The following objects are masked from ‘package:base’: anyDuplicated, append, as.data.frame, as.vector, cbind, colnames, do.call, duplicated, eval, evalq, Filter, Find, get, intersect, is.unsorted, lapply, Map, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce, rep.int, rownames, sapply, setdiff, sort, table, tapply, union, unique, unlist Loading required package: ggplot2 Find out what's changed in ggplot2 with news(Version == 0.9.3.1, package = ggplot2) Error : object ‘cols’ is not exported by 'namespace:AnnotationDbi' Error: package or namespace load failed for ‘ggbio’ sessionInfo() R version 3.1.0 (2014-04-10) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] parallel stats graphics grDevices utils datasets methods [8] base other attached packages: [1] ggplot2_0.9.3.1 BiocGenerics_0.11.2 loaded via a namespace (and not attached): [1] AnnotationDbi_1.27.6 BatchJobs_1.2BBmisc_1.6 [4] Biobase_2.25.0 BiocParallel_0.7.0 biomaRt_2.21.0 [7] Biostrings_2.33.8biovizBase_1.13.7bitops_1.0-6 [10] brew_1.0-6 BSgenome_1.33.5 cluster_1.15.2 [13] codetools_0.2-8 colorspace_1.2-4 DBI_0.2-7 [16] dichromat_2.0-0 digest_0.6.4 fail_1.2 [19] foreach_1.4.2Formula_1.1-1 GenomeInfoDb_1.1.5 [22] GenomicAlignments_1.1.10 GenomicFeatures_1.17.6 GenomicRanges_1.17.14 [25] graph_1.43.0 grid_3.1.0 gridExtra_0.9.1 [28] gtable_0.1.2 Hmisc_3.14-4 IRanges_1.99.13 [31] iterators_1.0.7 lattice_0.20-29 latticeExtra_0.6-26 [34] MASS_7.3-33 munsell_0.4.2plyr_1.8.1 [37] proto_0.3-10 RColorBrewer_1.0-5 Rcpp_0.11.1 [40] RCurl_1.95-4.1 reshape2_1.4 Rsamtools_1.17.14 [43] RSQLite_0.11.4 rtracklayer_1.25.8 S4Vectors_0.0.6 [46] scales_0.2.4 sendmailR_1.1-2 splines_3.1.0 [49] stats4_3.1.0 stringr_0.6.2 survival_2.37-7 [52] tools_3.1.0 VariantAnnotation_1.11.5 XML_3.98-1.1 [55] XVector_0.5.6zlibbioc_1.11.1 source(http://bioconductor.org/biocLite.R;) Bioconductor version 3.0 (BiocInstaller 1.15.5), ?biocLite for help biocVersion() [1] ‘3.0’ packageVersion(ggbio) [1] ‘1.13.6’ -- Tengfei Yin, PhD Seven
Re: [Bioc-devel] Namespace issues with ggbio 1.13.6 from AnnotationDbi 1.27.6 not exporting 'cols'
thanks Dan, confirmed, 1.7.2 available as source, after run biocLite(OrganismDbi, type = source) it works now! On Thu, May 22, 2014 at 3:12 PM, Dan Tenenbaum dtene...@fhcrc.org wrote: OrganismDbi 1.7.2 (available via biocLite()) has already fixed this so you shouldn't have to change anything. Dan - Original Message - From: Tengfei Yin tengfei@sbgenomics.com To: Leonardo Collado Torres lcoll...@jhsph.edu Cc: bioc-devel@r-project.org Sent: Thursday, May 22, 2014 12:10:29 PM Subject: Re: [Bioc-devel] Namespace issues with ggbio 1.13.6 from AnnotationDbi 1.27.6 not exporting 'cols' I think it caused by this importClassesFrom(OrganismDbi, OrganismDb) when comment out, it has no error, I am working on it right now On Thu, May 22, 2014 at 2:21 PM, Leonardo Collado Torres lcoll...@jhsph.edu wrote: Hello, Currently I'm unable to load ggbio 1.13.6 (BioC-devel) due to some namespace issues. The basic error is: Error : object âcolsâ is not exported by 'namespace:AnnotationDbi' Error: package or namespace load failed for âggbioâ I'm reporting this because a user reported a similar issue with a package I'm developing (see https://github.com/lcolladotor/derfinder/pull/22). Thanks, Leo The log is shown below: $ R --vanilla R version 3.1.0 (2014-04-10) -- Spring Dance Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin10.8.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. library(ggbio) Loading required package: BiocGenerics Loading required package: parallel Attaching package: âBiocGenericsâ The following objects are masked from âpackage:parallelâ: clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following object is masked from âpackage:statsâ: xtabs The following objects are masked from âpackage:baseâ: anyDuplicated, append, as.data.frame, as.vector, cbind, colnames, do.call, duplicated, eval, evalq, Filter, Find, get, intersect, is.unsorted, lapply, Map, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce, rep.int, rownames, sapply, setdiff, sort, table, tapply, union, unique, unlist Loading required package: ggplot2 Find out what's changed in ggplot2 with news(Version == 0.9.3.1, package = ggplot2) Error : object âcolsâ is not exported by 'namespace:AnnotationDbi' Error: package or namespace load failed for âggbioâ sessionInfo() R version 3.1.0 (2014-04-10) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] parallel stats graphics grDevices utils datasets methods [8] base other attached packages: [1] ggplot2_0.9.3.1 BiocGenerics_0.11.2 loaded via a namespace (and not attached): [1] AnnotationDbi_1.27.6 BatchJobs_1.2BBmisc_1.6 [4] Biobase_2.25.0 BiocParallel_0.7.0 biomaRt_2.21.0 [7] Biostrings_2.33.8biovizBase_1.13.7bitops_1.0-6 [10] brew_1.0-6 BSgenome_1.33.5 cluster_1.15.2 [13] codetools_0.2-8 colorspace_1.2-4 DBI_0.2-7 [16] dichromat_2.0-0 digest_0.6.4 fail_1.2 [19] foreach_1.4.2Formula_1.1-1 GenomeInfoDb_1.1.5 [22] GenomicAlignments_1.1.10 GenomicFeatures_1.17.6 GenomicRanges_1.17.14 [25] graph_1.43.0 grid_3.1.0 gridExtra_0.9.1 [28] gtable_0.1.2 Hmisc_3.14-4 IRanges_1.99.13 [31] iterators_1.0.7 lattice_0.20-29 latticeExtra_0.6-26 [34] MASS_7.3-33 munsell_0.4.2plyr_1.8.1 [37] proto_0.3-10 RColorBrewer_1.0-5 Rcpp_0.11.1 [40] RCurl_1.95-4.1 reshape2_1.4 Rsamtools_1.17.14 [43] RSQLite_0.11.4 rtracklayer_1.25.8 S4Vectors_0.0.6 [46] scales_0.2.4 sendmailR_1.1-2 splines_3.1.0 [49] stats4_3.1.0 stringr_0.6.2 survival_2.37-7
[Rd] Excluding objects from save.image
When dealing with object holding pointers that are only valid during a single session, it would be convenient to exclude them from being saved with the session image. (I am assuming that `quit` calls `save.image` before quitting or is it internal?) Currently they are saved with the pointer converted to NULL. Its a bit surprising for users not realizing the object is no longer valid. My thought is to designate a class name (perhaps no.save) and exclude anything that inherits from that. I've hacked a quick implementation below. I did not issue a warning, but it would be a simple fix. Does anyone else see this as useful? THK -- http://www.keittlab.org/ .new.save.image = function (file = .RData, version = NULL, ascii = FALSE, compress = !ascii, safe = TRUE, omit.no.save = TRUE) # added omit.no.save argument { if (!is.character(file) || file == ) stop('file' must be non-empty string) opts - getOption(save.image.defaults) if (is.null(opts)) opts - getOption(save.defaults) if (missing(safe) !is.null(opts$safe)) safe - opts$safe if (missing(ascii) !is.null(opts$ascii)) ascii - opts$ascii if (missing(compress) !is.null(opts$compress)) compress - opts$compress if (missing(version)) version - opts$version if (safe) { outfile - paste0(file, Tmp) i - 0 while (file.exists(outfile)) { i - i + 1 outfile - paste0(file, Tmp, i) } } else outfile - file on.exit(file.remove(outfile)) ### Omit objects inheriting from no.save ### objns - ls(envir = .GlobalEnv, all.names = TRUE) if ( omit.no.save ) ### make part of options? objns - subset(objns, sapply(objns, function(x) { ! inherits(get(x, envir = .GlobalEnv), no.save) })) save(list = objns, file = outfile, version = version, ascii = ascii, compress = compress, envir = .GlobalEnv, precheck = FALSE) ### End code changes ### if (safe) if (!file.rename(outfile, file)) { on.exit() stop(gettextf(image could not be renamed and is left in %s, outfile), domain = NA) } on.exit() } setClass(no.save) setClass(test.class, slots = c(s1 = externalptr)) setIs(test.class, no.save) reg.obj = regular object no.save.obj = new(test.class) .image.file = tempfile() save.image(.image.file) rm(reg.obj, no.save.obj) load(.image.file) print(ls()) unlink(.image.file) .new.save.image(.image.file) rm(reg.obj, no.save.obj) load(.image.file) print(ls()) unlink(.image.file) [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Excluding objects from save.image
Tim, On May 21, 2014, at 9:54 PM, Tim Keitt tke...@utexas.edu wrote: When dealing with object holding pointers that are only valid during a single session, it would be convenient to exclude them from being saved with the session image. (I am assuming that `quit` calls `save.image` before quitting or is it internal?) Currently they are saved with the pointer converted to NULL. Its a bit surprising for users not realizing the object is no longer valid. than's not surprising - it's actually very useful, because it tells you that the object has been restored. Typically, packages using external pointers use this to re-inilitialize the object from serialized data or other sources if possible. My thought is to designate a class name (perhaps no.save) and exclude anything that inherits from that. Why would you want to not save it? It exists, so saving it makes it possible to decide on the behavior as needed - as opposed to not saving it and thus losing the information. Cheers, Simon I've hacked a quick implementation below. I did not issue a warning, but it would be a simple fix. Does anyone else see this as useful? THK -- http://www.keittlab.org/ .new.save.image = function (file = .RData, version = NULL, ascii = FALSE, compress = !ascii, safe = TRUE, omit.no.save = TRUE) # added omit.no.save argument { if (!is.character(file) || file == ) stop('file' must be non-empty string) opts - getOption(save.image.defaults) if (is.null(opts)) opts - getOption(save.defaults) if (missing(safe) !is.null(opts$safe)) safe - opts$safe if (missing(ascii) !is.null(opts$ascii)) ascii - opts$ascii if (missing(compress) !is.null(opts$compress)) compress - opts$compress if (missing(version)) version - opts$version if (safe) { outfile - paste0(file, Tmp) i - 0 while (file.exists(outfile)) { i - i + 1 outfile - paste0(file, Tmp, i) } } else outfile - file on.exit(file.remove(outfile)) ### Omit objects inheriting from no.save ### objns - ls(envir = .GlobalEnv, all.names = TRUE) if ( omit.no.save ) ### make part of options? objns - subset(objns, sapply(objns, function(x) { ! inherits(get(x, envir = .GlobalEnv), no.save) })) save(list = objns, file = outfile, version = version, ascii = ascii, compress = compress, envir = .GlobalEnv, precheck = FALSE) ### End code changes ### if (safe) if (!file.rename(outfile, file)) { on.exit() stop(gettextf(image could not be renamed and is left in %s, outfile), domain = NA) } on.exit() } setClass(no.save) setClass(test.class, slots = c(s1 = externalptr)) setIs(test.class, no.save) reg.obj = regular object no.save.obj = new(test.class) .image.file = tempfile() save.image(.image.file) rm(reg.obj, no.save.obj) load(.image.file) print(ls()) unlink(.image.file) .new.save.image(.image.file) rm(reg.obj, no.save.obj) load(.image.file) print(ls()) unlink(.image.file) [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Excluding objects from save.image
On May 22, 2014, at 11:33 AM, Tim Keitt tke...@utexas.edu wrote: On Thu, May 22, 2014 at 9:19 AM, Simon Urbanek simon.urba...@r-project.org wrote: Tim, On May 21, 2014, at 9:54 PM, Tim Keitt tke...@utexas.edu wrote: When dealing with object holding pointers that are only valid during a single session, it would be convenient to exclude them from being saved with the session image. (I am assuming that `quit` calls `save.image` before quitting or is it internal?) Currently they are saved with the pointer converted to NULL. Its a bit surprising for users not realizing the object is no longer valid. than's not surprising - it's actually very useful, because it tells you that the object has been restored. Typically, packages using external pointers use this to re-inilitialize the object from serialized data or other sources if possible. Automatically or with user intervention? Automatically - that is the point :). My thought is to designate a class name (perhaps no.save) and exclude anything that inherits from that. Why would you want to not save it? It exists, so saving it makes it possible to decide on the behavior as needed - as opposed to not saving it and thus losing the information. That's a valid argument. I don't necessarily disagree, but it does depend on the situation and the author's intentions. My question was not about enforcing policy on authors, rather it was about whether this would add value for those that would like to use it for cases where they deem it a benefit. I see those as separate issues. Incidentally, I suggested many years ago hooks in load to make reinitialization possible. Is there some infrastructure for that in R? (And actually hooks on save would be quite useful as well eg one could substitute an object designed to reinitialize the original object on load.) Load time is typically not an issue, since you can just do it lazily. (Incidentally, doing that eagerly at load time is the hard part since you'd have to load the packages necessary in the right order which is not always possible to determine from the serialization alone. It's a full can of worms, because R doesn't know anything about sharing and dependencies on the native side etc.). However, having a proper save hook for ext ptrs would be very useful. When I was asking for it few years ago, Luke mentioned there were issues - maybe it's something that could be re-visited. Cheers, Simon Cheers, THK Cheers, Simon I've hacked a quick implementation below. I did not issue a warning, but it would be a simple fix. Does anyone else see this as useful? THK -- http://www.keittlab.org/ .new.save.image = function (file = .RData, version = NULL, ascii = FALSE, compress = !ascii, safe = TRUE, omit.no.save = TRUE) # added omit.no.save argument { if (!is.character(file) || file == ) stop('file' must be non-empty string) opts - getOption(save.image.defaults) if (is.null(opts)) opts - getOption(save.defaults) if (missing(safe) !is.null(opts$safe)) safe - opts$safe if (missing(ascii) !is.null(opts$ascii)) ascii - opts$ascii if (missing(compress) !is.null(opts$compress)) compress - opts$compress if (missing(version)) version - opts$version if (safe) { outfile - paste0(file, Tmp) i - 0 while (file.exists(outfile)) { i - i + 1 outfile - paste0(file, Tmp, i) } } else outfile - file on.exit(file.remove(outfile)) ### Omit objects inheriting from no.save ### objns - ls(envir = .GlobalEnv, all.names = TRUE) if ( omit.no.save ) ### make part of options? objns - subset(objns, sapply(objns, function(x) { ! inherits(get(x, envir = .GlobalEnv), no.save) })) save(list = objns, file = outfile, version = version, ascii = ascii, compress = compress, envir = .GlobalEnv, precheck = FALSE) ### End code changes ### if (safe) if (!file.rename(outfile, file)) { on.exit() stop(gettextf(image could not be renamed and is left in %s, outfile), domain = NA) } on.exit() } setClass(no.save) setClass(test.class, slots = c(s1 = externalptr)) setIs(test.class, no.save) reg.obj = regular object no.save.obj = new(test.class) .image.file = tempfile() save.image(.image.file) rm(reg.obj, no.save.obj) load(.image.file) print(ls()) unlink(.image.file) .new.save.image(.image.file) rm(reg.obj, no.save.obj) load(.image.file) print(ls()) unlink(.image.file) [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- http://www.keittlab.org/ __ R-devel@r-project.org mailing list
Re: [Rd] Excluding objects from save.image
On Thu, May 22, 2014 at 9:19 AM, Simon Urbanek simon.urba...@r-project.orgwrote: Tim, On May 21, 2014, at 9:54 PM, Tim Keitt tke...@utexas.edu wrote: When dealing with object holding pointers that are only valid during a single session, it would be convenient to exclude them from being saved with the session image. (I am assuming that `quit` calls `save.image` before quitting or is it internal?) Currently they are saved with the pointer converted to NULL. Its a bit surprising for users not realizing the object is no longer valid. than's not surprising - it's actually very useful, because it tells you that the object has been restored. Typically, packages using external pointers use this to re-inilitialize the object from serialized data or other sources if possible. Automatically or with user intervention? My thought is to designate a class name (perhaps no.save) and exclude anything that inherits from that. Why would you want to not save it? It exists, so saving it makes it possible to decide on the behavior as needed - as opposed to not saving it and thus losing the information. That's a valid argument. I don't necessarily disagree, but it does depend on the situation and the author's intentions. My question was not about enforcing policy on authors, rather it was about whether this would add value for those that would like to use it for cases where they deem it a benefit. I see those as separate issues. Incidentally, I suggested many years ago hooks in load to make reinitialization possible. Is there some infrastructure for that in R? (And actually hooks on save would be quite useful as well eg one could substitute an object designed to reinitialize the original object on load.) Cheers, THK Cheers, Simon I've hacked a quick implementation below. I did not issue a warning, but it would be a simple fix. Does anyone else see this as useful? THK -- http://www.keittlab.org/ .new.save.image = function (file = .RData, version = NULL, ascii = FALSE, compress = !ascii, safe = TRUE, omit.no.save = TRUE) # added omit.no.save argument { if (!is.character(file) || file == ) stop('file' must be non-empty string) opts - getOption(save.image.defaults) if (is.null(opts)) opts - getOption(save.defaults) if (missing(safe) !is.null(opts$safe)) safe - opts$safe if (missing(ascii) !is.null(opts$ascii)) ascii - opts$ascii if (missing(compress) !is.null(opts$compress)) compress - opts$compress if (missing(version)) version - opts$version if (safe) { outfile - paste0(file, Tmp) i - 0 while (file.exists(outfile)) { i - i + 1 outfile - paste0(file, Tmp, i) } } else outfile - file on.exit(file.remove(outfile)) ### Omit objects inheriting from no.save ### objns - ls(envir = .GlobalEnv, all.names = TRUE) if ( omit.no.save ) ### make part of options? objns - subset(objns, sapply(objns, function(x) { ! inherits(get(x, envir = .GlobalEnv), no.save) })) save(list = objns, file = outfile, version = version, ascii = ascii, compress = compress, envir = .GlobalEnv, precheck = FALSE) ### End code changes ### if (safe) if (!file.rename(outfile, file)) { on.exit() stop(gettextf(image could not be renamed and is left in %s, outfile), domain = NA) } on.exit() } setClass(no.save) setClass(test.class, slots = c(s1 = externalptr)) setIs(test.class, no.save) reg.obj = regular object no.save.obj = new(test.class) .image.file = tempfile() save.image(.image.file) rm(reg.obj, no.save.obj) load(.image.file) print(ls()) unlink(.image.file) .new.save.image(.image.file) rm(reg.obj, no.save.obj) load(.image.file) print(ls()) unlink(.image.file) [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- http://www.keittlab.org/ [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Excluding objects from save.image
On Thu, May 22, 2014 at 10:47 AM, Simon Urbanek simon.urba...@r-project.org wrote: On May 22, 2014, at 11:33 AM, Tim Keitt tke...@utexas.edu wrote: On Thu, May 22, 2014 at 9:19 AM, Simon Urbanek simon.urba...@r-project.org wrote: Tim, On May 21, 2014, at 9:54 PM, Tim Keitt tke...@utexas.edu wrote: When dealing with object holding pointers that are only valid during a single session, it would be convenient to exclude them from being saved with the session image. (I am assuming that `quit` calls `save.image` before quitting or is it internal?) Currently they are saved with the pointer converted to NULL. Its a bit surprising for users not realizing the object is no longer valid. than's not surprising - it's actually very useful, because it tells you that the object has been restored. Typically, packages using external pointers use this to re-inilitialize the object from serialized data or other sources if possible. Automatically or with user intervention? Automatically - that is the point :). Have an example? Do you save a promise? My thought is to designate a class name (perhaps no.save) and exclude anything that inherits from that. Why would you want to not save it? It exists, so saving it makes it possible to decide on the behavior as needed - as opposed to not saving it and thus losing the information. That's a valid argument. I don't necessarily disagree, but it does depend on the situation and the author's intentions. My question was not about enforcing policy on authors, rather it was about whether this would add value for those that would like to use it for cases where they deem it a benefit. I see those as separate issues. Incidentally, I suggested many years ago hooks in load to make reinitialization possible. Is there some infrastructure for that in R? (And actually hooks on save would be quite useful as well eg one could substitute an object designed to reinitialize the original object on load.) Load time is typically not an issue, since you can just do it lazily. (Incidentally, doing that eagerly at load time is the hard part since you'd have to load the packages necessary in the right order which is not always possible to determine from the serialization alone. It's a full can of worms, because R doesn't know anything about sharing and dependencies on the native side etc.). However, having a proper save hook for ext ptrs would be very useful. When I was asking for it few years ago, Luke mentioned there were issues - maybe it's something that could be re-visited. I'd be interested. I can see it might be tricky deciding when to call the hook. THK Cheers, Simon Cheers, THK Cheers, Simon I've hacked a quick implementation below. I did not issue a warning, but it would be a simple fix. Does anyone else see this as useful? THK -- http://www.keittlab.org/ .new.save.image = function (file = .RData, version = NULL, ascii = FALSE, compress = !ascii, safe = TRUE, omit.no.save = TRUE) # added omit.no.save argument { if (!is.character(file) || file == ) stop('file' must be non-empty string) opts - getOption(save.image.defaults) if (is.null(opts)) opts - getOption(save.defaults) if (missing(safe) !is.null(opts$safe)) safe - opts$safe if (missing(ascii) !is.null(opts$ascii)) ascii - opts$ascii if (missing(compress) !is.null(opts$compress)) compress - opts$compress if (missing(version)) version - opts$version if (safe) { outfile - paste0(file, Tmp) i - 0 while (file.exists(outfile)) { i - i + 1 outfile - paste0(file, Tmp, i) } } else outfile - file on.exit(file.remove(outfile)) ### Omit objects inheriting from no.save ### objns - ls(envir = .GlobalEnv, all.names = TRUE) if ( omit.no.save ) ### make part of options? objns - subset(objns, sapply(objns, function(x) { ! inherits(get(x, envir = .GlobalEnv), no.save) })) save(list = objns, file = outfile, version = version, ascii = ascii, compress = compress, envir = .GlobalEnv, precheck = FALSE) ### End code changes ### if (safe) if (!file.rename(outfile, file)) { on.exit() stop(gettextf(image could not be renamed and is left in %s, outfile), domain = NA) } on.exit() } setClass(no.save) setClass(test.class, slots = c(s1 = externalptr)) setIs(test.class, no.save) reg.obj = regular object no.save.obj = new(test.class) .image.file = tempfile() save.image(.image.file) rm(reg.obj, no.save.obj) load(.image.file) print(ls()) unlink(.image.file) .new.save.image(.image.file) rm(reg.obj, no.save.obj) load(.image.file) print(ls()) unlink(.image.file) [[alternative
[Rd] citEntry handling of encoded URLs
The following citEntry includes a url with %3A and other encodings citEntry(entry=article, title = Software for Computing and Annotating Genomic Ranges, author = personList( as.person(Michael Lawrence )), year = 2013, journal = {PLoS} Computational Biology, volume = 9, issue = 8, doi = 10.1371/journal.pcbi.1003118, url = http://www.ploscompbiol.org/article/info%3Adoi%2F10.1371%2Fjournal.pcbi.1003118;, textVersion = Lawrence M... ) Evaluating this as R code doesn't parse correctly and generates a warning Lawrence M (2013). “Software for Computing and Annotating Genomic Ranges.” _PLoS Computational Biology_, *9*. URL: http://dx.doi.org/10.1371/journal.pcbi.1003118, URL: http://www.ploscompbiol.org/article/info%3Adoi%2F10.1371%2Fjournal.pcbi.1003118}. Warning message: In parse_Rd(Rd, encoding = encoding, fragment = fragment, ...) : connection:5: unexpected END_OF_INPUT ' ' A work-around is, apparently, to quote the %, \\%3A etc., but is this the intention? Also, citEntry points to bibentry points to *Entry Fields*, but the 'url' tag is not mentioned there, even though url appears in the examples; if the list of supported tags is not easy to enumerate, perhaps some insight can be provided at this point as to how the supported tags are determined? Thanks Martin Morgan -- Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel