---
title: "dev_history.Rmd empty"
output: html_document
editor_options: 
  chunk_output_type: console
---

```{r development, include=FALSE}
library(testthat)
```

# Calculate the median of a vector

```{r function-my_median}
#' My median
#'
#' @param x Vector of Numeric values
#' @inheritParams stats::median
#'
#' @return
#' Median of vector x
#' @export
#'
#' @examples
#' my_median(2:20)
my_median <- function(x, na.rm = TRUE) {
  if (!is.numeric(x)) {stop("x should be numeric")}
  stats::median(x, na.rm = na.rm)
}
```

```{r examples-my_median}
my_median(1:12)
```

```{r tests-my_median}
test_that("my_median works properly and show error if needed", {
  expect_error(my_median("text"))
})
```

## One title no function one example alone

```{r examples-2}
# Go in vignette but does not fail ?
1+1
```


```{r tests-2, filename = "the_test.R"}
test_that("my_median2 works properly and show error if needed", {
  expect_error(my_median("text"))
})
```


```{r development-1, eval=FALSE}
# Run but keep eval=FALSE to avoid infinite loop
# Execute in the console directly
fusen::inflate(flat_file = "dev/dev_history.Rmd")
```
