dev_history.Rmd empty

library(testthat)

Calculate the median of a vector

#' 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)
}
my_median(1:12)
test_that("my_median works properly and show error if needed", {
  expect_error(my_median("text"))
})

One title no function one example alone

# Go in vignette but does not fail ?
1+1
test_that("my_median2 works properly and show error if needed", {
  expect_error(my_median("text"))
})
# Run but keep eval=FALSE to avoid infinite loop
# Execute in the console directly
fusen::inflate(flat_file = "dev/dev_history.Rmd")


Try the fusen package in your browser

Any scripts or data that you put into this service are public.

fusen documentation built on Aug. 17, 2023, 5:09 p.m.