Re: [R-pkg-devel] Suggests in a Package
Thanks. And thanks for the tip. -Roy > On Feb 4, 2020, at 10:20 AM, Duncan Murdoch wrote: > > On 04/02/2020 1:13 p.m., Roy Mendelssohn - NOAA Federal via R-package-devel > wrote: >> Hi All: >> I still get a little confused on what it means if a package is listed in >> "Suggest" in my package. I have been working to try and keep dependencies >> down. One of my packages produces maps with data, and I have been asked if >> the maps can be made interactive. It turns out this can be done very easily >> using "plotly" and I want to include something about that in the vignette. >> What my question is if I Suggest "plotly" in the package, does a user have >> to have "plotly" installed in order to install and run the package? My >> understanding is not, so someone who doesn't want to do this doesn't need >> to install "plotly" but I wanted to double-check. > > Your understanding is correct: someone who doesn't have plotly installed > should still be able to install and run your package. > > You should make sure that any functions that need plotly check for it first. > The recommended way to do that is to use a requireNamespace("plotly") test, > e.g. something like > > if (requireNamespace("plotly")) { > plotly::plotly(...) > } else > stop("This function requires the 'plotly' package") > > Your tests that use such a function should only be run if > requireNamespace("plotly") returns TRUE. > > Duncan Murdoch ** "The contents of this message do not reflect any position of the U.S. Government or NOAA." ** Roy Mendelssohn Supervisory Operations Research Analyst NOAA/NMFS Environmental Research Division Southwest Fisheries Science Center ***Note new street address*** 110 McAllister Way Santa Cruz, CA 95060 Phone: (831)-420-3666 Fax: (831) 420-3980 e-mail: roy.mendelss...@noaa.gov www: https://www.pfeg.noaa.gov/ "Old age and treachery will overcome youth and skill." "From those who have been given much, much will be expected" "the arc of the moral universe is long, but it bends toward justice" -MLK Jr. __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Suggests in a Package
On 04/02/2020 1:13 p.m., Roy Mendelssohn - NOAA Federal via R-package-devel wrote: Hi All: I still get a little confused on what it means if a package is listed in "Suggest" in my package. I have been working to try and keep dependencies down. One of my packages produces maps with data, and I have been asked if the maps can be made interactive. It turns out this can be done very easily using "plotly" and I want to include something about that in the vignette. What my question is if I Suggest "plotly" in the package, does a user have to have "plotly" installed in order to install and run the package? My understanding is not, so someone who doesn't want to do this doesn't need to install "plotly" but I wanted to double-check. Your understanding is correct: someone who doesn't have plotly installed should still be able to install and run your package. You should make sure that any functions that need plotly check for it first. The recommended way to do that is to use a requireNamespace("plotly") test, e.g. something like if (requireNamespace("plotly")) { plotly::plotly(...) } else stop("This function requires the 'plotly' package") Your tests that use such a function should only be run if requireNamespace("plotly") returns TRUE. Duncan Murdoch __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
[R-pkg-devel] Suggests in a Package
Hi All: I still get a little confused on what it means if a package is listed in "Suggest" in my package. I have been working to try and keep dependencies down. One of my packages produces maps with data, and I have been asked if the maps can be made interactive. It turns out this can be done very easily using "plotly" and I want to include something about that in the vignette. What my question is if I Suggest "plotly" in the package, does a user have to have "plotly" installed in order to install and run the package? My understanding is not, so someone who doesn't want to do this doesn't need to install "plotly" but I wanted to double-check. Thanks, -Roy ** "The contents of this message do not reflect any position of the U.S. Government or NOAA." ** Roy Mendelssohn Supervisory Operations Research Analyst NOAA/NMFS Environmental Research Division Southwest Fisheries Science Center ***Note new street address*** 110 McAllister Way Santa Cruz, CA 95060 Phone: (831)-420-3666 Fax: (831) 420-3980 e-mail: roy.mendelss...@noaa.gov www: https://www.pfeg.noaa.gov/ "Old age and treachery will overcome youth and skill." "From those who have been given much, much will be expected" "the arc of the moral universe is long, but it bends toward justice" -MLK Jr. __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel