{"id":13858192,"url":"https://github.com/tidyverse/hms","last_synced_at":"2025-07-13T23:31:33.325Z","repository":{"id":6233125,"uuid":"55136164","full_name":"tidyverse/hms","owner":"tidyverse","description":"A simple class for storing time-of-day values","archived":false,"fork":false,"pushed_at":"2025-05-03T05:48:50.000Z","size":3856,"stargazers_count":142,"open_issues_count":17,"forks_count":28,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-07-08T05:19:11.464Z","etag":null,"topics":["hms","r","time"],"latest_commit_sha":null,"homepage":"https://hms.tidyverse.org/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tidyverse.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-03-31T09:05:58.000Z","updated_at":"2025-05-03T05:46:28.000Z","dependencies_parsed_at":"2023-01-13T13:53:48.054Z","dependency_job_id":"81a57e6c-9a5b-42e9-86cb-f74ba997073b","html_url":"https://github.com/tidyverse/hms","commit_stats":{"total_commits":580,"total_committers":18,"mean_commits":32.22222222222222,"dds":0.3879310344827587,"last_synced_commit":"a82ffdccb3990595442cf1231d55aaa3c3bbb38b"},"previous_names":[],"tags_count":68,"template":false,"template_full_name":null,"purl":"pkg:github/tidyverse/hms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fhms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fhms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fhms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fhms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tidyverse","download_url":"https://codeload.github.com/tidyverse/hms/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fhms/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264223827,"owners_count":23575533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hms","r","time"],"created_at":"2024-08-05T03:01:59.784Z","updated_at":"2025-07-13T23:31:28.311Z","avatar_url":"https://github.com/tidyverse.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput:\n  downlit::readme_document:\n    html_preview: false\n---\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\n\npkgload::load_all()\n```\n\n# hms \u003ca href='https:/hms.tidyverse.org'\u003e\u003cimg src='man/figures/logo.png' align=\"right\" height=\"139\" /\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n[![rcc](https://github.com/tidyverse/hms/workflows/rcc/badge.svg)](https://github.com/tidyverse/hms/actions)\n[![Codecov test coverage](https://codecov.io/gh/tidyverse/hms/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidyverse/hms?branch=main)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/hms)](https://cran.r-project.org/package=hms)\n\u003c!-- badges: end --\u003e\n\n## Overview\n\nThe 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:\n\n- Stores values as a numeric vector that contains the number of seconds\nsince midnight\n- Supports construction from explicit hour, minute, or second values\n- Supports coercion to and from various data types, including `POSIXt`\n- Can be used as column in a data frame\n- Based on the `difftime` class\n- Values can exceed the 24-hour boundary or be negative\n- By default, fractional seconds up to a microsecond are displayed, regardless of the value of the `\"digits.secs\"` option\n\n## Installation\n\n```r\n# The easiest way to get hms is to install the whole tidyverse:\ninstall.packages(\"tidyverse\")\n\n# Alternatively, install just hms:\ninstall.packages(\"hms\")\n\n# Or the the development version from GitHub:\n# install.packages(\"devtools\")\ndevtools::install_github(\"tidyverse/hms\")\n```\n\n## Usage\n\nThe following example showcases ways of using the `hms` class standalone or as a data frame column.\n\n```{r}\nlibrary(hms)\n\nhms(56, 34, 12)\nas_hms(Sys.time())\nparse_hms(\"12:34:56\")\nas.POSIXct(hms(1))\n\ndata.frame(hours = 1:3, hms = hms(hours = 1:3))\n```\n\n## Internal representation\n\nObjects of the `hms` and its underlying `difftime` classes are stored as number of seconds since `00:00:00`.\nUse `as.numeric()` and `as_hms()` to convert to and from numbers.\n\n```{r}\ntimes \u003c- parse_hms(c(\"00:00:00.25\", \"00:00:01\", \"00:01:30\", \"01:00:00\"))\ntimes\ntimes_num \u003c- as.numeric(times)\ntimes_num\nas_hms(times_num)\n```\n\n---\n\nPlease note that the 'hms' project is released with a\n[Contributor Code of Conduct](https://github.com/tidyverse/hms/blob/master/CODE_OF_CONDUCT.md).\nBy contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidyverse%2Fhms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftidyverse%2Fhms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidyverse%2Fhms/lists"}