{"id":32204159,"url":"https://github.com/talegari/tidier","last_synced_at":"2025-10-22T04:51:32.689Z","repository":{"id":156235152,"uuid":"632408243","full_name":"talegari/tidier","owner":"talegari","description":"dplyr friendly spark style window aggregation for R dataframes and remote dbplyr tbls","archived":false,"fork":false,"pushed_at":"2023-09-10T17:41:15.000Z","size":449,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-12T03:54:34.570Z","etag":null,"topics":["dbplyr","dplyr","mutate","rstats","rstats-package","spark-sql","tidyverse"],"latest_commit_sha":null,"homepage":"https://talegari.github.io/tidier/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/talegari.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-04-25T10:50:47.000Z","updated_at":"2024-08-16T20:01:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"7e124dbe-f72f-410e-aab1-2673fefdc8cb","html_url":"https://github.com/talegari/tidier","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/talegari/tidier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talegari%2Ftidier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talegari%2Ftidier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talegari%2Ftidier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talegari%2Ftidier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/talegari","download_url":"https://codeload.github.com/talegari/tidier/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talegari%2Ftidier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280382978,"owners_count":26321423,"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","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dbplyr","dplyr","mutate","rstats","rstats-package","spark-sql","tidyverse"],"created_at":"2025-10-22T04:51:27.660Z","updated_at":"2025-10-22T04:51:32.682Z","avatar_url":"https://github.com/talegari.png","language":"R","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n\nlibrary(\"purrr\") # prevent `purrr` load message by `furrr`\ndevtools::load_all()\n```\n\n# tidier\n\n\u003c!-- badges: start --\u003e\n\n[![CRAN status](https://www.r-pkg.org/badges/version/tidier)](https://CRAN.R-project.org/package=tidier) [![R-CMD-check](https://github.com/talegari/tidier/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/talegari/tidier/actions/workflows/R-CMD-check.yaml) `r badger::badge_devel(color = \"blue\")`\n\n\u003c!-- badges: end --\u003e\n\n`tidier` package provides '[Apache Spark](https://spark.apache.org/)' style window aggregation for R dataframes and remote `dbplyr` tbls via '[mutate](https://dplyr.tidyverse.org/reference/mutate.html)' in '[dplyr](https://dplyr.tidyverse.org/index.html)' flavour.\n\n## Example\n\n**Create a new column with average temp over last seven days in the same month**.\n\n```{r}\nset.seed(101)\nairquality |\u003e\n  # create date column\n  dplyr::mutate(date_col = lubridate::make_date(1973, Month, Day)) |\u003e\n  # create gaps by removing some days\n  dplyr::slice_sample(prop = 0.8) |\u003e \n  # compute mean temperature over last seven days in the same month\n  tidier::mutate(avg_temp_over_last_week = mean(Temp, na.rm = TRUE),\n                 .order_by = Day,\n                 .by       = Month,\n                 .frame    = c(lubridate::days(7), # 7 days before current row\n                               lubridate::days(-1) # do not include current row\n                               ),\n                 .index    = date_col\n                 )\n```\n\n## Features\n\n-   `mutate` supports\n    -   `.by` (group by),\n    -   `.order_by` (order by),\n    -   `.frame` (endpoints of window frame),\n    -   `.index` (identify index column like date column, in df version only),\n    -   `.complete` (whether to compute over incomplete window, in df version only).\n-   `mutate` automatically uses a future backend (via [`furrr`](https://furrr.futureverse.org/), in df version only).\n\n## Motivation\n\nThis implementation is inspired by Apache Spark's [`windowSpec`](https://spark.apache.org/docs/3.2.1/api/python/reference/api/pyspark.sql.Column.over.html?highlight=windowspec) class with [`rangeBetween`](https://spark.apache.org/docs/3.2.1/api/python/reference/api/pyspark.sql.WindowSpec.rangeBetween.html) and [`rowsBetween`](https://spark.apache.org/docs/3.2.1/api/python/reference/api/pyspark.sql.WindowSpec.rowsBetween.html).\n\n## Ecosystem\n\n1.  [`dbplyr`](https://dbplyr.tidyverse.org/) implements this via [`dbplyr::win_over`](https://dbplyr.tidyverse.org/reference/win_over.html?q=win_over#null) enabling [`sparklyr`](https://spark.rstudio.com/) users to write window computations. Also see, [`dbplyr::window_order`/`dbplyr::window_frame`](https://dbplyr.tidyverse.org/reference/window_order.html?q=window_fr#ref-usage). `tidier`'s `mutate` wraps this functionality via uniform syntax across dataframes and remote tbls.\n\n2.  [`tidypyspark`](https://talegari.github.io/tidypyspark/_build/html/index.html) python package implements `mutate` style window computation API for pyspark.\n\n## Installation\n\n-   dev: `remotes::install_github(\"talegari/tidier\")`\n-   cran: `install.packages(\"tidier\")`\n\n## Acknowledgements\n\n`tidier` package is deeply indebted to three amazing packages and people behind it.\n\n1.  [`dplyr`](https://cran.r-project.org/package=dplyr):\n\n\u003c!-- --\u003e\n\n```         \nWickham H, François R, Henry L, Müller K, Vaughan D (2023). _dplyr: A\nGrammar of Data Manipulation_. R package version 1.1.0,\n\u003chttps://CRAN.R-project.org/package=dplyr\u003e.\n```\n\n2.  [`slider`](https://cran.r-project.org/package=slider):\n\n\u003c!-- --\u003e\n\n```         \nVaughan D (2021). _slider: Sliding Window Functions_. R package\nversion 0.2.2, \u003chttps://CRAN.R-project.org/package=slider\u003e.\n```\n\n3. [`dbplyr`](https://cran.r-project.org/package=dbplyr):\n\n\u003c!-- --\u003e\n\n```\nWickham H, Girlich M, Ruiz E (2023). _dbplyr: A 'dplyr' Back End\n  for Databases_. R package version 2.3.2,\n  \u003chttps://CRAN.R-project.org/package=dbplyr\u003e.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftalegari%2Ftidier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftalegari%2Ftidier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftalegari%2Ftidier/lists"}