- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
= set_parent("parent.Rnw") x @ 我可以运行父文档。但是,-6ren">
父文档如下:
<<child = "child1.Rnw">>=
@
<<child = "child2.Rnw">>=
@
child 1:
<<>>=
set_parent("parent.Rnw")
x <- 1
@
child 2:
<<>>=
set_parent("parent.Rnw")
x
@
我可以运行父文档。但是,我无法单独运行 child 2 文档。似乎子文件 2 看不到子文件 1 中定义的变量 x
。如何单独运行 child 2 文档?
最佳答案
set_parent
未按您预期的方式工作。来自 ?set_parent
:
This function extracts the LaTeX preamble of the parent document to use for the child document, so that the child document can be compiled as an individual document.
set_parent("parent.Rnw")
不会编织
整个父文档,它只会提取序言。因此,有了这个 parent.Rnw
文件
\documentclass{article}
\begin{document}
<<child = "child1.Rnw">>=
@
<<child = "child2.Rnw">>=
@
\end{document}
child2.Rnw
不能单独编译,因为 child1.Rnw
在那种情况下不运行。
有效的是以下1:
knit("parent.Rnw")
knit("child2.Rnw")
由于两个文档都是在相同的环境中计算的(参见 knit
的默认 envir
值),来自 parent.Rnw
的对象(和it's child) 可用于后续编织child2.Rnw
。
此外,?set_parent
提供了另一种选择:
When the preamble of the parent document also contains code chunks and inline R code, they will be evaluated as if they were in this child document.
如果可以重新排列 parent.Rnw
使得引用 child1.Rnw
的 block 在序言中
\documentclass{article}
<<child = "child1.Rnw">>=
@
\begin{document}
<<child = "child2.Rnw">>=
@
\end{document}
然后 child2.Rnw
可以被编织而无需事先编织 parent.Rnw
。
1
出于某种原因,
Nevermind . knit2pdf("child2.Rnw")
崩溃
pdflatex.exe
(通过调用
texify.exe
) 在我的系统上。然而,PDF 文件是正确生成的,并且直接在 TEX 文件上运行
pdflatex
不会造成任何问题。
关于r - 使用 knitr 时,我可以在子 Rnw 文档之间交换数据吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34574704/
我在理解这些函数如何更新底层引用、原子等时遇到问题。 文档说:(应用当前身份值参数) (def one (atom 0)) (swap! one inc) ;; => 1 所以我想知道它是如何“扩展到
尝试让一段代码看起来更好。 我在 Clojurescript 中有以下内容: (swap! app-state assoc-in [:lastresults] []) (swap! app-state
我在数据库中有带有排序顺序号的记录。现在我想创建一个带有向上和向下按钮的用户界面来重新排序它们。制作两个 functionsUp(record) 和 functionDown(record) 的最佳算
如何才能让第二次点击时返回?我想我必须以某种方式找到活跃的,但不确定。 $("#test").click(function(){ $("#dsa").fadeOut() $("#asd
我需要有关这次考试的帮助。我需要反转输入字符串。 int main(void) { char str[30]; int strlen; int i=0; int count=0;int
我正在用 C 语言玩指针...我尝试编写一个接收指向值的指针、检索指针的指针并交换指向值的指针的交换,而不是接收指向值的指针和交换值的常规交换。 这是代码... 互换功能: void swap(voi
如何在 javascript 中切换值?例如,如果 x = apple,则函数应返回 x = orange。如果 x = orange,则函数应返回 x = apple。不确定,这里有什么用,切换或交
刚接触这类东西,可能做错了什么,但是- 我有 3 个成员 std::unique_ptr currentWeapon; std::unique_ptr weaponSlotOne; std::uniq
我想在 Map 内的不可变列表内交换项目,示例: const Map = Immutable.fromJS({ name:'lolo', ids:[3,4,5] }); 我正在尝试使用
我创建了动态数组。如果具有某些值,则填充。打印它。但是交换/交换指针后(任务是在特定条件下交换行) 条件取决于sumL。为了不浪费您的时间,我没有描述细节。 问题在于交换指针。 for ( k = 0
要反转整个 vector,存在 std::reverse。但我想将一个 vector “划分”为两部分(恰好在中间)并将两者反转,将它们放回一起并再次反转整个 vector 。例如我们有: 0 1 2
我正在致力于代码最小化和增强。我的问题是:是否可以在不破坏代码逻辑的情况下交换上面的 if 语句? int c1 = Integer.parseInt(args[0]) ; int c
我读过释放 vector 内存的最佳方法是: vector().swap(my_vector); 而且我真的不明白发生了什么。交换函数需要 2 个 vector 并交换它们的元素,例如: vector
我正在尝试编写一个 Haskell 函数,该函数接受一串字母对,并在所有字母组成的字符串中交换该对字母,但我想出的方法感觉很尴尬且不惯用。 我有 swap a b = map (\x-> if x =
我正在尝试使用向上和向下箭头交换两个元素。 JSFiddle 解决方案会很棒! 我的 HTML: Some text down Some ot
当将 subview 与另一个太阳 View 交换时,是否需要重新应用约束?是否需要删除适用于已删除 View 的约束? 或者它们应该自动持续存在? 最佳答案 约束是 View 的“一部分”。当您删除
所以我制作网站已经有一段时间了,但只是真正用于显示和信息的东西。我想尝试一下 AngularJs,所以我遵循了 Codeschool 上的指南。当我根据在线文档意识到我使用的语法不被推荐时,我在该应用
我正在尝试编写一个函数,可以将字符串中的 unicode 字符替换为非 unicode ASCII 字符,问题是上传包含它们的字符串时,unicode 连字符和引号不会被读取。 我希望该函数有一个带有
我目前正在使用 Azure 网站来部署我的应用程序。我目前正在使用两个网站,每个网站监听我的 GIT 的不同分支。如图所示here . 现在,为了让它变得完美,我只是缺少一种在这两个实例之间快速切换的
在我的 javascript 中,有两个包含一些值的 div。 我想交换这些div中的值。 有什么解决办法吗? 最佳答案 var temp = $('#div1').html(); $('#div1'
我是一名优秀的程序员,十分优秀!