RweaveLatex(utils)
RweaveLatex()所属R语言包:utils
R/LaTeX Driver for Sweave
Sweave的R / LaTeX的驱动程序
译者:生物统计家园网 机器人LoveR
描述----------Description----------
A driver for Sweave that translates R code chunks in LaTeX files.
一个Sweave,R代码块转换LaTeX文件的驱动器。
用法----------Usage----------
RweaveLatex()
RweaveLatexSetup(file, syntax, output = NULL, quiet = FALSE,
debug = FALSE, stylepath, ...)
参数----------Arguments----------
参数:file
Name of Sweave source file. See the description of the corresponding argument of Sweave.
的Sweave源文件的名称。看到Sweave相应的参数描述。
参数:syntax
An object of class SweaveSyntax.
对象类SweaveSyntax。
参数:output
Name of output file. The default is to remove extension ".nw", ".Rnw" or ".Snw" and to add extension ".tex". Any directory paths in file are also removed such that the output is created in the current working directory.
输出文件的名称。默认是删除扩展名为.nw,.Rnw或.Snw扩展.tex。在任何目录路径file也删除,在当前工作目录中创建输出。
参数:quiet
If TRUE all progress messages are suppressed.
如果被压抑TRUE所有的进度消息。
参数:debug
If TRUE, input and output of all code chunks is copied to the console.
如果TRUE,输入和输出所有代码块被复制到控制台。
参数:stylepath
See "Details".
见“详细资料”。
参数:...
named values for the options listed in "Supported Options".
一个名为“支持的选项”中列出的选项的值。
Details
详情----------Details----------
The LaTeX file generated needs to contain the line \usepackage{Sweave}, and if this is not present in the Sweave source file (possibly in a comment), it is inserted by the RweaveLatex driver. If stylepath = TRUE, a hard-coded path to the file "Sweave.sty" in the R installation is set in place of Sweave. The hard-coded path makes the LaTeX file less portable, but avoids the problem of installing the current version of "Sweave.sty" to some place in your TeX input path. However, TeX may not be able to process the hard-coded path if it contains spaces (as it often will under Windows) or TeX special characters.
生成的LaTeX文件需要包含行\usepackage{Sweave},如果这是不存在的的Sweave源文件(可能在评论),它是由RweaveLatex驱动程序插入。如果stylepath = TRUE,一个硬编码的路径文件“Sweave.styR安装在Sweave的地方设置。硬编码的路径,使LaTeX文件的移植性较差,但避免了安装当前版本的问题Sweave.sty一些地方在你的TeX输入路径。然而,TEX可能无法处理的硬编码的路径,如果它包含空格(因为它常常在Windows下)或TeX特殊字符。
The default for stylepath is now taken from the environment variable SWEAVE_STYLEPATH_DEFAULT, or is FALSE it that is unset or empty. If set, it should be exactly TRUE or FALSE: any other values are taken as FALSE.
stylepath默认正在考虑从环境变量SWEAVE_STYLEPATH_DEFAULT或FALSE它是没有设置或者为空。如果设置,它应该是完全TRUE或FALSE:任何其他值FALSE的。
As from R 2.12.0, the simplest way for frequent Sweave users to ensure that "Sweave.sty" is in the TeX input path is to add "<VAR>R_HOME</VAR>/share/texmf" as a "texmf tree" ("root directory" in the parlance of the "MiKTeX settings" utility).
从R 2.12.0,频繁Sweave用户最简单的方法,以确保Sweave.sty是在TeX输入的路径是添加<VAR>R_HOME</VAR>/share/texmf为texmf目录树 (“根目录”中的“MiKTeX设置”实用的说法)。
By default, "Sweave.sty" sets the width of all included graphics to:<br> \setkeys{Gin}{width=0.8\textwidth}.
默认情况下,Sweave.sty包含的所有图形的宽度设置:参考\setkeys{Gin}{width=0.8\textwidth}。
This setting affects the width size option passed to the \includegraphics{} directive for each plot file and in turn impacts the scaling of your plot files as they will appear in your final document.
此设置影响宽度尺寸\includegraphics{}指令传递给每个绘图文件的选项,从而影响您的图形文件的缩放,因为它们将出现在你的最后文件。
Thus, for example, you may set width=3 in your figure chunk and the generated graphics files will be set to 3 inches in width. However, the width of your graphic in your final document will be set to 0.8\textwidth and the height dimension will be scaled accordingly. Fonts and symbols will be similarly scaled in the final document.
因此,例如,你可以设置width=3在你的数字块和生成的图形文件将被设置为3英寸宽。然而,你的最后文件中的图形宽度将设置为0.8\textwidth和高度尺寸将相应地调整。在最后文件中,将同样的缩放字体和符号。
You can adjust the default value by including the \setkeys{Gin}{width=...} directive in your ".Rnw" file after the \begin{document} directive and changing the width option value as you prefer, using standard LaTeX measurement values.
您可以调整默认值,包括\setkeys{Gin}{width=...}在你的.Rnw\begin{document}指令和改变width选项的值,你喜欢的文件后指令使用标准乳胶测量值。
If you wish to override this default behavior entirely, you can add a \usepackage[nogin]{Sweave} directive in your preamble. In this case, no size/scaling options will be passed to the \includegraphics{} directive and the height and width options will determine both the runtime generated graphic file sizes and the size of the graphics in your final document.
如果你想完全覆盖此默认行为,您可以添加\usepackage[nogin]{Sweave}指令,在你的序言。在这种情况下,没有大小/缩放选项将被传递给\includegraphics{}指令height和width选项将决定同时运行时生成的图形文件大小和图形的大小你的最后文件。
"Sweave.sty" also supports the [noae] option, which suppresses the use of the ae package, the use of which may interfere with certain encoding and typeface selections. If you have problems in the rendering of certain character sets, try this option.
Sweave.sty还支持[noae]选项,禁止使用ae包,其中可能会干扰某些编码和字体选择。如果您有在渲染某些字符集的问题,尝试此选项。
The use of fancy quotes (see sQuote) can cause problems when setting R output. Either set options(useFancyQuotes = FALSE) or arrange that LaTeX is aware of the encoding used (by a \usepackage[utf8]{inputenc} declaration: Windows users of Sweave from Rgui.exe will need to replace utf8 by cp1252 or similar) and ensure that typewriter fonts containing directional quotes are used.
使用花哨的报价(见sQuote)R输出设置时,可能会导致问题。要么设置options(useFancyQuotes = FALSE)或安排,LaTeX是知道\usepackage[utf8]{inputenc}声明(编码:SweaveRgui.exe需要更换utf8的Windows用户cp1252或类似),确保用打字机字体,含定向报价。
Some LaTeX graphics drivers do not include .png or .jpg in the list of known extensions. To enable them, add something like \DeclareGraphicsExtensions{.png,.pdf,.jpg} to the preamble of your document or check the behavior of your graphics driver. When both pdf and png are TRUE both files will be produced by Sweave, and their order in the DeclareGraphicsExtensions list determines which will be used by pdflatex.
有些LaTeX的图形驱动程序不包括.png或已知扩展名列表.jpg。为了使他们像\DeclareGraphicsExtensions{.png,.pdf,.jpg}的东西,添加到您的文档的序言或检查你的显卡驱动程序的行为。当两个pdf和png是TRUE这两个文件将Sweave,他们的订单生产的DeclareGraphicsExtensions名单确定将使用pdflatex。
支持的选项----------Supported Options----------
RweaveLatex supports the following options for code chunks (the values in parentheses show the default values). Character string values should be quoted when passed from Sweave through ... but not when use in the header of a code chunk.
RweaveLatex支持下面的选项代码块(括号中的值显示默认值)。传递字符串值应援引Sweave...但不使用时,在一个代码块的头“。”
engine: character string ("R"). Only chunks with
发动机:字符串("R")。与只有大块
echo: logical (TRUE). Include R code in the output
回声:逻辑(TRUE)。在输出中包括R代码
keep.source: logical (TRUE). When echoing, if keep.source == TRUE the original source is copied to the
keep.source:逻辑(TRUE)。回荡的时候,如果keep.source == TRUE被复制到原始的源
eval: logical (TRUE). If FALSE, the code chunk is not evaluated, and hence no text nor graphical output
EVAL:逻辑(TRUE)。如果FALSE,不计算代码块,因此没有文字,也没有图形输出
results: character string ("verbatim"). If "verbatim", the output of R commands is included in the verbatim-like Soutput environment. If "tex", the output is taken to be already proper LaTeX markup and included as is. If "hide" then all output is completely suppressed
结果:字符串("verbatim")。 "verbatim"如果,R命令的输出被列入逐字像Soutput环境。如果"tex",输出已经适当的LaTeX的标记,其中包括像。如果"hide"然后所有的输出被完全抑制
print: logical (FALSE). If TRUE, this forces
打印:逻辑(FALSE)。如果TRUE,这股势力
term: logical (TRUE). If TRUE, visibility of values emulates an interactive R session: values of assignments are not printed, values of single objects are printed. If FALSE, output comes only from explicit print
长期:逻辑(TRUE)。如果TRUE,能见度值模拟互动R会话分配值不打印,打印单个对象的值。如果FALSE,输出只来自于明确的print
split: logical (FALSE). If TRUE, text output
逻辑分割:(FALSE)。如果TRUE,文本输出
strip.white: character string ("true"). If "true", blank lines at the beginning and end of output are removed. If "all", then all blank lines are removed from the output. If "false" then blank lines are retained.
strip.white:字符串("true")。如果"true",在输出的开头和结尾的空白行被删除。如果"all",那么所有的空行从输出中删除。如果"false"然后空白行被保留。
A "blank line" is one that is empty or includes only whitespace (spaces and tabs).
一个“空白行”是一个是空的或包含空白(空格和制表符)。
Note that blank lines in a code chunk will usually produce a prompt string rather than a blank line on output.
请注意,通常会产生一个代码块中的空白行,而不是空白行上输出提示字符串。
prefix: logical (TRUE). If TRUE generated filenames of figures and output all have the common prefix given by the prefix.string option: otherwise only unlabelled
前缀:逻辑(TRUE)。如果TRUE生成所有有共同的前缀prefix.string选项给出的数字和输出的文件名,否则只有未标记
prefix.string: a character string, default is the name of the source file (without extension). Note that this is used as part
prefix.string:一个字符串,默认为源文件的名称(不含扩展名)。请注意,这是一部分
include: logical (TRUE), indicating whether input statements for text output (if split = TRUE) and \includegraphics statements for figures should be auto-generated. Use include = FALSE if the output should appear in a different place than the code chunk (by placing the
包括:逻辑(TRUE),指示是否应该自动生成的文本输出输入语句(如果split = TRUE)\includegraphics报表数字。使用include = FALSE如果输出应该会出现在不同的地方比的代码块(放置
fig: logical (FALSE), indicating whether the code chunk produces graphical output. Note that only one figure per code chunk can be processed this way. The labels for figure chunks are used as part of the file names, so should preferably be
逻辑图:(FALSE),显示的代码块是否产生图形输出。请注意,只有每一个数字代码块可以以这种方式处理。数字块的标签被用作文件名的一部分,所以最好是
eps: logical (FALSE), indicating whether EPS figures
EPS:逻辑(FALSE),每股盈利数字指示是否
pdf: logical (TRUE), indicating whether PDF figures
PDF:逻辑(TRUE),说明无论是PDF格式的数字
pdf.version, pdf.encoding, pdf.compress: passed to pdf to set the version, encoding and compression (or
pdf.version,pdf.encoding的,pdf.compress:通过pdf设置的版本,编码和压缩(或
png: logical (FALSE), indicating whether PNG figures should be generated. Ignored if fig = FALSE. Only
PNG:逻辑(FALSE),指示是否应生成的PNG数字。如果fig = FALSE忽略。只
jpeg: logical (FALSE), indicating whether JPEG figures should be generated. Ignored if fig = FALSE. Only
JPEG:逻辑(FALSE),指示是否应生成的JPEG数字。如果fig = FALSE忽略。只
grdevice: character (NULL): see section "Custom Graphics Devices". Ignored if fig = FALSE. Only
grdevice:字符(NULL):参见节“自定义图形设备。如果fig = FALSE忽略。只
width: numeric (6), width of figures in inches. See
宽度:数字(6),宽度英寸的数字。见
height: numeric (6), height of figures in inches. See
身高:数字(6)英寸数字高度。见
resolution: numeric (300), resolution in pixels per inch: used for PNG and JPEG graphics. Note that the default is a fairly
决议:数字(300),每英寸的像素分辨率:PNG和JPEG图形。请注意,默认的是一个相当
concordance: logical (FALSE). Write a concordance file to link the input line numbers to the output line numbers. This is an experimental feature; see the source code for the
逻辑一致性:(FALSE)。写一致性的文件链接输入输出行号行号。这是一个实验性的功能;看到的源代码
figs.only: logical (FALSE). By default each figure chunk is run once, then re-run for each selected type of graphics. That will open a default graphics device for the first figure chunk and use that device for the first evaluation of all subsequent chunks. If this option is true, the figure chunk is run only for each selected type of graphics, for
figs.only:逻辑(FALSE)。默认情况下,每个数字块被执行一次,然后重新运行为每个选定的图形类型。第一个数字块,将打开一个默认的图形设备和使用该设备的所有后续块的第一次评估。如果此选项是真实的,只有运行图块为每个选定的图形类型,
In addition, users can specify further options, either in the header of an individual code section or in a \SweaveOpts{} line in the document. Prior to R 2.14.0 unknown options were taken as logical: now their type is set at first use.
此外,用户可以指定更多的选项,无论是在一个单独的代码部分的页眉或\SweaveOpts{}文件中的线。之前的R 2.14.0未知的选项被作为逻辑:现在他们的类型是在第一次使用设置。
自定义图形设备----------Custom Graphics Devices----------
If option grdevice is supplied for a code chunk with both fig and eval true, the following call is made
如果选项“grdevice都fig和eval真实的,下面的调用是提供一个代码块
钩子函数----------Hook Functions----------
Before each code chunk is evaluated, zero or more hook functions can be executed. If getOption("SweaveHooks") is set, it is taken to be a named list of hook functions. For each logical option of a code chunk (echo, print, ...) a hook can be specified, which is executed if and only if the respective option is TRUE. Hooks must be named elements of the list returned by getOption("SweaveHooks") and be functions taking no arguments. E.g., if option "SweaveHooks" is defined as list(fig = foo), and foo is a function, then it would be executed before the code in each figure chunk. This is especially useful to set defaults for the graphical parameters in a series of figure chunks.
每个代码块前进行评估,零个或多个钩子函数可以被执行。如果getOption("SweaveHooks")设置,它是一个钩子函数的命名列表。为每一个代码块的逻辑选项(echo,print,...),可以指定一个钩子,当且仅当被执行各自的选项是TRUE。挂钩getOption("SweaveHooks")和功能没有参数,返回列表中的元素,必须命名为。例如,如果选项“"SweaveHooks"list(fig = foo),foo是一个功能定义,那么它会在每个数字块中的代码之前执行。一系列数字块的图形参数设置默认值,这是特别有用。
Note that the user is free to define new Sweave logical options and associate arbitrary hooks with them. E.g., one could define a hook function for a new option called clean that removes all objects in the workspace. Then all code chunks specified with clean = TRUE would start operating on an empty workspace.
请注意,用户可以自由定义与他们的新的Sweave逻辑选项和准任意挂钩。例如,一个称为clean删除工作区中的所有对象的一个新的选项可以定义一个钩子函数。然后所有的代码块以clean = TRUE指定一个空的工作区开始运作。
作者(S)----------Author(s)----------
Friedrich Leisch and R-core
参见----------See Also----------
"Sweave User Manual", a vignette in the utils package.
“Sweave用户手册”,utils包中的小插曲。
Sweave, Rtangle
Sweave,Rtangle
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|