Skip to content

source() script at start of document #3250

Answered by cscheid
baptiste asked this question in Q&A
Discussion options

You must be logged in to vote

It's unlikely that we'll do this because it requires working uniformly across engines. But if your main concern is readability, you can start with an include shortcode:

{{< include preamble.md >}}

and then preamble.md has the r code cell:

```{r setup, echo=FALSE}
library(ggplot2)
phig_ratio <- function(n){
  if(n<=2) { if(n>=0) 1 else 0 } else 1 + 1 / Recall(n-1) 
}
fig_height = 6 * phig_ratio(100)
data = read.csv('mydata.csv')
# ...
```

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@baptiste
Comment options

@mcanouil
Comment options

Answer selected by mcanouil
Comment options

You must be logged in to vote
6 replies
@mcanouil
Comment options

@cderv
Comment options

@allefeld
Comment options

@cderv
Comment options

@allefeld
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment