|
1 | | -# r-pkg |
2 | 1 |
|
3 | | -This repository houses a devcontainer that setups an R package development environment. The container is setup to work with [GitHub Codespaces](https://github.com/features/codespaces) to instantly have a cloud-based developer workflow. |
| 2 | +<!-- README.md is generated from README.Rmd. Please edit that file --> |
4 | 3 |
|
5 | | -You can try out the Codespace by clicking on the following button: |
| 4 | +# shinydocker |
6 | 5 |
|
7 | | -[](https://codespaces.new/coatless-devcontainer/r-pkg?quickstart=1) |
| 6 | +<!-- badges: start --> |
8 | 7 |
|
9 | | -> [!NOTE] |
10 | | -> |
11 | | -> Codespaces are available to Students and Teachers for free [up to 180 core hours per month](https://docs.github.com/en/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/using-github-codespaces-with-github-classroom#about-github-codespaces) |
12 | | -> through [GitHub Education](https://education.github.com/). Otherwise, you will have |
13 | | -> [up to 60 core hours and 15 GB free per month](https://github.com/features/codespaces#pricing). |
| 8 | +<!-- badges: end --> |
14 | 9 |
|
15 | | -Or, you can press the template button to create a new repository with the same setup so that you |
16 | | -can work locally on the devcontainer: |
| 10 | +The goal of shinydocker is to … |
17 | 11 |
|
18 | | -[](https://github.com/coatless-devcontainer/r-pkg/generate) |
| 12 | +## Installation |
19 | 13 |
|
20 | | -This will create a fork of the repository that can be worked on inside a local copy of |
21 | | -[Visual Studio Code](https://code.visualstudio.com/) through the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). With the extension installed, you can open the repository in a container by pressing `F1` (to bring up command palette) and typing `Dev Container: Reopen in Container`. |
| 14 | +You can install the development version of shinydocker from |
| 15 | +[GitHub](https://github.com/) with: |
22 | 16 |
|
23 | | -Lastly, you can directly obtain the underlying container image by typing in Terminal: |
24 | | - |
25 | | -```sh |
26 | | -docker pull ghcr.io/coatless-devcontainer/r-pkg:latest |
| 17 | +``` r |
| 18 | +# install.packages("pak") |
| 19 | +pak::pak("coatless-rpkg/shinydocker") |
27 | 20 | ``` |
28 | 21 |
|
29 | | -## Quick start |
| 22 | +## Example |
30 | 23 |
|
31 | | -Run the following series of commands inside of R once the container opens. Make sure to change `"name-of-package"` to your current package name. |
| 24 | +This is a basic example which shows you how to solve a common problem: |
32 | 25 |
|
33 | | -```r |
34 | | -usethis::create_package("name-of-package") |
35 | | -usethis::use_package_doc() |
36 | | -usethis::use_agpl3_license() |
37 | | -usethis::use_testthat() |
38 | | -usethis::use_github_action("check-standard") |
39 | | -usethis::use_pkgdown_github_pages() |
| 26 | +``` r |
| 27 | +library(shinydocker) |
| 28 | +## basic example code |
40 | 29 | ``` |
41 | 30 |
|
42 | | -## Resources |
43 | | - |
44 | | -- [Manual: Writing R extensions](https://cran.r-project.org/doc/manuals/r-release/R-exts.html) |
45 | | -- [Textbook: R Packages](https://r-pkgs.org/) |
46 | | -- [usethis](https://usethis.r-lib.org/) |
47 | | -- [devtools](https://devtools.r-lib.org/) |
| 31 | +What is special about using `README.Rmd` instead of just `README.md`? |
| 32 | +You can include R chunks like so: |
| 33 | + |
| 34 | +``` r |
| 35 | +summary(cars) |
| 36 | +#> speed dist |
| 37 | +#> Min. : 4.0 Min. : 2.00 |
| 38 | +#> 1st Qu.:12.0 1st Qu.: 26.00 |
| 39 | +#> Median :15.0 Median : 36.00 |
| 40 | +#> Mean :15.4 Mean : 42.98 |
| 41 | +#> 3rd Qu.:19.0 3rd Qu.: 56.00 |
| 42 | +#> Max. :25.0 Max. :120.00 |
| 43 | +``` |
48 | 44 |
|
49 | | -## Developer notes |
| 45 | +You’ll still need to render `README.Rmd` regularly, to keep `README.md` |
| 46 | +up-to-date. `devtools::build_readme()` is handy for this. |
50 | 47 |
|
51 | | -This repository uses a pre-built container strategy to have GitHub Actions build and, then, store the devcontainer in [GitHub's Container Repository](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry). |
| 48 | +You can also embed plots, for example: |
52 | 49 |
|
53 | | -We place the main logic of the devcontainer in [`.github/.devcontainer/devcontainer.json`](https://github.com/coatless-devcontainer/r-pkg/blob/main/.github/.devcontainer/devcontainer.json). From there, we use [`.github/workflows/pre-build-devcontainer.yml`](https://github.com/coatless-devcontainer/r-pkg/blob/main/.github/workflows/pre-build-devcontainer.yml) to build and publish the devcontainer onto GitHub's Container repository for the organization. Then, the repository's [`.devcontainer/devcontainer.json`](https://github.com/coatless-devcontainer/r-pkg/blob/main/.devcontainer/devcontainer.json) pulls the pre-built image. |
| 50 | +<img src="man/figures/README-pressure-1.png" width="100%" /> |
54 | 51 |
|
55 | | -> [!IMPORTANT] |
56 | | -> |
57 | | -> Make sure to specify the permissions as stated in the GitHub Actions workflow linked above |
58 | | -> and for organizations please make sure to have the organization's container registry enabled. |
59 | | -> |
60 | | -> For more information, see [GitHub's Container Registry documentation](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry). |
| 52 | +In that case, don’t forget to commit and push the resulting figure |
| 53 | +files, so they display on GitHub and CRAN. |
0 commit comments