flat_template.Rmd for working package

library(testthat)
# Describe your package
fusen::fill_description(
  pkg = here::here(),
  fields = list(
    Title = "Learn how to build A Package From Rmarkdown file",
    Description = "A Set of tools to understand packages structure. Use Rmarkdown First method to build a package from a defined template. 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")

Add one to any value

This is the first tool of our wonderful package. You can add 1 to any value using function add_one().

#' Add one to any value
#' 
#' @param value A numeric value
#'
#' @return Numeric. value + 1
#' @export

add_one <- function(value) {
  result <- value + 1
  return(result)
}
add_one(12)
add_one(56)
test_that("add_one works", {
  expect_equal(add_one(12), 13)
  expect_equal(add_one(56), 57)
})

That's it ! This the end of the documented story of our package. All components are there.

# Execute in the console directly
fusen::inflate(flat_file = "dev/flat_template.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.