Skip to content

Commit f72102f

Browse files
authored
Refactor and update random tips (#3747)
1 parent 6d6a076 commit f72102f

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

R/zzz.r

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@
22
withr::with_preserve_seed({
33
if (!interactive() || stats::runif(1) > 0.1) return()
44

5-
tips <- c(
6-
"RStudio Community is a great place to get help: https://community.rstudio.com/c/tidyverse.",
7-
"Find out what's changed in ggplot2 at https://github.com/tidyverse/ggplot2/releases.",
8-
"Use suppressPackageStartupMessages() to eliminate package startup messages.",
9-
"Need help? Try Stackoverflow: https://stackoverflow.com/tags/ggplot2.",
10-
"Need help getting started? Try the cookbook for R: http://www.cookbook-r.com/Graphs/",
11-
"Want to understand how all the pieces fit together? See the R for Data Science book: http://r4ds.had.co.nz/"
12-
)
13-
14-
tip <- sample(tips, 1)
5+
tip <- random_tip()
156
packageStartupMessage(paste(strwrap(tip), collapse = "\n"))
167
})
178
}
189

10+
random_tip <- function() {
11+
tips <- c(
12+
"RStudio Community is a great place to get help: https://community.rstudio.com/c/tidyverse",
13+
"Learn more about the underlying theory at https://ggplot2-book.org/",
14+
"Keep up to date with changes at https://www.tidyverse.org/blog/",
15+
"Use suppressPackageStartupMessages() to eliminate package startup messages",
16+
"Need help? Try Stackoverflow: https://stackoverflow.com/tags/ggplot2",
17+
"Need help getting started? Try the R Graphics Cookbok: https://r-graphics.org",
18+
"Want to understand how all the pieces fit together? Read R for Data Science: https://r4ds.had.co.nz/"
19+
)
20+
21+
sample(tips, 1)
22+
}
23+
1924
# Assigning pathGrob in .onLoad ensures that packages that subclass GeomPolygon
2025
# do not install with error `possible error in 'pathGrob(munched$x, munched$y, ':
2126
# unused argument (pathId = munched$group)` despite the fact that this is correct

0 commit comments

Comments
 (0)