Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (19.2%) to scientific vocabulary
Last synced: 6 months ago
·
JSON representation
Repository
Structured Messages and Options
Basic Info
- Host: GitHub
- Owner: NovoNordisk-OpenSource
- License: apache-2.0
- Language: R
- Default Branch: main
- Homepage: https://novonordisk-opensource.github.io/zephyr/
- Size: 5.92 MB
Statistics
- Stars: 3
- Watchers: 6
- Forks: 0
- Open Issues: 4
- Releases: 3
Created over 1 year ago
· Last pushed 7 months ago
Metadata Files
Readme
Changelog
License
README.Rmd
---
output: github_document
---
```{r, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(zephyr)
```
# zephyr
[](https://github.com/NovoNordisk-OpenSource/zephyr/actions/workflows/check_and_co.yaml)
[](https://app.codecov.io/gh/NovoNordisk-OpenSource/zephyr)
The zephyr package provides small functionalities for developers of R packages
to inform users about progress and issues, while at the same time allowing the
users to easily configure the amount of information they want to receive.
zephyr also has utilities to create, get, and document options used in your
packages.
The zephyr package is designed and intended for use within other R packages
developed and published under the
[Novo Nordisk Open Source](https://novonordisk-opensource.github.io/R-packages/)
ecosystem.
For packages outside our ecosystem, we recommend using the
[options](https://cran.r-project.org/package=options) package
instead for a more complete implementation of package options.
## Installation
```{r, eval=FALSE}
# Install the released version from CRAN:
install.packages("zephyr")
# Install the development version from GitHub:
pak::pak("NovoNordisk-OpenSource/zephyr")
```
## Use zephyr
The easiest way to use zephyr in your package is to set it up with the
`use_zephyr()` function.
This creates a new script `R/{pkgname}-options.R` with all the relevant
boilerplate code to use zephyr options in the package.
It adds the `verbosity_level` option, that the user can change to configure
the amount of information. For more information and the different levels
see `?verbosity_level`.
New options in your package can be added with `create_option()` and used
afterwards with `get_option()` inside your functions. Documentation is
automatically generated with `list_options()`.
## Messages and verbosity
The backbone of zephyr is the `msg()` and friends functions. They are to be used
inside your functions to give consistent levels of information to your users.
The main functions are:
* `msg_success()`: To show the success of a long or complicated operation.
* `msg_danger()`: To show a failed operation.
Note this is not throwing an error. Use `cli::cli_abort()` in that case.
* `msg_warning()`: To indicate a warning.
* `msg_info()`: To give detailed information.
* `msg_debug()`: To give debugging information.
These functions are already wrapped around the appropriate {cli} functions and
the relevant `verbosity_level`.
### Example
Let's say we have a function that does some long and complicated calculations,
and creates some output. We want to use zephyr `msg()` functions to inform the
user of the progress and the result.
A skeleton to use for that function could be the `foo()` function below:
```{r}
foo <- function() {
msg_debug("Some important debug information about the function")
msg_info("Starting calculations")
result <- 1 + 1 # Replace with long calculations and how to create output
if (result == 2) {
msg_success("Output created")
} else {
msg_danger("Output not created correctly")
}
return(result)
}
```
Here we first provide some debugging information if requested.
Then we inform that the calculations are starting. After the calculations, we
inform the user if the output was created correctly or not.
The default `verbosity_level` in zephyr is `verbose` which displays all messages
expect debugging:
```{r}
foo()
```
With `verbosity_level = "minimal"` only `msg_success()` and `msg_danger()`
messages are shown:
```{r}
withr::with_options(
new = list(zephyr.verbosity_level = "minimal"),
code = foo()
)
```
And they can be turned off completely with `verbosity_level = "quiet"`, while
`verbosity_level = "debug"` gives all messages:
```{r}
withr::with_options(
new = list(zephyr.verbosity_level = "quiet"),
code = foo()
)
withr::with_options(
new = list(zephyr.verbosity_level = "debug"),
code = foo()
)
```
Owner
- Name: NovoNordisk-OpenSource
- Login: NovoNordisk-OpenSource
- Kind: organization
- Repositories: 1
- Profile: https://github.com/NovoNordisk-OpenSource
GitHub Events
Total
- Create event: 17
- Release event: 2
- Issues event: 14
- Watch event: 3
- Delete event: 21
- Issue comment event: 107
- Push event: 180
- Pull request review comment event: 6
- Pull request event: 28
- Pull request review event: 17
Last Year
- Create event: 17
- Release event: 2
- Issues event: 14
- Watch event: 3
- Delete event: 21
- Issue comment event: 107
- Push event: 180
- Pull request review comment event: 6
- Pull request event: 28
- Pull request review event: 17
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 7
- Total pull requests: 14
- Average time to close issues: about 2 months
- Average time to close pull requests: 4 days
- Total issue authors: 4
- Total pull request authors: 2
- Average comments per issue: 0.14
- Average comments per pull request: 1.64
- Merged pull requests: 8
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 6
- Pull requests: 14
- Average time to close issues: 14 days
- Average time to close pull requests: 4 days
- Issue authors: 3
- Pull request authors: 2
- Average comments per issue: 0.0
- Average comments per pull request: 1.64
- Merged pull requests: 8
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- akselthomsen (4)
- AEBilgrau (1)
- falgreen (1)
- vladimirobucina (1)
- Lovemore-Gakava (1)
Pull Request Authors
- akselthomsen (15)
- SkanderMulder (1)
Top Labels
Issue Labels
enhancement (4)
documentation (1)
Pull Request Labels
enhancement (2)
documentation (1)
Packages
- Total packages: 1
-
Total downloads:
- cran 226 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
cran.r-project.org: zephyr
Structured Messages and Options
- Homepage: https://novonordisk-opensource.github.io/zephyr/
- Documentation: http://cran.r-project.org/web/packages/zephyr/zephyr.pdf
- License: Apache License (≥ 2)
-
Latest release: 0.1.3
published 7 months ago
Rankings
Dependent packages count: 27.4%
Dependent repos count: 33.8%
Average: 49.4%
Downloads: 86.9%
Maintainers (1)
Last synced:
7 months ago
Dependencies
.github/workflows/check_and_co.yaml
actions
DESCRIPTION
cran
- cli * imports
- options * imports
- rlang * imports
- utils * imports
- checkmate * suggests
- dplyr * suggests
- testthat >= 3.0.0 suggests
- withr * suggests