It is Time for CRAN to Ban Package Ads

[This article was first published on R – Win-Vector Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

NPM (a popular Javascript package repository) just banned package advertisements. I feel the CRAN repository should do the same.

Not all R-users are fully aware of package advertisements. But they clutter up work, interfere with reproducibility, and frankly are just wrong.

Here is an example which could be considered to contain advertisements: .onAttach() from ggplot2 (promoting websites, and books):

.onAttach <- function(...) { withr::with_preserve_seed({ if (!interactive() || stats::runif(1) > 0.1) return() tips <- c( "RStudio Community is a great place to get help: https://community.rstudio.com/c/tidyverse.", "Find out what's changed in ggplot2 at https://github.com/tidyverse/ggplot2/releases.", "Use suppressPackageStartupMessages() to eliminate package startup messages.", "Need help? Try Stackoverflow: https://stackoverflow.com/tags/ggplot2.", "Need help getting started? Try the cookbook for R: http://www.cookbook-r.com/Graphs/", "Want to understand how all the pieces fit together? See the R for Data Science book: http://r4ds.had.co.nz/" ) tip <- sample(tips, 1) packageStartupMessage(paste(strwrap(tip), collapse = "\n")) }) }

The above means: when you attach ggplot2, it is needlessly monkeying with the pseudo-random number generator (in addition to running it is attempting to re-wind its state to appear to not have run it), and 10 percent of the time inserting an advertisement. This is needlessly non-deterministic and can spoil work if you don’t take the (advertised) precaution of using suppressPackageStartupMessages().

In R the correct way to attach a package should be:

library(PACKAGE_NAME)

and not:

suppressPackageStartupMessages(library(PACKAGE_NAME))

This specific instance may or may not bother you. But if this style of messaging is allowed, what advertising is also allowed and where will that take us?

Users should insist on clean packages that can be attached deterministically and neatly. Users should insist on having access to “free software“, (“advertising supported” is often not considered the same as “free”).

To leave a comment for the author, please follow the link and comment on their blog: R – Win-Vector Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)