美文网首页learning_R
R markdown笔记05-knitr03

R markdown笔记05-knitr03

作者: ks_c | 来源:发表于2021-02-02 09:17 被阅读0次

@[toc]( <center> knitr翻译03)


title: "Untitled"
author: "ks_c"
date: "2021/2/1"
output: html_document



Code chunk

  1. 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 file test.R as the code for the current chunk.
    NULL;字符)如果提供,它将覆盖当前块中的代码。 这使我们能够以编程方式将代码插入当前块中。 例如,code = readLines('test.R')将使用test.R文件的内容作为当前块的代码。

  2. 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 in names(knitr::knit_engines$get()), e.g., python, sql, julia, bash, and c, etc. The object knitr::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 the engine. This option makes it possible to use alternative executables in your system, e.g., the default python may be at /usr/bin/python, and you may set engine.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.

相关文章

网友评论

    本文标题:R markdown笔记05-knitr03

    本文链接:https://www.haomeiwen.com/subject/fbaltltx.html