-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpkg-creation-process.qmd
115 lines (78 loc) · 2.46 KB
/
pkg-creation-process.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
title: "Package creation process"
format: html
editor: visual
execute:
eval: false
---
## Initiate package creation
```{r}
## Create package in current RR project directory
usethis::create_package(getwd())
## Add pkgdown skeleton
usethis::use_pkgdown()
```
## Add license
```{r}
usethis::use_mit_license(copyright_holder = "Gael Sola, Lauri Vesa, Javier Garcia Perez")
```
## Add skeleton
The skeleton includes scripts for shiny modules and translation out of the box i the following directories:
- home folder:
- *app.R*: contains code to launch the app on shinyapps.io
- R:
- functions scripts (file name = function name)
- shiny modules scripts (file names like *mod\_\*UI.R* and *mod\_\*\_server.R)*
- *helpers.R*: functions useful for the package development but not exported.
- zzz.R function to make the asset directory from each user package libriary available to the shiny app
- inst/assets:
- images, translation and other files useful for the app.
## Add packages dependencies to DESCRIPTION
```{r}
## Data analysis
#usethis::use_package("magrittr")
usethis::use_package("readr")
usethis::use_package("tidyselect")
usethis::use_package("dplyr")
usethis::use_package("ggplot2")
#usethis::use_package("tibble")
#usethis::use_package("forcats")
usethis::use_package("purrr")
usethis::use_package("stringr")
usethis::use_package("rlang")
# usethis::use_package("tidyverse", type = "depends")
usethis::use_package("readxl")
## Shiny
usethis::use_package("shiny")
usethis::use_package("shinyjs")
usethis::use_package("shinyWidgets")
usethis::use_package("bslib")
## Geospatial
# usethis::use_package("sf")
# usethis::use_package("terra")
# usethis::use_package("units")
```
## Document, load and test
```{r}
devtools::document()
devtools::load_all()
shiny_run_speval()
## and / or
devtools::install()
library(speval)
speval::shiny_run_speval()
```
------------------------------------------------------------------------
## Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
## Running Code
When you click the **Render** button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
```{r}
1 + 1
```
You can add options to executable code like this
```{r}
#| echo: false
2 * 2
```
The `echo: false` option disables the printing of code (only output is displayed).