The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
{fusen} inflates a Rmarkdown file to magically create a package.
If you know how to create a Rmarkdown file, then you know how to build a package.
Fill the flat Rmd (or qmd) template with everything in one place and {fusen} will inflate the identified parts in the correct package files and directories.
The {fusen} Rmarkdown template encourages users to fill their documentation and tests at the same time of writing their functions code. Thanks to the R package structure used by {fusen}, you can build a robust workflow or R package. {fusen} simplifies and reduces the number of steps towards a full R package.
After that, your {pkgdown} documentation website is one command away to be shared with all your users.
This {fusen} package is a real-world example of {fusen} use as it is itself created from the flat templates available in "dev/"
folder in its GitHub repository. You can have a look at its architecture in the Readme of the “dev” directory.
You can install the released CRAN version:
Full documentation for the CRAN version is here: https://thinkr-open.github.io/fusen/
You can install the development version of {fusen} from r-universe or GitHub:
# From r-universe.dev (No need for GITHUB_PAT)
install.packages("fusen", repos = c("https://thinkr-open.r-universe.dev", "https://cloud.r-project.org"))
# Or with {pak} using GitHub API - Need for GITHUB_PAT
# install.packages("pak")
pak::pak("ThinkR-open/fusen")
Full documentation for the development version is here: https://thinkr-open.github.io/fusen/dev/
{fusen} is all about correctly separating and naming chunks.
teaching
the first time to see how {fusen} works,full
the second time to answer most of your questionscreate_fusen("path/to/new/project", template = "teaching")
description
asking to describe your package and license it
That’s it! You built a package! A documented and tested package!
You even have a website for it!
Let’s test it now:
As I said earlier, this is all about using the correct split and name for your chunks.
"dev/flat_template.Rmd"
template to write your documentation and build your functions and test your examples.
function
gets the code of a functionexample
gets the code for examples of using the function. This will be used for function @examples
and will be kept for the vignette.
example-myfunction
, example-myotherfunction
, …tests
gets the code for unit testingdevelopment
gets the code for development purposes, usually only used once like {usethis} functionsNote that the "flat*.Rmd"
files created with templates full
and teaching
are indeed working examples that can directly be inflated.
You can also have a look at {squirrels.fusen} that has been built to present the method. Follow the commits: https://github.com/statnmap/squirrels.fusen/commits/main
There is a dedicated vignette to answer this: https://thinkr-open.github.io/fusen/articles/Maintain-packages-with-fusen.html
fusen::inflate_all()
fusen::deprecate_flat_file()
and develop in the package files directly, as for any other R package. ‘fusen’ has no impact on the structure of a classical package once inflated.Advice: Use git as soon as possible, this will avoid losing your work if you made some modifications in the wrong place
Advice: Show the package structure with
fusen::draw_package_structure()
in a “dev/Readme.md” file to help developers
If you mind about documentation for your users and tests for your maintainers, {fusen} is for you. Start writing documentation and tests while you conceive your functionalities, so that there are directly available for your users and maintainers.
Indeed, when you write a Rmarkdown file (or a vignette), you create a documentation for your analysis (or package). When you write some functions, you check your functions with examples and you maybe write some unit tests to verify the outputs. This is even more true if you follow this guide : ‘Rmd first’: When development starts with documentation Write them all in the same file while you explore the possibilities and let {fusen} store them in the right place for you!
{fusen} was first addressed to people who never wrote a package before and know how to write a Rmarkdown file. Understanding package infrastructure and correctly settling it can be frightening. This package may help them do the first step!
{fusen} is also addressed to more advanced developers who care about their users and the sustainability of their products, and are fed up with switching between R files, tests files, vignettes while they prototype their functions. In particular, when changing arguments of a function, we need to change examples, unit tests in multiple places. Here, you can do it in one place. No risk to forget one. Think also about code review: everything related to one function is at the same place.
inflate()
?=> See vignette Tips and Tricks: https://thinkr-open.github.io/fusen/articles/tips-and-tricks.html
A fusen is an origami. It is a flat piece of paper that you fold in a specific way so that at the end, you can magically inflate it to let a nice box appear.
Similarly, the {fusen} package uses a flat Rmd template, that you fill in a specific way so that at the end, you can magically inflate()
it to let a nice package appear.
Click here to fold your {fusen}…
‘fusen’ is partially built using ‘fusen’ itself.
If you’re not sure on how to contribute using ‘fusen’, you can contribute as for any other package: a package made with the help of ‘fusen’ does have exactly the same structure as a classical package.
Knowing that, if you want to contribute to ‘fusen’, you can follow the instructions in the CONTRIBUTING.md file.
Please note that the {fusen} project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.