# install.packages('pak')
::pak('mjfrigaard/shinypak')
paklibrary(shinypak)
App-packages
Expand the callout boxes below to review what we’ve covered in the last four chapters:
We now have two branches of shinyrPkgs
with a functioning app-package:
In the
04_devtools
branch (created in 4.3.3 Install),shinyrPkgs
was converted to a package by manually adding the required fields to theDESCRIPTION
file, then running the keydevtools
development functions (load_all()
,document()
, andinstall()
)In the
03.3_create-package
branch (created in 3.3.2 Converting Shiny projects), we used theusethis::create_package()
function to convertshinyrPkgs
into a package.
The only difference between these two branches lies in the DESCRIPTION
file
Package: shinyrPkgs
Title: Shiny App-Packages
Version: 0.0.0.9000
Author: John Smith [aut, cre]
Maintainer: John Smith <John.Smith@email.io>
Description: An R package with a collection of Shiny applications.
License: GPL-3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
- 1
-
In the
03.3_create-package
branch, theRoxygen: list(markdown = TRUE)
field was added (which we will cover in the upcoming documentation chapter).
App-packages
The following chapters will continue with app-package development, emphasizing developing a Shiny application within a package structure. A preview of each topic covered in the upcoming chapters is provided below.
Documentation (Chapter 5)
5 Documentation covers documenting the code in your app-package with roxygen2
:
- Required tags:
@title
,@description
,@details
,@param
,@return
, and@examples
- App-package tags for modules and standalone app functions:
@seealso
,@family
, and@section
Dependencies (Chapter 6)
6 Dependencies dives into the external (i.e. add-on) functions and packages you’ve used to build your app-package. We’ll also cover how to export functions and objects from your app-packages for others to use.
- Exporting functions from your package namespace
@export
/export()
- Importing functions from add-on packages into your package namespace
NAMESPACE
directives
- The
Imports
field in theDESCRIPTION
Data (Chapter 7)
7 Data covers how to include datasets in your app-package namespace, and the various kinds of data in R packages.
Documenting data with
roxygen2
using@format
,\describe
,\item
Location of data files:
data/
vs.data-raw/
vs.inst/extdata/
Launch (Chapter 8)
The 8 Launch chapter covers how to 1) run your application during development, 2) how to run your app using a standalone app function, and 3) how to deploy your application to shinyapps.io.
- What goes in
app.R
?shinyApp()
vs.shinyAppDir()
vs.runApp()
rsconnect::deployApp()
External files (Chapter 9)
9 External files covers how to include external resources (i.e. the images, CSS, html, or other files that are typically included in the www/
folder and served when you run your Shiny app). This chapter also covers other uses for the isnt/
folder in app-packages.
www/
vs.inst/
Using
addResourcePath()
withsystem.file()