r4ds/_common.R

39 lines
947 B
R
Raw Normal View History

set.seed(1014)
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
2021-04-20 19:48:01 +08:00
# cache = TRUE,
2022-02-24 04:05:33 +08:00
fig.retina = 2,
2016-07-18 22:52:55 +08:00
fig.width = 6,
2022-02-24 04:05:33 +08:00
fig.asp = 2/3,
2016-07-18 22:52:55 +08:00
fig.show = "hold"
)
options(dplyr.print_min = 6, dplyr.print_max = 6)
2020-10-05 04:08:42 +08:00
2021-04-20 19:48:01 +08:00
# Activate crayon output
options(
crayon.enabled = TRUE,
2021-04-20 21:32:39 +08:00
pillar.bold = TRUE,
stringr.html = FALSE
2021-04-20 19:48:01 +08:00
)
2021-05-04 21:10:39 +08:00
status <- function(type) {
status <- switch(type,
2022-02-16 01:59:19 +08:00
polishing = "should be readable but is currently undergoing final polishing",
restructuring = "is undergoing heavy restructuring and may be confusing or incomplete",
drafting = "is currently a dumping ground for ideas, and we don't recommend reading it",
2021-05-04 21:10:39 +08:00
stop("Invalid `type`", call. = FALSE)
)
cat(paste0(
"::: {.rmdnote}\n",
"You are reading the work-in-progress second edition of R for Data Science. ",
2022-02-16 01:59:19 +08:00
"This chapter ", status, ". ",
2021-05-04 21:10:39 +08:00
"You can find the polished first edition at <https://r4ds.had.co.nz>.\n",
":::\n"
))
}