library(testthat)
# Describe your package
fusen::fill_description(
  fields = list(
    Title = "Manage database for GLA project",
    Description = "Create, populate and maintain a sqlite database containing all the data you need to populate a dashboard, run by the autodash package",
    `Authors@R` = c(
      person("Joe", "Heywood", email = "joe.heywood@london.gov.uk", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-1565-9313")),
      person(given = "GLA", role = "cph")
    )
  ), overwrite = TRUE
)
# Define License with use_*_license()
usethis::use_mit_license("Joe Heywood")

Calculate the median of a vector

#' Refresh the metadata 
#'
#'
#' @return
#' Logical - TRUE for worked ok
#' @export
#'
#' @examples
refresh_metadata <- function() {
  TRUE
}
# my_median(1:12)
refresh_metadata()
test_that("refreshing metadata works", {
})

Calculate the mean of a vector

Use sub-functions in the same chunk

#' Add data to database
#'
#' @param dat A data.frame with correct columns and at least one row
#'
#' @return
#' Logical - TRUE for worked ok.
#' @export
#'
#' @examples
insert_db <- function(x, na.rm = TRUE) {
  TRUE
}
dat <- data.frame()
insert_db(dat)
test_that("insert_db works properly and show error if needed", {
})

There can be development actions

These will be included in the dev_history.R file of your package, but won't be direct part of it.

# Run but keep eval=FALSE to avoid infinite loop
# Execute in the console directly
fusen::inflate(rmd = "dev/dev_history.Rmd")

Inflate your package

You're one inflate from paper to box. Build your package from this very Rmarkdown using fusen::inflate()



joeheywood/resdata documentation built on Dec. 21, 2021, 1:17 a.m.