shide

R package that provides date/time classes based on Jalali calendar

https://github.com/mmollayi/shide

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 (16.3%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

R package that provides date/time classes based on Jalali calendar

Basic Info
  • Host: GitHub
  • Owner: mmollayi
  • License: other
  • Language: R
  • Default Branch: master
  • Homepage:
  • Size: 296 KB
Statistics
  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • Open Issues: 1
  • Releases: 3
Created almost 3 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



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

# shide


[![R-CMD-check](https://github.com/mmollayi/shide/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/mmollayi/shide/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/mmollayi/shide/graph/badge.svg)](https://app.codecov.io/gh/mmollayi/shide)


## Overview

`shide` is an R package that provides date and date-time support based on Jalali calendar. `jdate` and `jdatetime` are two simple classes for storing Jalali dates and date-times respectively. These classes are implemented based on the infrastructure provided by the `vctrs` package.

## Installation

You can install shide from CRAN with:

``` {r, eval = FALSE}
install.packages("shide")
```

Or you can install the development version from GitHub:

``` {r, eval = FALSE}
# install.packages("devtools")
devtools::install_github("mmollayi/shide")
```

## Features

- Conversion between Jalali and Gregorian calendars.
- Parsing and formatting of Jalali dates and date-times.
- Time zones and daylight saving times support via IANA time zone database. Access to IANA time zone database files is provided by `tzdb` package.
- `jdate` and `jdatetime` are built upon numeric vectors, just like `Date` and `POSIXct`. So conversion between date classes (`jdate` and `Date`) and date-time classes (`jdatetime` and `POSIXct`) comes at zero cost.
- Both `jdate` and `jdatetime` can be used as column in a data frame.
- Compatible with R's `difftime` class. For example, subtraction of two `jdate`s results a `difftime` object.

## Usage

As with `Date` class, a `jdate` object can be generated from character and numeric vectors and also from individual components. To parse a character vector that represents Jalali dates, use `jdate()` and supply a format string:

```{r}
library(shide)

jdate("1402-09-13")
jdate("1402/09/13", format = "%Y/%m/%d")
```

Unlike `as.Date()`, `jdate()` method for numeric inputs does not expose `origin` argument.

```{r}
# Jalali date that corresponds to "1970-01-01"
jdate(0)
```

To create a `jdate` from individual components, use `jdate_make()`:

```{r}
jdate_make(1399, 12 ,30)
```

Like `jdate` a `jdatetime` object can be generated from a character or numeric vector or from individual components. But a timezone should be supplied in either case:

```{r}
jdatetime("1402-09-13 15:37:29", tzone = "Asia/Tehran")
jdatetime("1402/09/13 15:37:29", tzone = "Asia/Tehran", format = "%Y/%m/%d %H:%M:%S")

# Jalali date-time that corresponds to Unix epoch
jdatetime(0, tzone ="Asia/Tehran")

jdatetime_make(1399, 12 ,30, 23, 59, 59, "Asia/Tehran")
```

Converting other date and date-time classes to `jdate` and `jdatetime` is possible with `as_jdate()` and `as_jdatetime()` respectively:

```{r}
as_jdate(as.Date("2024-07-19"))
as_jdatetime(as.POSIXct("2024-07-19 16:25:00", tz = "Asia/Tehran"))
```

Owner

  • Name: Mohsen Mollayi
  • Login: mmollayi
  • Kind: user
  • Location: Tehran, Iran

GitHub Events

Total
  • Issues event: 1
  • Delete event: 1
  • Push event: 25
Last Year
  • Issues event: 1
  • Delete event: 1
  • Push event: 25

Packages

  • Total packages: 1
  • Total downloads:
    • cran 206 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 1
cran.r-project.org: shide

Date/Time Classes Based on Jalali Calendar

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 206 Last month
Rankings
Dependent packages count: 28.4%
Dependent repos count: 36.4%
Average: 49.9%
Downloads: 84.9%
Maintainers (1)
Last synced: 10 months ago