Skip to content

Instantly share code, notes, and snippets.

@lcolladotor
Last active October 20, 2020 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lcolladotor/8a7165dbcdba06e09230daf3cb5ebabe to your computer and use it in GitHub Desktop.
Save lcolladotor/8a7165dbcdba06e09230daf3cb5ebabe to your computer and use it in GitHub Desktop.
---
title: "Test seed in Rmd"
author: "Leonardo Collado-Torres"
date: "10/20/2020"
output: html_document
---
_This Rmd file is in response to a question during the [R-Ladies Baltimore 2020-10-20 event](https://www.meetup.com/rladies-baltimore/events/273327907/). The code is available on this [gist](https://gist.github.com/lcolladotor/8a7165dbcdba06e09230daf3cb5ebabe) and the rendered version is available through [RPubs](https://rpubs.com/lcollado/test_seed_rmd)._
Set the seed then print a set of random 10 letters.
```{r "set_the_seed"}
set.seed(20201020)
result <- sample(letters, size = 10)
result
```
Test that it is the expected sequence of 10 letters
```{r "check_results"}
stopifnot(
identical(
result,
c("e", "r", "k", "d", "h", "a", "c", "i", "j", "q")
)
)
```
## Reproducibility information
```{r "reproducibility_info"}
options(width = 120)
sessioninfo::session_info()
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment