This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\begin{document} | |
<<setup, include=FALSE>>= | |
knitr::opts_chunk$set(echo = TRUE, max.print = NA) | |
@ | |
<<echo=FALSE, results='hide'>>= | |
library(DBI) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can set default chunk options *outside* the document just like you do it *inside*: | |
knitr::opts_chunk$set("foobar" = "baz") # set "foobar" = "baz" as default chunk option | |
Full example: | |
# `control.R` | |
library(rmarkdown) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r} | |
# Idea based on http://r.789695.n4.nabble.com/Modify-base-R-functions-in-Rprofile-site-td905121.html | |
interactiveOld <- base::interactive | |
unlockBinding("interactive", as.environment("package:base")) | |
assignInNamespace("interactive", function() { TRUE }, ns = "base") | |
library(data.table) | |
assignInNamespace("interactive", interactiveOld, ns = "base") | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Toggle Chuck Output Using details Tag" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
library(knitr) | |
knit_hooks$set(showDetails = function(before, options, envir) { | |
if (before) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[]{article} | |
\usepackage{hyperref} | |
\setcounter{secnumdepth}{0} | |
\usepackage{lipsum} | |
\usepackage[sf,bf]{titlesec} | |
\begin{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "MWD" | |
output: bookdown::word_document2 | |
--- | |
\@ref(fig:fig1) \@ref(fig:fig2) | |
```{r fig1, fig.cap="Figure Main"} | |
plot(1) | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Test" | |
output: | |
html_document: | |
self_contained: false | |
--- | |
```{r} | |
knitr::opts_knit$set(eval.after = "fig.link") | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
output: pdf_document | |
--- | |
```{r,fig.align='center', echo=FALSE, results='asis'} | |
library(ggplot2) | |
for (i in 1:3) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dat <- cars # example | |
myfile <- tempfile(fileext = ".Rmd") | |
cat("--- | |
output: pdf_document | |
params: | |
dat: NA | |
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{scrartcl} | |
\usepackage{hyperref} | |
\usepackage{cleveref} | |
\begin{filecontents}{doc1_body-Star.tex} | |
\section{About Foo} \label{sec:foo} | |
\ref*{sec:foo} | |
\end{filecontents} | |
\begin{filecontents}{doc2_body-Star.tex} |
OlderNewer