Nothing
library(testthat)
# --> for parse tests fusen::fill_description( pkg = here::here(), fields = list( Title = "Build A Package From Rmarkdown file", Description = "Use Rmarkdown First method to build your package. Start your package with documentation. Everything can be set from a Rmarkdown file in your project.", `Authors@R` = c( person("John", "Doe", email = "john@email.me", role = c("aut", "cre"), comment = c(ORCID = "0000-0000-0000-0000")) ) ) ) # Define License with use_*_license() usethis::use_mit_license("John Doe")
# Set error=TRUE for checks() if needed # Run all in the console directly # Create "inst/" directory dir.create(here::here("inst")) # Example dataset file.copy(system.file("nyc_squirrels_sample.csv", package = "fusen"), here::here("inst"))
Here is some inline R code : r 1+1
#' 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")) })
#| filename: the_median_file #' My Other median #' #' @param x Vector of Numeric values #' @inheritParams stats::median #' #' @return #' Median of vector x #' @export #' #' @examples my_other_median <- function(x, na.rm = TRUE) { if (!is.numeric(x)) { stop("x should be numeric") } sub_median(x, na.rm = na.rm) } #' Core of the median not exported #' @param x Vector of Numeric values #' @inheritParams stats::median sub_median <- function(x, na.rm = TRUE) { stats::median(x, na.rm) }
my_other_median(1:12) my_other_median(8:20) my_other_median(20:50)
test_that("my_median works properly and show error if needed", { expect_true(my_other_median(1:12) == 6.5) expect_error(my_other_median("text")) })
not a R chunk that should be kept in vignette, but not in code
#| eval: no # Run but keep eval=FALSE to avoid infinite loop # Execute in the console directly fusen::inflate(flat_file = "dev/dev_history.Rmd")
# duplicate empty name
# duplicate empty name
You're one inflate from paper to box.
Build your package from this very Rmd using fusen::inflate()
"DESCRIPTION"
file has been updated"R/"
directory"tests/testthat/"
directory"vignettes/"
directoryAny scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.