Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guidelines on how much code to include in the post? #63

Open
kevinykuo opened this issue Dec 17, 2018 · 3 comments
Open

Guidelines on how much code to include in the post? #63

kevinykuo opened this issue Dec 17, 2018 · 3 comments
Labels

Comments

@kevinykuo
Copy link
Contributor

One way to do this is to point readers to files in analysis/ that they can execute sequentially, and include just a few snippets in the blog post itself so we don't cover most of it with code.

@TylerGrantSmith
Copy link
Contributor

What is the downside of including the code, but keeping it folded by default?

@kevinykuo
Copy link
Contributor Author

Yeah I think we can do that. Maybe also have an 'expand/collapse all code' button up top. The main drawback is that any changes we make to the executable code we also have to modify it in the post, but this seems standard in education.

@TylerGrantSmith
Copy link
Contributor

Wouldn't necessarily need to do the double-duty if you add knitr chunk comments to the analysis code.
in analysis/map.R

## @knitr plot-brazil
brazil %>%
  leaflet(options = leafletOptions(minZoom = 4)) %>%
  addTiles() %>%
  addPolygons(
    data = bra_cutout,
    weight  = 0,
    opacity = 1,
    color = "white",
    fillOpacity = 1
  ) %>%
...

in manuscript/article.Rmd

## Exposures by state

```{r}
knitr::read_chunk('analysis/map.R')
```
```{r plot-brazil, eval = FALSE, echo = TRUE}
```
```{r plot-brazil, layout = "l-body-outset", fig.height = 6}
```

image

Once code folding is in place, that would be an easy way to keep the article in tune with the analysis code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants