How to use fusen

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(fusen)

How to use {fusen}

Create multiple "dev_history_xxx.Rmd" files with fusen::add_dev_history() if needed

Limitations

Add a new dev_history.Rmd template in "dev" directory

# Create a new project
tmpdir <- tempdir()
dummypackage <- file.path(tmpdir, "dummypackage")
dir.create(dummypackage)

# Add
add_dev_history(pkg = dummypackage)

# Delete dummy package
unlink(dummypackage, recursive = TRUE)

Fill your package Description

# Create a new project
tmpdir <- tempdir()
dummypackage <- file.path(tmpdir, "dummypackage")
dir.create(dummypackage)

fill_description(
  pkg = dummypackage,
  fields = list(
    Title = "Build A Package From Rmarkdown file",
    Description = paste("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("Sebastien", "Rochette", email = "sebastien@thinkr.fr", 
             role = c("aut", "cre"), comment = c(ORCID = "0000-0002-1565-9313")),
      person(given = "ThinkR", role = "cph")
    )
  )
)

# Delete dummy package
unlink(dummypackage, recursive = TRUE)

There can be development actions

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

Name the following chunk with {r development-1, eval=FALSE}

# Run but keep eval=FALSE to avoid infinite loop

usethis::use_mit_license("S├ębastien Rochette")

# Execute in the console directly

fusen::inflate(rmd = "dev/dev_history.Rmd")

Inflate your package from dev Rmd template

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

After that, you can:

# Create a new project
tmpdir <- tempdir()
dummypackage <- file.path(tmpdir, "dummypackage")
dir.create(dummypackage)

# {fusen} steps
fill_description(pkg = dummypackage, fields = list(Title = "Dummy Package"))
dev_file <- add_dev_history(pkg = dummypackage, overwrite = TRUE)
inflate(pkg = dummypackage, rmd = dev_file, name = "Exploration of my Data", check = FALSE)

# Explore directory of the package
# browseURL(dummypackage)

# Try pkgdown build
# pkgdown::build_site(dummypackage)
# usethis::use_build_ignore("docs")
# usethis::use_git_ignore("docs")
# Delete dummy package
unlink(dummypackage, recursive = TRUE)


Try the fusen package in your browser

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

fusen documentation built on Aug. 4, 2021, 5:07 p.m.