Permalink
Browse files

Occassionally provide a hint or tip on startup.

Fixes #284
  • Loading branch information...
1 parent 7dafed4 commit 039abc0535575d381062a7b3870e21f98abec314 @hadley hadley committed Dec 19, 2011
Showing with 20 additions and 0 deletions.
  1. +1 −0 DESCRIPTION
  2. +3 −0 NEWS
  3. +16 −0 R/zzz.r
View
@@ -187,3 +187,4 @@ Collate:
'annotation-raster.r'
'annotation-map.r'
'autoplot.r'
+ 'zzz.r'
View
3 NEWS
@@ -55,6 +55,9 @@ MINOR CHANGES
* `coord_fixed` accepts `xlim` and `ylim` parameters to zoom in on x and y
scales (Fixes #91)
+* ggplot2 will occasionally display a useful hint or tip on startup. Use
+ `suppressPackageStartupMessages` to eliminate
+
DEVELOPMENT
* ggplot2 has moved away from the two (!!) homegrown documentation systems
View
16 R/zzz.r
@@ -0,0 +1,16 @@
+tips <- c(
+ "Need help? Try the ggplot2 mailing list: http://groups.google.com/group/ggplot2.",
+ paste("Find out what's changed in ggplot2 with\n",
+ "news(Version == \"", packageVersion("ggplot2"),
@kohske

kohske Dec 28, 2011

Collaborator

This also induce package-related error if ggplot2 are not installed in lib.loc, so load_all in devtools fails.

@hadley

hadley Dec 28, 2011

Owner

Fixed in 4cfb8f41a6e40daa2a00af26923be21c9d550b48

+ "\", package = \"ggplot2\")", sep = ""),
+ "Use suppressPackageStartupMessages to eliminate package startup messages."
+)
+
+.onLoad <- function(...) {
+ if (runif(1) > 0.1) return()
+
+ tip <- sample(tips, 1)
+ packageStartupMessage(tip)
+}
+
+

0 comments on commit 039abc0

Please sign in to comment.