hmstimer

An R package to track elapsed clock time using a `hms::hms()` scalar.

https://github.com/poissonconsulting/hmstimer

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
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.9%) to scientific vocabulary

Keywords

cran hms r rstats timer

Keywords from Contributors

dbi write units sfc read posixct chk mcmcr mcmc derived-parameters
Last synced: 6 months ago · JSON representation

Repository

An R package to track elapsed clock time using a `hms::hms()` scalar.

Basic Info
Statistics
  • Stars: 2
  • Watchers: 4
  • Forks: 0
  • Open Issues: 2
  • Releases: 7
Topics
cran hms r rstats timer
Created almost 7 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Support

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# hmstimer 


[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![R-CMD-check](https://github.com/poissonconsulting/hmstimer/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/poissonconsulting/hmstimer/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/poissonconsulting/hmstimer/graph/badge.svg)](https://app.codecov.io/gh/poissonconsulting/hmstimer)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/license/mit/)
[![CRAN status](https://www.r-pkg.org/badges/version/hmstimer)](https://cran.r-project.org/package=hmstimer)
![CRAN downloads](https://cranlogs.r-pkg.org/badges/hmstimer)


`hmstimer` is an R package to 
track elapsed clock time using a [hms::hms](https://github.com/tidyverse/hms) scalar.

`hmstimer` was originally developed to time Bayesian model runs. It should not be used to estimate how long extremely fast code takes to execute as the package code adds a small time cost.

Create and start a timer with `tmr_timer(start = TRUE)`.

```{r}
library(hmstimer)

tmr <- tmr_timer(start = TRUE)
Sys.sleep(0.1)
str(tmr)
hms::as_hms(tmr)
```

Get the elapsed time with `tmr_elapsed()`.
The title is optional.
```{r}
tmr <- tmr_timer(start = TRUE, title = "my timer")

Sys.sleep(0.1)
tmr_elapsed(tmr)

Sys.sleep(0.1)
tmr_elapsed(tmr)
```

Stop the timer with `tmr_stop()`.

```{r}
tmr <- tmr_stop(tmr)
tmr_elapsed(tmr)

Sys.sleep(1)
tmr_elapsed(tmr)
```

Restart the timer with `tmr_start()`.
```{r}
tmr <- tmr_start(tmr)
tmr_elapsed(tmr)
Sys.sleep(0.1)
tmr_elapsed(tmr)
```

There are several options for printing and formatting including coercing to a hms object.
```{r}
tmr <- tmr_stop(tmr)
print(tmr)
tmr_print(tmr)
tmr_format(tmr, digits = 5)
```

If running `tmr_print()` behaves differently.

```{r}
tmr <- tmr_start(tmr)
tmr_print(tmr)
```

The time for a block of code to complete can be printed using `with_timer()`.

```{r}
with_timer({
  Sys.sleep(0.1)
  Sys.sleep(0.1)
  1 + 1
})
```

## Installation

### Release

To install the release version from [CRAN](https://CRAN.R-project.org/package=hmstimer).
```r
install.packages("hmstimer")
```

The website for the release version is at .

### Development

To install the development version from [GitHub](https://github.com/poissonconsulting/hmstimer)
```r
# install.packages("remotes")
remotes::install_github("poissonconsulting/hmstimer")
```

or from [r-universe](https://poissonconsulting.r-universe.dev/hmstimer).
```r
install.packages("hmstimer", repos = c("https://poissonconsulting.r-universe.dev", "https://cloud.r-project.org"))
```

## Contribution

Please report any [issues](https://github.com/poissonconsulting/hmstimer/issues).

[Pull requests](https://github.com/poissonconsulting/hmstimer/pulls) are always welcome.

## Code of Conduct

Please note that the hmstimer project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

Owner

  • Name: Poisson Consulting Ltd.
  • Login: poissonconsulting
  • Kind: organization
  • Email: software@poissonconsulting.ca
  • Location: Nelson, BC, Canada

Computational Biology and Statistical Ecology

GitHub Events

Total
  • Issues event: 2
  • Delete event: 19
  • Issue comment event: 1
  • Push event: 63
  • Pull request review event: 8
  • Pull request event: 36
  • Create event: 23
Last Year
  • Issues event: 2
  • Delete event: 19
  • Issue comment event: 1
  • Push event: 63
  • Pull request review event: 8
  • Pull request event: 36
  • Create event: 23

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 254
  • Total Committers: 7
  • Avg Commits per committer: 36.286
  • Development Distribution Score (DDS): 0.268
Past Year
  • Commits: 131
  • Committers: 3
  • Avg Commits per committer: 43.667
  • Development Distribution Score (DDS): 0.374
Top Committers
Name Email Commits
Joe Thorley j****e@p****a 186
Kirill Müller k****l@c****m 43
Nadine Hussein n****3@g****m 8
Ayla Pearson a****3@g****m 7
Duncan Kennedy d****n@p****a 6
Evan e****i@g****m 3
Mowahid Latif m****f@M****l 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 15
  • Total pull requests: 52
  • Average time to close issues: over 1 year
  • Average time to close pull requests: about 1 month
  • Total issue authors: 3
  • Total pull request authors: 5
  • Average comments per issue: 1.27
  • Average comments per pull request: 0.1
  • Merged pull requests: 45
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 2
  • Pull requests: 36
  • Average time to close issues: N/A
  • Average time to close pull requests: about 19 hours
  • Issue authors: 2
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 33
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • joethorley (12)
  • krlmlr (2)
  • dunkenwg (1)
Pull Request Authors
  • krlmlr (36)
  • joethorley (10)
  • nadinehussein (3)
  • github-actions[bot] (2)
  • MowahidLatif (1)
Top Labels
Issue Labels
upkeep (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 287 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 2
  • Total versions: 7
  • Total maintainers: 1
cran.r-project.org: hmstimer

'hms' Based Timer

  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 287 Last month
Rankings
Dependent repos count: 19.3%
Dependent packages count: 28.7%
Average: 30.7%
Downloads: 44.1%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.3 depends
  • hms * imports
  • covr * suggests
  • testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml actions
  • 8398a7/action-slack v3.0.0 composite
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/upload-artifact master composite
  • r-lib/actions/setup-pandoc master composite
  • r-lib/actions/setup-r master composite
  • r-lib/actions/setup-tinytex v2 composite
.github/workflows/pkgdown.yaml actions
  • 8398a7/action-slack v3.0.0 composite
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc master composite
  • r-lib/actions/setup-r master composite
.github/workflows/git-identity/action.yml actions
.github/workflows/install/action.yml actions
  • ./.github/workflows/get-extra * composite
  • krlmlr/ccache-action parallel-dir composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/R-CMD-check-dev.yaml actions
  • ./.github/workflows/check * composite
  • ./.github/workflows/custom/after-install * composite
  • ./.github/workflows/custom/before-install * composite
  • ./.github/workflows/dep-matrix * composite
  • ./.github/workflows/install * composite
  • ./.github/workflows/rate-limit * composite
  • ./.github/workflows/update-snapshots * composite
  • actions/checkout v4 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/check/action.yml actions
  • actions/upload-artifact main composite
  • r-lib/actions/check-r-package v2 composite
.github/workflows/commit/action.yml actions
.github/workflows/dep-matrix/action.yml actions
.github/workflows/dep-suggests-matrix/action.yml actions
.github/workflows/dep-suggests-matrix-read/action.yml actions
.github/workflows/fledge.yaml actions
  • ./.github/workflows/git-identity * composite
  • ./.github/workflows/install * composite
  • actions/checkout v4 composite
.github/workflows/lock.yaml actions
  • dessant/lock-threads v5 composite
.github/workflows/pkgdown-build/action.yml actions
.github/workflows/pkgdown-deploy/action.yml actions
  • nick-fields/retry v3 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/pr-fetch v2 composite
  • r-lib/actions/pr-push v2 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/rate-limit/action.yml actions
.github/workflows/revdep.yaml actions
  • actions/checkout v4 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc v2 composite
.github/workflows/roxygenize/action.yml actions
.github/workflows/style/action.yml actions
  • actions/cache v4 composite
.github/workflows/update-snapshots/action.yml actions
  • peter-evans/create-pull-request v6 composite
.github/workflows/update-status/action.yml actions
.github/workflows/versions-matrix/action.yml actions
.github/workflows/versions-matrix-read/action.yml actions