Skip to content

Commit

Permalink
version 1.39
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui authored and cran-robot committed Apr 26, 2022
1 parent a19a243 commit 09052cf
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 69 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Package: knitr
Type: Package
Title: A General-Purpose Package for Dynamic Report Generation in R
Version: 1.38
Version: 1.39
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
person("Abhraneel", "Sarma", role = "ctb"),
Expand Down Expand Up @@ -123,7 +123,7 @@ Encoding: UTF-8
VignetteBuilder: knitr
SystemRequirements: Package vignettes based on R Markdown v2 or
reStructuredText require Pandoc (http://pandoc.org). The
function rst2pdf() require rst2pdf
function rst2pdf() requires rst2pdf
(https://github.com/rst2pdf/rst2pdf).
Collate: 'block.R' 'cache.R' 'utils.R' 'citation.R' 'hooks-html.R'
'plot.R' 'defaults.R' 'concordance.R' 'engine.R' 'highlight.R'
Expand All @@ -135,7 +135,7 @@ Collate: 'block.R' 'cache.R' 'utils.R' 'citation.R' 'hooks-html.R'
'utils-sweave.R' 'utils-upload.R' 'utils-vignettes.R' 'zzz.R'
RoxygenNote: 7.1.2
NeedsCompilation: no
Packaged: 2022-03-25 12:35:53 UTC; yihui
Packaged: 2022-04-26 22:08:17 UTC; yihui
Author: Yihui Xie [aut, cre] (<https://orcid.org/0000-0003-0645-5666>),
Abhraneel Sarma [ctb],
Adam Vogt [ctb],
Expand Down Expand Up @@ -241,4 +241,4 @@ Author: Yihui Xie [aut, cre] (<https://orcid.org/0000-0003-0645-5666>),
Zhian N. Kamvar [ctb] (<https://orcid.org/0000-0003-1458-7108>)
Maintainer: Yihui Xie <xie@yihui.name>
Repository: CRAN
Date/Publication: 2022-03-25 14:00:02 UTC
Date/Publication: 2022-04-26 23:30:05 UTC
32 changes: 16 additions & 16 deletions MD5
@@ -1,12 +1,12 @@
4c0de3016d1024fb2a37f3c903f88f36 *DESCRIPTION
3cf6c3a046834ecb0646afea8a0a46b3 *DESCRIPTION
f1f4b27531a2429eb2c46381fe02df9d *NAMESPACE
0fdd11c84ce09047d9cb3addea84765d *R/block.R
50388dd9a65dbaf76e3cdd3cab397cdc *R/cache.R
5b9c31da86c0fe1dac21aa69b660e2d9 *R/citation.R
d3066cdaec8d60368dfa30093222ac88 *R/concordance.R
aad10e1851ac2ada787769b3ee6e22be *R/defaults.R
a7f8b20eefad1444e2a2e17b04b37dd2 *R/engine.R
035c878dfd98d5fa729d4b259fee6c4c *R/header.R
205de0c01e6e23cf8eb93d0dc279a646 *R/header.R
73691d9549452b4c91bb3b27362a74b3 *R/highlight.R
ac3146904a77572f10bc89469187e5ec *R/hooks-asciidoc.R
ad8783b17b5906fc6c07f09f4d296f7b *R/hooks-chunk.R
Expand All @@ -17,26 +17,26 @@ d928dba427e23df36670dff7e3d3af75 *R/hooks-html.R
b6ba14a52efac7c61dbe6b52292645a1 *R/hooks-rst.R
4b7cc5acf13b4964d371f09d3b01f1d2 *R/hooks-textile.R
d099970247f697104c86564dafb6c54a *R/hooks.R
c30906c3ca77224df46aabd3b3615955 *R/output.R
b056a5192f2f26e842dfa1644bd7fad8 *R/output.R
a4ab9f478c9d7f460c8a6b4dda698f54 *R/package.R
ee33d2131b9dd8e9ceaa043d83fa7390 *R/pandoc.R
62a8271ab2bb4cb847b002d2735c5761 *R/params.R
d4dda063c1d95697b244b98a5d306a34 *R/parser.R
c06d6a9df319d255561fd36e2c0bfaab *R/parser.R
e28c0a1ed473604567f7a209ef67b86a *R/pattern.R
a5b6a6fdbabfdcc2aed68829f382ab0d *R/plot.R
f20b117fcd47625e48c90d20867b6b34 *R/plot.R
b1cd5daa73317f3fbdf958376e145a29 *R/rocco.R
b5f7fa8f6e9846073b747b4176ee56be *R/spin.R
ef24634dfd66c7fa616651d6d29e3d9e *R/table.R
5f50b6bde0f31e7f3499e10260a22635 *R/template.R
ee48d4060f9c5e7dc8b8c67f272eeebe *R/themes.R
641c81e294296b716a204c5a7d71a923 *R/utils-conversion.R
cff7000295ea6bf361f0d0f24da1e35a *R/themes.R
12b8c5b88388b945495cdc0df59f0ad2 *R/utils-conversion.R
1d4a50e3977e2f2016772f179e2de15f *R/utils-rd2html.R
aeb29eb209d25167087606e2f5401cd9 *R/utils-sweave.R
6bc1fb2aafcadb9c634aa8f640e54887 *R/utils-upload.R
4059016d909ffff9d8c6c39a8cc1ebd9 *R/utils-vignettes.R
fe59f6f23a32431f12de538313c728d6 *R/utils.R
64580757ed828267f6976d73231f1f8f *R/zzz.R
bf828a0d235c246446231e94fc2ea1c6 *build/vignette.rds
3328c60d9ae6041e9a9b1250b8330eaf *build/vignette.rds
5320cec79c972798fe0eb5579eb51927 *demo/00Index
a0d48f6ce89f9e1d39ee7248ff8c5511 *demo/gwidgets.R
a95e58617a42ea5ea95fa99a10f1c120 *demo/notebook.R
Expand All @@ -54,21 +54,21 @@ b47c340c4060c759ed158eeb0c258560 *inst/doc/docco-classic.Rmd
f79998a91f3a618886659010dda5d987 *inst/doc/docco-linear.html
3e4b708e32004e6634e71a946d2b7d72 *inst/doc/knit_expand.R
4774af06c0d07027763d929823c5c384 *inst/doc/knit_expand.Rmd
a7304fef2546761cfceeda4814df6a52 *inst/doc/knit_expand.html
40e69c6014378dfb3a6ebd82e6954f01 *inst/doc/knit_expand.html
7589790b62a05f2f0e47e5ee939ac6e6 *inst/doc/knit_print.R
2ee45ca25b0161540ce8df5288d8fa15 *inst/doc/knit_print.Rmd
a9b78c3eaad4cad077bdc6420387e3b9 *inst/doc/knit_print.html
9b0c67c167f3cb0e9c3ec61a89fcbe04 *inst/doc/knit_print.html
769d05c90e0867719cdee64025753b53 *inst/doc/knitr-html.R
824b923dd4a500fb460a2366aabfb19c *inst/doc/knitr-html.Rhtml
ed7a436946acedc07947ed3a01974999 *inst/doc/knitr-html.html
23404d775025e833ea59a5e08270fc0e *inst/doc/knitr-intro.R
89f153ccf155fca8ecb1eb304da5c29c *inst/doc/knitr-intro.Rmd
6138eff87ffb4ca8a3c91bbd82c646f7 *inst/doc/knitr-intro.html
293696fb7aad17c34790d38d1680d0c5 *inst/doc/knitr-intro.html
3c00ba068a4599f959ba80e7beb0c758 *inst/doc/knitr-markdown.R
36707482a23e2739b09033bdd35ebbe7 *inst/doc/knitr-markdown.Rmd
be8bb342b013211346dd6d740955ef99 *inst/doc/knitr-markdown.html
8409220ab43b411e6e521ba2e77cfde5 *inst/doc/knitr-markdown.html
e2713b536f8a81e1071198c985475d5d *inst/doc/knitr-refcard.Rmd
a5ce551b629f49dbbe35d5f5842127b1 *inst/doc/knitr-refcard.pdf
bd0a463602d60f0447e6bdc3a10dd95a *inst/doc/knitr-refcard.pdf
f16d37ed927336b920c67ce2e958ffc5 *inst/examples/README.md
80d81165446ea535b4368b5f6375d7a1 *inst/examples/Sweavel.sty
5cc86725bad53543ab7cc881a2783269 *inst/examples/child/knitr-child-a.Rnw
Expand Down Expand Up @@ -119,7 +119,7 @@ e185911fcf189089aa9b39216c652c9c *inst/misc/knitr-template.Rhtml
8da99e02dfa98e2b973985e2beefb518 *inst/misc/knitr-template.Rmd
bdd0af9d06749374afb3d36a5916d191 *inst/misc/knitr-template.Rnw
e3e31286dead44f4d14e6c6ce0b869d2 *inst/misc/knitr.css
dc39973a7d46bb9c7a1c9172f9f244bf *inst/misc/knitr.sty
9492f7e2a18eb0c1b0ba836638cc1085 *inst/misc/knitr.sty
3510b0b40df85ecc14ba83682eb215c6 *inst/misc/stitch-test.R
37b977988aade59295d956751e6a4d0a *inst/misc/tikz2pdf.tex
e1bcfa4fa59e6027485d6761cef388ae *inst/misc/toggleR.js
Expand Down Expand Up @@ -235,7 +235,7 @@ caefcb554d3691e5a7c92bca5bb9db5d *man/hook_document.Rd
71300a86c312a2949bc50393772cf1c6 *man/hook_plot.Rd
7f3b313ee6f7a592d7319198d808e857 *man/image_uri.Rd
89e254a6b0162f677a920dd6054a4ed9 *man/imgur_upload.Rd
5da5916d987fbf2d8d14817629d92a4e *man/include_graphics.Rd
7e498e79dfb695cb00582cf448bbab25 *man/include_graphics.Rd
8bdd9512d57176c507216419eab1858e *man/include_url.Rd
339b19fe49695c2640a3876542a13142 *man/inline_expr.Rd
3d8b2f2793a4869444669d2fba2fda6e *man/is_low_change.Rd
Expand Down Expand Up @@ -306,7 +306,7 @@ c7306a791facc53dbe80cc5b6c244293 *tests/testit/test-output.R
ef2beb254ea8bcf4ff1df40b47468d5d *tests/testit/test-params.R
d1387ef859e6f621f77b1124403af19c *tests/testit/test-parser.R
186581c73fbcc4f99770517bf638db4b *tests/testit/test-patterns.R
b2a4f15cc8f9e70701033cb28b7e50fc *tests/testit/test-plot.R
ad2678c42641605592b9380c89692c1c *tests/testit/test-plot.R
09028e8ca1d0b3fe013d5af7ef3ab819 *tests/testit/test-spin.R
233af33c6f30c6966d2fceaf0809e22a *tests/testit/test-sql.R
070462314b8d7a331ba71acf1b6e3d66 *tests/testit/test-table.R
Expand Down
28 changes: 22 additions & 6 deletions R/header.R
Expand Up @@ -13,11 +13,9 @@ insert_header = function(doc) {
}

# Makes latex header with macros required for highlighting, tikz and framed
make_header_latex = function() {
make_header_latex = function(doc) {
h = one_string(c(
sprintf('\\usepackage[%s]{graphicx}\\usepackage[%s]{color}',
opts_knit$get('latex.options.graphicx') %n% '',
opts_knit$get('latex.options.color') %n% ''),
header_latex_packages(doc),
.header.maxwidth, opts_knit$get('header'),
if (getOption('OutDec') != '.') '\\usepackage{amsmath}',
if (out_format('latex')) '\\usepackage{alltt}'
Expand All @@ -28,6 +26,24 @@ make_header_latex = function() {
}
}

# if the document already contains \usepackage[options]{pkg}, use the same
# options to avoid the option clash error in LaTeX
use_package = function(pkg, doc) {
opts = sapply(pkg, function(p) {
r = sprintf('.*?\\\\usepackage\\[(.+?)]\\{%s}.*', p)
o = xfun::grep_sub(r, '\\1', doc)
if (length(o)) return(o[1])
opts_knit$get(paste0('latex.options.', p)) %n% ''
})
sprintf('\\usepackage[%s]{%s}', opts, pkg)
}

# for backward-compatibility, use xcolor package unless the latex.options.color
# has been set; xcolor is preferred: https://github.com/latex3/latex2e/pull/719
header_latex_packages = function(doc) {
paste(use_package(c('graphicx', 'xcolor'), doc), collapse = '')
}

insert_header_latex = function(doc, b) {
i = grep(b, doc)
if (length(i) >= 1L) {
Expand All @@ -41,11 +57,11 @@ insert_header_latex = function(doc, b) {
}
i = i[1L]; l = stringr::str_locate(doc[i], b)
tmp = stringr::str_sub(doc[i], l[, 1], l[, 2])
stringr::str_sub(doc[i], l[,1], l[,2]) = paste0(tmp, make_header_latex())
stringr::str_sub(doc[i], l[,1], l[,2]) = paste0(tmp, make_header_latex(doc))
} else if (parent_mode() && !child_mode()) {
# in parent mode, we fill doc to be a complete document
doc[1L] = one_string(c(
getOption('tikzDocumentDeclaration'), make_header_latex(),
getOption('tikzDocumentDeclaration'), make_header_latex(doc),
.knitEnv$tikzPackages, '\\begin{document}', doc[1L]
))
doc[length(doc)] = one_string(
Expand Down
10 changes: 6 additions & 4 deletions R/output.R
Expand Up @@ -139,11 +139,10 @@ knit = function(
input = file.path(input_dir(), input)
}
# respect the quiet argument in child mode (#741)
optk = opts_knit$get(); on.exit(opts_knit$set(optk), add = TRUE)
optk = opts_knit$get(); on.exit(opts_knit$restore(optk), add = TRUE)
opts_knit$set(progress = opts_knit$get('progress') && !quiet)
quiet = !opts_knit$get('progress')
} else {
opts_knit$set(output.dir = getwd()) # record working directory in 1st run
knit_log$restore()
on.exit(chunk_counter(reset = TRUE), add = TRUE) # restore counter
adjust_opts_knit()
Expand All @@ -156,8 +155,11 @@ knit = function(
optc = opts_chunk$get(); on.exit(opts_chunk$restore(optc), add = TRUE)
ocode = knit_code$get(); on.exit(knit_code$restore(ocode), add = TRUE)
on.exit(opts_current$restore(), add = TRUE)
optk = opts_knit$get(); on.exit(opts_knit$set(optk), add = TRUE)
opts_knit$set(tangle = tangle, progress = opts_knit$get('progress') && !quiet)
optk = opts_knit$get(); on.exit(opts_knit$restore(optk), add = TRUE)
opts_knit$set(
output.dir = getwd(), # record working directory in 1st run
tangle = tangle, progress = opts_knit$get('progress') && !quiet
)
}
# store the evaluation environment and restore on exit
oenvir = .knitEnv$knit_global; .knitEnv$knit_global = envir
Expand Down
2 changes: 1 addition & 1 deletion R/parser.R
Expand Up @@ -276,7 +276,7 @@ partition_chunk = function(engine, code) {
meta = substr(src, nchar(s1) + 1, nchar(src) - nchar(s2))
# see if the metadata looks like YAML or CSV
if (grepl('^[^ :]+:($|\\s)', meta[1])) {
meta = yaml::yaml.load(meta, eval.expr = TRUE)
meta = yaml::yaml.load(meta, handlers = list(expr = parse_only))
if (!is.list(meta) || length(names(meta)) == 0) {
warning('Invalid YAML option format in chunk: \n', one_string(meta), '\n')
meta = list()
Expand Down
16 changes: 12 additions & 4 deletions R/plot.R
Expand Up @@ -438,6 +438,10 @@ par2 = function(x) {
#' inches) of the images. This will be their actual width in pixels, divided
#' by \code{dpi}. If not provided, the chunk option \code{dpi} is used; if
#' \code{NA}, the output width will not be calculated.
#' @param rel_path Whether to automatically convert absolute paths to relative
#' paths. If you know for sure that absolute paths work, you may set this
#' argument or the global option \code{knitr.graphics.rel_path} to
#' \code{FALSE}.
#' @param error Whether to signal an error if any files specified in the
#' \code{path} argument do not exist and are not web resources.
#' @note This function is supposed to be used in R code chunks or inline R code
Expand All @@ -455,13 +459,17 @@ par2 = function(x) {
#' @export
include_graphics = function(
path, auto_pdf = getOption('knitr.graphics.auto_pdf', FALSE), dpi = NULL,
rel_path = getOption('knitr.graphics.rel_path', TRUE),
error = getOption('knitr.graphics.error', TRUE)
) {
path = native_encode(path) # https://d.cosx.org/d/420524
if (any(i <- xfun::is_abs_path(path))) warning(
'It is highly recommended to use relative paths for images. ',
'You had absolute paths: ', quote_vec(path[i])
)
if (any(i <- xfun::is_abs_path(path)) && rel_path && !is.null(d <- opts_knit$get('output.dir'))) {
path[i] = xfun::relative_path(path[i], d, error = FALSE)
if (any(j <- xfun::is_abs_path(path[i]))) warning(
'It is highly recommended to use relative paths for images. ',
'You had absolute paths: ', quote_vec(path[i][j])
)
}
path = path.expand(path) # https://github.com/rstudio/rmarkdown/issues/1053
if (auto_pdf && is_latex_output()) {
path2 = with_ext(path, 'pdf')
Expand Down
3 changes: 0 additions & 3 deletions R/themes.R
Expand Up @@ -70,9 +70,6 @@ theme_to_header_latex = function(theme) {

# write latex highlight header
fgheader = color_def(foreground, 'fgcolor')
fgheader = c(fgheader, '\\makeatletter', sprintf(
'\\@ifundefined{AddToHook}{}{\\AddToHook{package/xcolor/after}{%s}}', fgheader
), '\\makeatother')
highlight = one_string(c(fgheader, styler_assistant_latex(css_out[-1])))
list(highlight = highlight, background = background, foreground = foreground)
}
Expand Down
3 changes: 1 addition & 2 deletions R/utils-conversion.R
Expand Up @@ -115,8 +115,7 @@ rnw2pdf = function(
# On Windows, when tweaking the content, users may forget to close the PDF
# file (thus can't be written). Since knitting may take quite some time, it's
# better to check the write permission of the output file in advance.
file.remove(output)
if (xfun::file_exists(output)) stop(
if (xfun::file_exists(output) && !file.remove(output)) stop(
"The file '", output, "' cannot be removed (may be locked by a PDF reader)."
)
old = opts_chunk$set(error = error)
Expand Down
Binary file modified build/vignette.rds
Binary file not shown.
4 changes: 2 additions & 2 deletions inst/doc/knit_expand.html
Expand Up @@ -220,7 +220,7 @@ <h1>Demos of <code>knit_expand()</code></h1>
<pre><code class="r">knit_expand(text = &#39;The value of a is {{a}}, so a + 1 is {{a+1}}.&#39;, a = rnorm(1))
</code></pre>

<pre><code>## [1] &quot;The value of a is 1.14969284175351, so a + 1 is 2.14969284175351.&quot;
<pre><code>## [1] &quot;The value of a is -0.457571911722792, so a + 1 is 0.542428088277208.&quot;
</code></pre>

<pre><code class="r">knit_expand(text = &#39;The area of a circle with radius {{r}} is {{pi*r^2}}&#39;, r = 5)
Expand Down Expand Up @@ -258,7 +258,7 @@ <h1>Demos of <code>knit_expand()</code></h1>
<pre><code class="r">knit_expand(text = &#39;you cannot see the value of x {{x=rnorm(1)}}but it is indeed created: x = {{x}}&#39;)
</code></pre>

<pre><code>## [1] &quot;you cannot see the value of x but it is indeed created: x = -0.418363940772454&quot;
<pre><code>## [1] &quot;you cannot see the value of x but it is indeed created: x = -0.995003890720546&quot;
</code></pre>

<pre><code class="r">res = knit_expand(text = c(&#39; x | x^2&#39;, &#39;{{x=1:5;paste(sprintf(&quot;%2d | %3d&quot;, x, x^2), collapse = &quot;\n&quot;)}}&#39;))
Expand Down
25 changes: 14 additions & 11 deletions inst/doc/knit_print.html
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="Yihui Xie" />

<meta name="date" content="2022-03-25" />
<meta name="date" content="2022-04-26" />

<title>Custom Print Methods</title>

Expand Down Expand Up @@ -372,17 +372,20 @@

<h1 class="title toc-ignore">Custom Print Methods</h1>
<h4 class="author">Yihui Xie</h4>
<h4 class="date">2022-03-25</h4>
<h4 class="date">2022-04-26</h4>


<div id="TOC">
<ul>
<li><a href="#customize-printing">Customize Printing</a></li>
<li><a href="#a-low-level-explanation">A Low-level Explanation</a>
<li><a href="#customize-printing" id="toc-customize-printing">Customize
Printing</a></li>
<li><a href="#a-low-level-explanation" id="toc-a-low-level-explanation">A Low-level Explanation</a>
<ul>
<li><a href="#the-render-option">The <code>render</code> option</a></li>
<li><a href="#metadata">Metadata</a></li>
<li><a href="#for-package-authors">For package authors</a></li>
<li><a href="#the-render-option" id="toc-the-render-option">The
<code>render</code> option</a></li>
<li><a href="#metadata" id="toc-metadata">Metadata</a></li>
<li><a href="#for-package-authors" id="toc-for-package-authors">For
package authors</a></li>
</ul></li>
</ul>
</div>
Expand Down Expand Up @@ -423,7 +426,7 @@ <h2>Customize Printing</h2>
## UseMethod(&quot;knit_print&quot;)
## }
## }
## &lt;bytecode: 0x7fd3542685a8&gt;
## &lt;bytecode: 0x7fe7362ac0e0&gt;
## &lt;environment: namespace:knitr&gt;</code></pre>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">methods</span>(knit_print)</span></code></pre></div>
<pre><code>## [1] knit_print.css* knit_print.data.frame*
Expand All @@ -441,12 +444,12 @@ <h2>Customize Printing</h2>
## x
## else normal_print(x)
## }
## &lt;bytecode: 0x7fd34ea68028&gt;
## &lt;bytecode: 0x7fe7319d6248&gt;
## &lt;environment: namespace:knitr&gt;</code></pre>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>normal_print</span></code></pre></div>
<pre><code>## function (x, ...)
## if (isS4(x)) methods::show(x) else print(x)
## &lt;bytecode: 0x7fd3511a9eb8&gt;
## &lt;bytecode: 0x7fe731741748&gt;
## &lt;environment: namespace:evaluate&gt;</code></pre>
<p>As we can see, <code>knit_print()</code> has a <code>default</code>
method, which is basically <code>print()</code> or <code>show()</code>,
Expand Down Expand Up @@ -830,7 +833,7 @@ <h3>For package authors</h3>
## {
## structure(x, class = &quot;knit_asis&quot;, knit_meta = meta, knit_cacheable = cacheable)
## }
## &lt;bytecode: 0x7fd350d12b30&gt;
## &lt;bytecode: 0x7fe7352cecd0&gt;
## &lt;environment: namespace:knitr&gt;</code></pre>
<p>Note that you can actually put <strong>knitr</strong> in the
<code>Suggests</code> field in DESCRIPTION, and use
Expand Down
10 changes: 5 additions & 5 deletions inst/doc/knitr-intro.html
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="Yihui Xie" />

<meta name="date" content="2022-03-25" />
<meta name="date" content="2022-04-26" />

<title>Not An Introduction to knitr</title>

Expand Down Expand Up @@ -394,7 +394,7 @@

<h1 class="title toc-ignore">Not An Introduction to knitr</h1>
<h4 class="author">Yihui Xie</h4>
<h4 class="date">2022-03-25</h4>
<h4 class="date">2022-04-26</h4>



Expand All @@ -410,9 +410,9 @@ <h4 class="date">2022-03-25</h4>
non-Sweave vignettes:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">options</span>(<span class="at">digits =</span> <span class="dv">4</span>)</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="fu">rnorm</span>(<span class="dv">20</span>)</span></code></pre></div>
<pre><code>## [1] -0.73974 -1.14359 -0.23914 0.05636 -0.75331 -0.47152 -0.50625 -0.10183
## [9] 0.43507 -1.93467 0.79913 1.85079 -1.70558 0.15422 0.03602 0.33003
## [17] 0.74745 -0.71951 0.95464 0.63750</code></pre>
<pre><code>## [1] -0.432492 -1.934594 0.090109 -0.537050 0.349098 0.156540 -0.202615
## [8] -2.024916 -0.940910 0.602132 0.624322 -0.422067 -0.706236 -1.168691
## [15] -0.481862 0.272402 -0.528331 -0.497320 -0.008859 -1.556787</code></pre>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>fit <span class="ot">=</span> <span class="fu">lm</span>(dist <span class="sc">~</span> speed, <span class="at">data =</span> cars)</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>b <span class="ot">=</span> <span class="fu">coef</span>(fit)</span></code></pre></div>
<table>
Expand Down

0 comments on commit 09052cf

Please sign in to comment.