Skip to content

Commit

Permalink
Don't run code in repro example
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Feb 27, 2014
1 parent e0a1de0 commit 7387d50
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Reproducibility.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ layout: default

# How to write a reproducible example

You are most likely to get good help with your R problem if you provide a reproducible example. A reproducible example allows someone else to recreate your problem by just copying and pasting R code.
You are most likely to get good help with your R problem if you provide a reproducible example. A reproducible example allows someone else to recreate your problem by just copying and pasting R code.

There are four things you need to include to make your example reproducible: required packages, data, code, and a description of your R environment.

Expand All @@ -28,14 +28,14 @@ There are four things you need to include to make your example reproducible: req

* use comments to indicate where your problem lies

* do your best to remove everything that is not related to the problem.
* do your best to remove everything that is not related to the problem.
The shorter your code is, the easier it is to understand.

* Include the output of sessionInfo() as a comment. This summarises your **R
environment** and makes it easy to check if you're using an out-of-date
package.

You can check you have actually made a reproducible example by starting up a fresh R session and pasting your script in.
You can check you have actually made a reproducible example by starting up a fresh R session and pasting your script in.

Before putting all of your code in an email, consider putting it on http://gist.github.com/. It will give your code nice syntax highlighting, and you don't have to worry about anything getting mangled by the email system.

Expand All @@ -50,12 +50,12 @@ dput(BOD)

Then you can use that output to create a reproducible example:

```{r bod}
```{r bod, eval = FALSE}
library(ggplot2)
# Save the data structure in variable BOD
BOD <- structure(list(Time = c(1, 2, 3, 4, 5, 7), demand = c(8.3, 10.3,
19, 16, 15.6, 19.8)), .Names = c("Time", "demand"), row.names = c(NA,
BOD <- structure(list(Time = c(1, 2, 3, 4, 5, 7), demand = c(8.3, 10.3,
19, 16, 15.6, 19.8)), .Names = c("Time", "demand"), row.names = c(NA,
-6L), class = "data.frame", reference = "A1.4, p. 270")
# Some example code that uses the data
Expand Down

0 comments on commit 7387d50

Please sign in to comment.