Skip to content

Refactor and update random tips #3747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions R/zzz.r
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@
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)
tip <- random_tip()
packageStartupMessage(paste(strwrap(tip), collapse = "\n"))
})
}

random_tip <- function() {
tips <- c(
"RStudio Community is a great place to get help: https://community.rstudio.com/c/tidyverse",
"Learn more about the underlying theory at https://ggplot2-book.org/",
"Keep up to date with changes at https://www.tidyverse.org/blog/",
"Use suppressPackageStartupMessages() to eliminate package startup messages",
"Need help? Try Stackoverflow: https://stackoverflow.com/tags/ggplot2",
"Need help getting started? Try the R Graphics Cookbok: https://r-graphics.org",
"Want to understand how all the pieces fit together? Read R for Data Science: https://r4ds.had.co.nz/"
)

sample(tips, 1)
}

# Assigning pathGrob in .onLoad ensures that packages that subclass GeomPolygon
# do not install with error `possible error in 'pathGrob(munched$x, munched$y, ':
# unused argument (pathId = munched$group)` despite the fact that this is correct
Expand Down