{"id":15893685,"url":"https://github.com/brownag/ggspc","last_synced_at":"2025-07-08T03:36:20.796Z","repository":{"id":127454388,"uuid":"596344583","full_name":"brownag/ggspc","owner":"brownag","description":"Custom 'ggplot2' 'Stat', 'Geom', and 'theme' definitions for the 'aqp' 'SoilProfileCollection' object","archived":false,"fork":false,"pushed_at":"2025-01-29T17:59:05.000Z","size":758,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T18:15:48.444Z","etag":null,"topics":["aqp","ggplot2","graphics","plot","r","soilprofilecollection"],"latest_commit_sha":null,"homepage":"","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/brownag.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"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}},"created_at":"2023-02-02T01:14:50.000Z","updated_at":"2025-01-29T17:59:08.000Z","dependencies_parsed_at":"2025-02-08T08:42:02.712Z","dependency_job_id":"92547365-90a1-425f-9c5c-dd455be5f881","html_url":"https://github.com/brownag/ggspc","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"c619f23940eecf15d77b49ab8b1588df4f0a84f5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brownag/ggspc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brownag%2Fggspc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brownag%2Fggspc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brownag%2Fggspc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brownag%2Fggspc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brownag","download_url":"https://codeload.github.com/brownag/ggspc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brownag%2Fggspc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264190888,"owners_count":23570598,"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":["aqp","ggplot2","graphics","plot","r","soilprofilecollection"],"created_at":"2024-10-06T08:12:44.514Z","updated_at":"2025-07-08T03:36:20.720Z","avatar_url":"https://github.com/brownag.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"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  fig.retina = 3 \n)\n```\n\n# {ggspc}\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/brownag/ggspc/actions/workflows/R-CMD-check.yml/badge.svg)](https://github.com/brownag/ggspc/actions/workflows/R-CMD-check.yml)\n[![ggspc HTML Manual](http://img.shields.io/badge/docs-HTML-informational)](https://humus.rocks/ggspc/)\n[![CRAN status](https://www.r-pkg.org/badges/version/ggspc)](https://CRAN.R-project.org/package=ggspc)\n[![Codecov test coverage](https://codecov.io/gh/brownag/ggspc/branch/main/graph/badge.svg)](https://app.codecov.io/gh/brownag/ggspc?branch=main)\n\u003c!-- badges: end --\u003e\n\nThe goal of {ggspc} is to provide custom 'Stat', 'Geom' and 'theme' definitions for 'SoilProfileCollection' object compatibility with 'ggplot2'.\n\n\n## Installation\n\nYou can install the development version of {ggspc} like so:\n\n``` r\nremotes::install_github(\"brownag/ggspc\")\n```\n\n## Example\n\nThis a example shows how to solve the common problem of plotting variables contained in a `SoilProfileCollection` with `ggplot2::ggplot()`\n\n```{r example}\nlibrary(aqp)\nlibrary(ggspc)\nlibrary(ggplot2)\n\ndata(loafercreek, package = \"soilDB\")\nGHL(loafercreek) \u003c- \"dspcomplayerid\"\n```\n\n### Basics\n\nThis is a demonstration of what is possible with a simple `fortify(\u003cSPC\u003e)` method defined. The \"fortify\" method makes it such that names from horizon and site slots of the SPC can be used in `ggplot()` aesthetics via `aes()`. \n\n```{r basic-spc-ggplot}\n# site v.s. site level\nggplot(loafercreek, aes(earthcovkind1, slope_field)) +\n  geom_boxplot(na.rm = TRUE)\n```\n\n```{r basic-spc-ggplot2}\n# site v.s. horizon level\nggplot(loafercreek, aes(hillslopeprof, clay)) +\n  geom_boxplot(na.rm = TRUE)\n```\n\n```{r basic-spc-ggplot3}\n# horizon v.s. horizon level\nggplot(loafercreek, aes(clay, dspcomplayerid)) +\n  geom_boxplot(na.rm = TRUE)\n```\n\n### Depth Weighted Aggregation (`stat_depth_weighted()`)\n\nThe `stat_depth_weighted()` function is a specialized {ggplot2} statistic intended for calculation of depth-weighted values for horizon data in a `SoilProfileCollection`. The default uses a constant interval `from=0` `to=200` (centimeters), but the intervals of interest may alternately be specified as site-level column names (unquoted), and therefore may vary between profiles.\n\nCurrently, `stat_depth_weighted()` only supports the \"point\" geometry type, but in future \"boxplot\" and others may be supported.\n\n```{r stat-depth-weighted-spc}\n# default y aesthetic is the profile_id(\u003cSPC\u003e)\nggplot(loafercreek[1:10], aes(clay)) +\n  stat_depth_weighted(na.rm = TRUE)\n```\n\n```{r stat-depth-weighted-spc2}\n# can use alternate y aesthetic, e.g. hillslopeprof\nggplot(loafercreek, aes(clay, hillslopeprof)) +\n  stat_depth_weighted(na.rm = TRUE)\n```\n\n```{r stat-depth-weighted-spc3}\n# continuous y axes works too (horizon v.s. horizon)\nggplot(loafercreek, aes(clay, sand)) +\n  stat_depth_weighted(na.rm = TRUE)\n```\n\n```{r stat-depth-weighted-spc4}\n# continuous y (horizon v.s. site)\nggplot(loafercreek, aes(clay, slope_field)) +\n  stat_depth_weighted(na.rm = TRUE)\n```\n\n```{r stat-depth-weighted-spc5}\n# can combine with typical ggplot geoms (0-200cm mean over boxplots)\nggplot(loafercreek, aes(clay, hillslopeprof)) +\n  geom_boxplot(na.rm = TRUE) + \n  stat_depth_weighted(na.rm = TRUE, col = \"red\", pch = 17, cex = 3)\n```\n\n```{r stat-depth-weighted-spc6}\n# use site-level columns for profile-specific intervals (e.g. PSCS)\nggplot() +\n  stat_depth_weighted(\n    loafercreek,\n    aes(clay, hillslopeprof),\n    na.rm = TRUE,\n    from = psctopdepth,\n    to = pscbotdepth\n  )\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrownag%2Fggspc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrownag%2Fggspc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrownag%2Fggspc/lists"}