hms

A simple class for storing time-of-day values

https://github.com/tidyverse/hms

Science Score: 36.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
    2 of 19 committers (10.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.7%) to scientific vocabulary

Keywords

hms r time

Keywords from Contributors

data-manipulation package-creation date-time grammar interface travis-ci tidy-data codecov coverage coverage-report
Last synced: 6 months ago · JSON representation

Repository

A simple class for storing time-of-day values

Basic Info
  • Host: GitHub
  • Owner: tidyverse
  • License: other
  • Language: R
  • Default Branch: main
  • Homepage: https://hms.tidyverse.org/
  • Size: 3.68 MB
Statistics
  • Stars: 142
  • Watchers: 9
  • Forks: 28
  • Open Issues: 17
  • Releases: 14
Topics
hms r time
Created almost 10 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Support

README.Rmd

---
output:
  downlit::readme_document:
    html_preview: false
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

pkgload::load_all()
```

# hms 


[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![rcc](https://github.com/tidyverse/hms/workflows/rcc/badge.svg)](https://github.com/tidyverse/hms/actions)
[![Codecov test coverage](https://codecov.io/gh/tidyverse/hms/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidyverse/hms?branch=main)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/hms)](https://cran.r-project.org/package=hms)


## Overview

The hms package provides a simple class for storing durations or time-of-day values and displaying them in the hh:mm:ss format.  This class is intended to simplify data exchange with databases, spreadsheets, and other data sources:

- Stores values as a numeric vector that contains the number of seconds
since midnight
- Supports construction from explicit hour, minute, or second values
- Supports coercion to and from various data types, including `POSIXt`
- Can be used as column in a data frame
- Based on the `difftime` class
- Values can exceed the 24-hour boundary or be negative
- By default, fractional seconds up to a microsecond are displayed, regardless of the value of the `"digits.secs"` option

## Installation

```r
# The easiest way to get hms is to install the whole tidyverse:
install.packages("tidyverse")

# Alternatively, install just hms:
install.packages("hms")

# Or the the development version from GitHub:
# install.packages("devtools")
devtools::install_github("tidyverse/hms")
```

## Usage

The following example showcases ways of using the `hms` class standalone or as a data frame column.

```{r}
library(hms)

hms(56, 34, 12)
as_hms(Sys.time())
parse_hms("12:34:56")
as.POSIXct(hms(1))

data.frame(hours = 1:3, hms = hms(hours = 1:3))
```

## Internal representation

Objects of the `hms` and its underlying `difftime` classes are stored as number of seconds since `00:00:00`.
Use `as.numeric()` and `as_hms()` to convert to and from numbers.

```{r}
times <- parse_hms(c("00:00:00.25", "00:00:01", "00:01:30", "01:00:00"))
times
times_num <- as.numeric(times)
times_num
as_hms(times_num)
```

---

Please note that the 'hms' project is released with a
[Contributor Code of Conduct](https://github.com/tidyverse/hms/blob/master/CODE_OF_CONDUCT.md).
By contributing to this project, you agree to abide by its terms.

Owner

  • Name: tidyverse
  • Login: tidyverse
  • Kind: organization

The tidyverse is a collection of R packages that share common principles and are designed to work together seamlessly

GitHub Events

Total
  • Issues event: 11
  • Watch event: 3
  • Delete event: 28
  • Issue comment event: 37
  • Push event: 97
  • Pull request review comment event: 10
  • Pull request review event: 13
  • Pull request event: 85
  • Fork event: 5
  • Create event: 37
Last Year
  • Issues event: 11
  • Watch event: 3
  • Delete event: 28
  • Issue comment event: 37
  • Push event: 97
  • Pull request review comment event: 10
  • Pull request review event: 13
  • Pull request event: 85
  • Fork event: 5
  • Create event: 37

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 631
  • Total Committers: 19
  • Avg Commits per committer: 33.211
  • Development Distribution Score (DDS): 0.216
Past Year
  • Commits: 44
  • Committers: 5
  • Avg Commits per committer: 8.8
  • Development Distribution Score (DDS): 0.136
Top Committers
Name Email Commits
Kirill Müller k****r@m****g 495
Kirill Müller k****r@i****h 99
Indrajeet Patil p****e@g****m 8
Mara Averick m****k@g****m 5
Hadley Wickham h****m@g****m 3
Quentin Geissmann q****n@g****m 3
github-actions g****s 3
github-actions[bot] 4****] 3
Lionel Henry l****y@g****m 2
Antoine Fabri a****i@g****m 1
David Granjon d****n@y****m 1
Hunter Glanz h****z@c****u 1
Jeroen Ooms j****s@g****m 1
Jim Hester j****r@g****m 1
Joe Thorley j****e@p****a 1
Romain Francois r****n@r****m 1
Vitalie Spinu s****t@g****m 1
eitsupi 5****i 1
evanhaldane e****e@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 72
  • Total pull requests: 126
  • Average time to close issues: 7 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 32
  • Total pull request authors: 19
  • Average comments per issue: 2.5
  • Average comments per pull request: 0.6
  • Merged pull requests: 85
  • Bot issues: 0
  • Bot pull requests: 32
Past Year
  • Issues: 8
  • Pull requests: 85
  • Average time to close issues: 3 days
  • Average time to close pull requests: about 11 hours
  • Issue authors: 6
  • Pull request authors: 6
  • Average comments per issue: 0.75
  • Average comments per pull request: 0.18
  • Merged pull requests: 50
  • Bot issues: 0
  • Bot pull requests: 32
Top Authors
Issue Authors
  • krlmlr (19)
  • hadley (9)
  • qgeissmann (5)
  • randomgambit (4)
  • statquant (3)
  • eitsupi (2)
  • jimhester (2)
  • AshesITR (2)
  • yutannihilation (2)
  • moodymudskipper (2)
  • earowang (1)
  • lionel- (1)
  • Cervangirard (1)
  • carlganz (1)
  • kevinushey (1)
Pull Request Authors
  • krlmlr (65)
  • github-actions[bot] (32)
  • batpigandme (5)
  • moodymudskipper (3)
  • qgeissmann (3)
  • schochastics (3)
  • lionel- (2)
  • DivadNojnarg (2)
  • AshesITR (1)
  • eitsupi (1)
  • jeroen (1)
  • joethorley (1)
  • carlganz (1)
  • vspinu (1)
  • hadley (1)
Top Labels
Issue Labels
help wanted :heart: (8) bug (1) tidy-dev-day :nerd_face: (1) upkeep (1) feature (1)
Pull Request Labels
in progress (1) CRAN release :station: (1)

Packages

  • Total packages: 3
  • Total downloads:
    • cran 706,392 last-month
  • Total docker downloads: 47,102,694
  • Total dependent packages: 88
    (may contain duplicates)
  • Total dependent repositories: 485
    (may contain duplicates)
  • Total versions: 36
  • Total maintainers: 1
cran.r-project.org: hms

Pretty Time of Day

  • Versions: 15
  • Dependent Packages: 73
  • Dependent Repositories: 432
  • Downloads: 706,392 Last month
  • Docker Downloads: 47,102,694
Rankings
Downloads: 0.2%
Dependent repos count: 0.7%
Dependent packages count: 1.2%
Stargazers count: 3.1%
Forks count: 3.1%
Average: 4.3%
Docker downloads count: 17.3%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/tidyverse/hms
  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.7%
Dependent repos count: 5.9%
Last synced: 6 months ago
conda-forge.org: r-hms
  • Versions: 10
  • Dependent Packages: 15
  • Dependent Repositories: 53
Rankings
Dependent packages count: 4.2%
Dependent repos count: 4.9%
Average: 18.5%
Stargazers count: 30.2%
Forks count: 34.7%
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • ellipsis >= 0.3.2 imports
  • lifecycle * imports
  • methods * imports
  • pkgconfig * imports
  • rlang * imports
  • vctrs >= 0.3.8 imports
  • crayon * suggests
  • lubridate * suggests
  • pillar >= 1.1.0 suggests
  • testthat >= 3.0.0 suggests
.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 v3 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/R-CMD-check.yaml actions
  • ./.github/workflows/check * composite
  • ./.github/workflows/commit * composite
  • ./.github/workflows/custom/after-install * composite
  • ./.github/workflows/custom/before-install * composite
  • ./.github/workflows/git-identity * composite
  • ./.github/workflows/install * composite
  • ./.github/workflows/pkgdown-build * composite
  • ./.github/workflows/pkgdown-deploy * composite
  • ./.github/workflows/rate-limit * composite
  • ./.github/workflows/roxygenize * composite
  • ./.github/workflows/style * composite
  • ./.github/workflows/update-snapshots * composite
  • actions/checkout v3 composite
.github/workflows/check/action.yml actions
  • actions/upload-artifact main composite
  • r-lib/actions/check-r-package v2 composite
.github/workflows/fledge.yaml actions
  • ./.github/workflows/git-identity * composite
  • ./.github/workflows/install * composite
  • actions/checkout v2 composite
.github/workflows/install/action.yml actions
  • ./.github/workflows/get-extra * 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/lock.yaml actions
  • dessant/lock-threads v2 composite
.github/workflows/pkgdown-deploy/action.yml actions
  • nick-fields/retry v2 composite
.github/workflows/pkgdown.yaml actions
  • ./.github/workflows/custom/after-install * composite
  • ./.github/workflows/custom/before-install * composite
  • ./.github/workflows/git-identity * composite
  • ./.github/workflows/install * composite
  • ./.github/workflows/pkgdown-build * composite
  • ./.github/workflows/pkgdown-deploy * composite
  • ./.github/workflows/rate-limit * composite
  • actions/checkout v3 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/pr-fetch master composite
  • r-lib/actions/pr-push master composite
  • r-lib/actions/setup-r master composite
.github/workflows/revdep.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc v2 composite
.github/workflows/style/action.yml actions
  • actions/cache v3 composite
.github/workflows/update-snapshots/action.yml actions
  • peter-evans/create-pull-request v4 composite