{"id":21025788,"url":"https://github.com/koderkow/pathr","last_synced_at":"2026-05-22T07:04:59.350Z","repository":{"id":134309445,"uuid":"607480479","full_name":"KoderKow/pathr","owner":"KoderKow","description":"Work with URL and file paths in R","archived":false,"fork":false,"pushed_at":"2023-03-03T07:14:15.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T14:28:23.624Z","etag":null,"topics":["r","string-manipulation","url-parser"],"latest_commit_sha":null,"homepage":"https://koderkow.github.io/pathr/","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/KoderKow.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-28T03:38:04.000Z","updated_at":"2023-03-01T23:33:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"a1310a0e-ca14-4a99-949d-7404fe320e5f","html_url":"https://github.com/KoderKow/pathr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KoderKow%2Fpathr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KoderKow%2Fpathr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KoderKow%2Fpathr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KoderKow%2Fpathr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KoderKow","download_url":"https://codeload.github.com/KoderKow/pathr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243461276,"owners_count":20294718,"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":["r","string-manipulation","url-parser"],"created_at":"2024-11-19T11:36:46.005Z","updated_at":"2025-12-30T10:37:56.965Z","avatar_url":"https://github.com/KoderKow.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)\n\ndevtools::load_all()\n```\n\n# pathr\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)\n[![CRAN status](https://www.r-pkg.org/badges/version/pathr)](https://CRAN.R-project.org/package=pathr)\n[![Codecov test coverage](https://codecov.io/gh/KoderKow/pathr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/KoderKow/pathr?branch=main)\n[![R-CMD-check](https://github.com/KoderKow/pathr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/KoderKow/pathr/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\nThe goal of {pathr} is to simplify the process of string manipulations for URLs and file paths. This uses modified functions from the [{httr}](https://github.com/r-lib/httr) to create opinionated functions that allow working with URLs and paths easier.\n\n## Installation\n\nYou can install the development version of {pathr} like so:\n\n``` r\ndevtools::install_github(\"koderkow/pathr\")\n```\n\n## URLs\n\n### Basic URLs\n\n```r\nlibrary(pathr)\n```\n\nSort components of a URL\n\n```{r parse}\nurl \u003c- \"https://github.com/KoderKow/pathr\"\n\nx \u003c- parse_url(url)\n\nx\n\nstr(x)\n```\n\nPut it back to together\n\n```{r}\nbuild_url(x)\n```\n\n### URLs with a file path\n\nURLs with item paths will be detected\n\n```{r}\nurl \u003c- \"https://github.com/KoderKow/pathr/example-folder/my-data.csv\"\n\nx \u003c- parse_url(url)\n\nx\n\nstr(x)\n```\n\nBuilding the URL ignores the file element\n\n```{r}\nbuild_url(x)\n```\n\n### Vector of URLS\n\n```{r}\nurls \u003c- c(\n  \"https://github.com/KoderKow/pathr1\",\n  \"https://github.com/KoderKow/pathr2\"\n)\n\nx \u003c- parse_url(urls)\n\nx\n\nstr(x)\n```\n\n#### Working with a *pathr* object\n\nBelow are three common methods for turning a lists of lists into a data frame. The base R method is built into the {pathr} package due to it needing no dependencies. The other methods, data.table and dplyr, go over the process for those work flows.\n\n#### Base R\n\n```{r}\npathr_to_df(x)\n```\n\n##### data.table\n\n```r\nd \u003c- data.table::rbindlist(x)\n\n#\u003e Warning message:\n#\u003e In data.table::rbindlist(x) :\n#\u003e   Column 6 ['port'] of item 1 is length 0. This (and 17 others like it) has been filled with NA (NULL for list columns) to make each item uniform.\n```\n\n##### dplyr\n\nThe *pathr* class does not play nicely with `dplyr::bind_rows`. \n\n```r\nd \u003c- \n  x |\u003e \n  dplyr::bind_rows()\n  \n#\u003e Error in `dplyr::bind_rows()`:\n#\u003e ! Argument 1 must be a data frame or a named atomic vector.\n#\u003e Run `rlang::last_error()` to see where the error occurred.\n```\n\nThe function `remove_pathr()` will unclass any *pathr* object or a list containing nothing but *pathr* objects. This makes it easy to move the object into Rs default class, list.\n\n```r\nd \u003c-\n  x |\u003e\n  remove_pathr() |\u003e\n  dplyr::bind_rows()\n```\n\n## Thanks to\n\n- [{httr}](https://github.com/r-lib/httr) package for the code for `parse_url()` and `build_url()`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoderkow%2Fpathr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoderkow%2Fpathr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoderkow%2Fpathr/lists"}