{"id":16572278,"url":"https://github.com/jonocarroll/triangles","last_synced_at":"2025-10-13T02:42:56.669Z","repository":{"id":187646515,"uuid":"675149650","full_name":"jonocarroll/triangles","owner":"jonocarroll","description":"Calculate Pythagorean Triples","archived":false,"fork":false,"pushed_at":"2023-08-11T13:39:36.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-07T08:41:19.701Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","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/jonocarroll.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-08-06T00:28:41.000Z","updated_at":"2025-05-18T05:11:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"ec5e4abd-f1be-4624-8ee5-61f981c236d2","html_url":"https://github.com/jonocarroll/triangles","commit_stats":null,"previous_names":["jonocarroll/triangles"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonocarroll/triangles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonocarroll%2Ftriangles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonocarroll%2Ftriangles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonocarroll%2Ftriangles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonocarroll%2Ftriangles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonocarroll","download_url":"https://codeload.github.com/jonocarroll/triangles/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonocarroll%2Ftriangles/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014015,"owners_count":26085345,"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-13T02:00:06.723Z","response_time":61,"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":[],"created_at":"2024-10-11T21:27:00.370Z","updated_at":"2025-10-13T02:42:56.626Z","avatar_url":"https://github.com/jonocarroll.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\neditor_options: \n  chunk_output_type: console\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```\n\n# triangles\n\n\u003c!-- badges: start --\u003e\n\u003c!-- badges: end --\u003e\n\nWrap C code to calculate Pythagorean triples.\n\n## Installation\n\nYou can install the development version of triangles with\n\n``` r\n# install.packages(\"remotes\")\nremotes::install_github(\"jonocarroll/triangles\")\n```\n\n## Example\n\nThis package is purely for demonstration purposes, supporting this blog post: https://jcarroll.com.au/2023/08/11/wrapping-c-code-in-an-r-package/ \n\nThe wrapped C code involves many features I learned about so I built this package \nto support the blog post in an effort to capture as many as possible. The processes \nhere are not new at all, but I found many of the existing resources to be either \nout of date or confusing.\n\nThe function `triangles()` takes a maximum hypotenuse length `maxval` and produces \na `data.frame()` in R. The columns represent the lengths of the sides of a \nright triangle `a`, `b`, and `c` such that all of these are integers, along with the \nsum of these (the perimeter of the triangle)\n\n```{r}\nlibrary(triangles)\n\ntriangles(20)\n```\n\nThis is a complete `data.frame` returned from C\n\n```{r}\nx \u003c- triangles(20)\nstr(x)\nx[x$sum \u003e 20 \u0026 x$sum \u003c 35, ]\n```\n\nVarious iterations of the C code can be found in [inst/src](inst/src).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonocarroll%2Ftriangles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonocarroll%2Ftriangles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonocarroll%2Ftriangles/lists"}