有许多方法可以在R中读取.ods包,例如使用gnumeric包.但我找不到任何方法直接编写 .ods文件.有任何想法吗?
(这将特别有用,因为谷歌驱动器电子表格在本地显示为.ods文件,因此这将是一种编辑谷歌电子表格的方法,而无需使用不能脱机工作的RGoogleDocs等解决方案.)
如果你看这个

ggplot(mtcars,aes(x=disp,y=mpg,colour=mpg))+geom_line()
Run Code Online (Sandbox Code Playgroud)
你会看到线条颜色根据相应的y值而变化,这是我想要的,但只是逐段.我希望颜色根据y值连续变化.任何简单的方法?
knitr是否知道YAML数据的值,例如title:或date:或some_custom_field:当它正在编译带有YAML标题的rmarkdown doc时?
我希望能够做到这一点(伪代码)
---
title: my title
---
The title of this document is `r knitrs_yaml_array("title")`
Run Code Online (Sandbox Code Playgroud) 为了方便读者,我想在我的书籍结尾处列出以书写形式书写的简短列表或书籍正文定义索引.即使用自定义块创建的,如下所示:
```{definition, bar, echo=T}
A bar is defined here as a foo-like thing.
```
Run Code Online (Sandbox Code Playgroud)
(我需要定义,但其他人可能会喜欢定理列表等.不知道图表列表是否可以用同样的方式覆盖?)
感谢@yihui,我知道那knitr::all_labels(engine == 'definition')是我的朋友.
所以我可以在本书的最后任何地方做到这一点,通常在最后:
```{r comment="",results="asis",echo=FALSE}
knitr::all_labels(engine == 'definition') %>% unlist %>% paste0("\n\n","\\@ref(def:",.,"): ",.,"\n\n",collapse="\n\n") %>% cat
```
Run Code Online (Sandbox Code Playgroud)
打印这个:
1: bar
2: foobar
Run Code Online (Sandbox Code Playgroud)
可点击的数字.哪个可以.但是,如果在每个标签之后,实际定义也可以打印出来,那不是很好吗?(块中的内容在knitr :: all_labels(engine =='definition')中不可用)
我想知道是否有一种简单的方法来生成一堆带有可变标题的表格或图形knitr.我知道的唯一方法是:(简化自https://github.com/yihui/knitr-examples/blob/master/075-knit-expand.Rnw).但是src在循环之后收集输出然后打印它是一种拖累,因为我想编写一个函数来从任意数据集生成这样的循环.
\documentclass{article}
\title{Using knit\_expand() for templates}
\author{Yihui Xie}
\begin{document}
\maketitle
\tableofcontents
<<lm-mtcars, tidy.opts=list(width.cutoff=55)>>=
# the template
tpl = c("\\subsection{Regression on {{xvar}}}",
"<<lm-{{xvar}}>>=",
"lm(mpg~{{xvar}}, data=mtcars)",
"@")
# expand to knitr source and pass to knit()
src = lapply(names(mtcars)[-1], function(xvar) {knit_expand(text = tpl)})
@
\Sexpr{knit(text = unlist(src))}
\end{document}
Run Code Online (Sandbox Code Playgroud)
所以我想要做的就是这样:
\documentclass{article}
\title{Using knit\_expand() for templates}
\author{Yihui Xie}
\begin{document}
\maketitle
\tableofcontents
<<lm, tidy.opts=list(width.cutoff=55)>>=
myLfFun=function(dataset){
... some function definition which produces say an lm for each variable in dataset …Run Code Online (Sandbox Code Playgroud) Sublime 文本非常好,以至于很多人将它用于实际写作和编码。但是许多实际的作者想要大纲视图功能。
我正在寻找一个 sublime 文本包,它为 markdown 文件提供键盘快捷键,这些文件提供类似于 Microsoft Word 的大纲功能(如果没有别的,它是一个很好的大纲),即:
相关软件包是 SmartMarkdown,它只有一小部分https://github.com/demon386/SmartMarkdown/issues/10和 markdownEditing https://github.com/SublimeText-Markdown/MarkdownEditing/issues/171
真正的大纲迷需要我上面列出的大部分或全部内容。我想为此提供一点赏金,还有其他人感兴趣吗?
我知道使用 fig.scap 应该提供一个用于图表的短标签,但它没有,它使用长标签。有任何想法吗?Rstudio 版本 0.98.1091。
---
output:
pdf_document:
fig_caption: yes
---
\listoffigures
```{r, fig.cap="long caption",fig.scap="short"}
plot(1:4)
```
Run Code Online (Sandbox Code Playgroud) 闪亮的条件面板只是突然出现然后消失。有没有办法让它们滑动或褪色或以其他方式轻轻过渡?
r ×7
knitr ×4
markdown ×2
bookdown ×1
ggplot2 ×1
latex ×1
outline-view ×1
r-markdown ×1
shiny ×1
sublimetext3 ×1