R markdown笔记05-knitr03
@[toc]( <center> knitr翻译03)
title: "Untitled"
author: "ks_c"
date: "2021/2/1"
output: html_document
- Code chunk #代码块
- Child documents #子文件(?)
- Language engines #语言引擎
- Option templates #选项模板
- Extracting source code #提取源码
- Other chunk options # 其他设置
- Package Options # 包的设置
Code chunk
-
code
: (NULL
; character) If provided, it will override the code in the current chunk. This allows us to programmatically insert code into the current chunk. For example,code = readLines('test.R')
will use the content of the filetest.R
as the code for the current chunk.
(NULL
;字符)如果提供,它将覆盖当前块中的代码。 这使我们能够以编程方式将代码插入当前块中。 例如,code = readLines('test.R')将使用test.R文件的内容作为当前块的代码。 -
ref.label
: (NULL
; character) A character vector of labels of the chunks from which the code of the current chunk is inherited (see the demo for chunk references).
(NULL
; character)当前块代码是来自哪个块的标签,字符向量
Child documents
-
child
: (NULL
; character) A character vector of paths of child documents to be knitted and input into the main document.子文件夹输出到哪里的路径
Language engines
-
engine
: ('R'
; character) The language name of the code chunk. Possible values can be found innames(knitr::knit_engines$get())
, e.g.,python
,sql
,julia
,bash
, andc
, etc. The objectknitr::knit_engines
can be used to set up engines for other languages.
当前代码块的语言名称,比如python、sql、julia、c等 -
engine.path
: (NULL
; character) The path to the executable of theengine
. This option makes it possible to use alternative executables in your system, e.g., the defaultpython
may be at/usr/bin/python
, and you may setengine.path = '~/anaconda/bin/python'
to use a different version of Python.
引擎的路径。 此选项使您可以在系统中使用其他可执行文件,例如,默认的python
可能位于/ usr / bin / python中,并且您可以设置
engine.path ='〜/ anaconda / bin / python' 使用其他版本的Python。engine.path
can also be a list of paths, which makes it possible to set different engine paths for different engines, e.g.,也可以同时为不同的引擎设置不同的路径。
knitr::opts_chunk$set(engine.path = list(
python = '~/anaconda/bin/python',
ruby = '/usr/local/bin/ruby'
))
The names of the list correspond to the names of the engines.
Option templates
opts.label: (NULL; character) The label of options set in knitr::opts_template (see ?knitr::opts_template). This option can save some typing effort for sets of frequently used chunk options.
Extracting source code
purl: (TRUE; logical) When running knitr::purl() to extract source code from a source document, whether to include or exclude a certain code chunk.
Other chunk options
R.options: (NULL; list) Local R options for a code chunk. These options are set temporarily via options() before the code chunk, and restored after the chunk.