-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy path_common.R
39 lines (34 loc) · 918 Bytes
/
_common.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
set.seed(42)
options(digits = 3)
library(tidyverse)
library(knitr)
knitr::opts_chunk$set(
comment = "#>",
messages = FALSE,
collapse = TRUE,
out.width = "85%",
fig.align = 'center',
fig.width = 6,
fig.asp = 0.618, # 1 / phi
fig.show = "hold"
)
options(dplyr.print_min = 6, dplyr.print_max = 6)
# hook_output <- knit_hooks$get("output")
# knit_hooks$set(output = function(x, options) {
# lines <- options$output.lines
# if (is.null(lines)) {
# return(hook_output(x, options)) # pass to default hook
# }
# x <- unlist(strsplit(x, "\n"))
# more <- "etc ..."
# if (length(lines)==1) { # first n lines
# if (length(x) > lines) { # truncate the output, but add ....
# x <- c(head(x, lines), more)
# }
# } else {
# x <- c(more, x[lines], more)
# }
# # paste these lines together
# x <- paste(c(x, ""), collapse = "\n")
# hook_output(x, options)
# })