{"id":23280062,"url":"https://github.com/ericmshearer/jarvis","last_synced_at":"2025-04-06T13:29:46.341Z","repository":{"id":268659960,"uuid":"903554142","full_name":"ericmshearer/jarvis","owner":"ericmshearer","description":"dev package","archived":false,"fork":false,"pushed_at":"2024-12-24T01:50:04.000Z","size":296,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T19:44:53.779Z","etag":null,"topics":["data-science","dev","r"],"latest_commit_sha":null,"homepage":"","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/ericmshearer.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-12-14T22:34:06.000Z","updated_at":"2024-12-24T01:50:07.000Z","dependencies_parsed_at":"2024-12-18T06:43:47.238Z","dependency_job_id":"cd3b1380-1dde-4b73-a60a-0db78dda6021","html_url":"https://github.com/ericmshearer/jarvis","commit_stats":null,"previous_names":["ericmshearer/jarvis"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmshearer%2Fjarvis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmshearer%2Fjarvis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmshearer%2Fjarvis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmshearer%2Fjarvis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericmshearer","download_url":"https://codeload.github.com/ericmshearer/jarvis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247488026,"owners_count":20946868,"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":["data-science","dev","r"],"created_at":"2024-12-19T23:29:15.373Z","updated_at":"2025-04-06T13:29:46.322Z","avatar_url":"https://github.com/ericmshearer.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\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(OCepi)\nlibrary(dplyr)\nlibrary(jarvis)\nlibrary(ggplot2)\n```\n\n# jarvis\n\n![](https://img.shields.io/badge/lifecycle-experimental-brightgreen.svg)\n\n## Installation\n\n```r\npak::pak(\"ericmshearer/jarvis\")\n```\n\n## Tables\n\n`tbl()`\n\n-   `scaled` controls whether or not percent is multiplied by 100.\n-   `digits` sets rounding.\n-   For tables \u003e1 variable, can pivot long to wide by setting `pivot` to TRUE.\n\n```{r tbl1}\nlinelist |\u003e\n  tbl(Gender)\n```\n\n```{r tbl2}\nlinelist |\u003e\n  tbl(Gender, Ethnicity, pivot = TRUE)\n```\n\n`tbl_totals()`\n\n-   Default calculates column totals. For row, set `loc` to \"row\". Or can use \"both\".\n-   Name of summed cell defaults to \"Total\". To change, update `name`.\n\n```{r tbl_totals}\nlinelist |\u003e\n  tbl(Race) |\u003e\n  tbl_totals()\n```\n\n`tbl_percentage()`\n\n-   Control rounding via `digits`.\n-   Default calculates column percentages. For row, set `loc` to \"row\".\n\n```{r tbl_percentage}\nlinelist |\u003e\n  tbl(Race, Ethnicity, pivot = TRUE) |\u003e\n  tbl_percentage()\n```\n\n## Data Visualization\n\n`scale_percent()`\n\nFor unscaled percentages (i.e. not multiplied by 100), update `scale` to FALSE. \n\n```{r scale_percent, fig.width = 14, fig.asp = 0.8}\nlinelist |\u003e\n  count(Race) |\u003e\n  mutate(percent = add_percent(n)) |\u003e\n  ggplot(aes(x = Race, y = percent)) +\n  geom_bar(stat = \"identity\") +\n  scale_x_discrete(label = wrap_labels(delim = \"or\")) +\n  scale_y_continuous(expand = c(0,0), label = scale_percent()) +\n  theme_apollo()\n```\n\n`scale_color_apollo()`\n\n-   Current palettes: Bright, Muted, Okabe Ito.\n-   Reverse palette via `reverse`, logical.\n\n```{r scale_color_apollo, fig.width = 16, fig.asp = 0.6}\ncovid \u003c- read.csv(\"https://data.chhs.ca.gov/dataset/f333528b-4d38-4814-bebb-12db1f10f535/resource/046cdd2b-31e5-4d34-9ed3-b48cdbc4be7a/download/covid19cases_test.csv\", na.strings = \"\", stringsAsFactors = FALSE) |\u003e\n  filter(area %in% c(\"Orange\",\"Los Angeles\",\"San Diego\",\"Ventura\",\"San Bernardino\",\"Kern\"))\n\ncovid \u003c- covid |\u003e\n  group_by(area) |\u003e\n  mutate(\n    date = as.Date(date, \"%Y-%m-%d\"),\n    rate = rate_per_100k(cases, population, digits = 1),\n    rate_ma_7 = round(zoo::rollmean(rate, k = 7, align = \"right\", na.pad = FALSE, fill = 0), digits = 2)\n  ) |\u003e\n  ungroup() |\u003e\n  filter(date \u003c= \"2020-12-23\", date \u003e \"2020-08-01\")\n\nggplot(data = covid, aes(x = date, y = rate_ma_7, color = area)) +\n  geom_line(linewidth = 1.2) +\n  theme_apollo() +\n  scale_y_continuous(expand = c(0,0), limits = c(0,200)) +\n  scale_color_apollo(name = \"Bright\")\n```\n\n`expand_x()`\n\nFor time series plots that need x-scale extend to fit everything. Set `expand` equal to `expand_x()` with a numeric value.\n\n```{r expand_x, fig.width = 16, fig.asp = 0.6}\nggplot(data = covid, aes(x = date, y = rate_ma_7, color = area)) +\n  geom_line(linewidth = 1.2) +\n  geom_text(data = end_points(covid, date), aes(label = area), size = 4.5, hjust = -0.1, show.legend = FALSE) +\n  theme_apollo() +\n  scale_x_date(expand = expand_x(20)) +\n  scale_y_continuous(expand = c(0,0), limits = c(0,200)) +\n  scale_color_apollo(name = \"Bright\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericmshearer%2Fjarvis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericmshearer%2Fjarvis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericmshearer%2Fjarvis/lists"}