{"id":18591868,"url":"https://github.com/sdsc-ordes/pxrread","last_synced_at":"2025-09-25T22:04:26.407Z","repository":{"id":97391169,"uuid":"604011219","full_name":"sdsc-ordes/pxRRead","owner":"sdsc-ordes","description":"Multilingual Parser for the px file format: https://www.scb.se/en/services/statistical-programs-for-px-files/px-file-format/","archived":false,"fork":false,"pushed_at":"2023-09-19T04:23:57.000Z","size":3465,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-25T22:04:23.920Z","etag":null,"topics":["cube","library","parsing","px","statistical-data"],"latest_commit_sha":null,"homepage":"https://sdsc-ord.github.io/pxRRead/","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/sdsc-ordes.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2023-02-20T06:24:18.000Z","updated_at":"2023-11-29T18:11:53.000Z","dependencies_parsed_at":"2023-12-14T09:59:28.933Z","dependency_job_id":null,"html_url":"https://github.com/sdsc-ordes/pxRRead","commit_stats":null,"previous_names":["sdsc-ordes/pxrread"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sdsc-ordes/pxRRead","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsc-ordes%2FpxRRead","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsc-ordes%2FpxRRead/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsc-ordes%2FpxRRead/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsc-ordes%2FpxRRead/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdsc-ordes","download_url":"https://codeload.github.com/sdsc-ordes/pxRRead/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsc-ordes%2FpxRRead/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276987463,"owners_count":25740582,"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-09-25T02:00:09.612Z","response_time":80,"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":["cube","library","parsing","px","statistical-data"],"created_at":"2024-11-07T01:05:18.747Z","updated_at":"2025-09-25T22:04:26.373Z","avatar_url":"https://github.com/sdsc-ordes.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pxRRead\n\n\u003c!-- badges: start --\u003e\n[![Codecov test coverage](https://codecov.io/gh/SDSC-ORD/pxRRead/branch/main/graph/badge.svg)](https://app.codecov.io/gh/SDSC-ORD/pxRRead?branch=main)\n[![R-CMD-check](https://github.com/SDSC-ORD/pxRRead/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/SDSC-ORD/pxRRead/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\n## About\n\nThe px file format is a format for offering statistical tables\nin an interactive way. It was introduced by the Statistics office of Sweden and is also used by statistical offices in other countries.\n\nSee here for a specification of this format: [px file format specification](https://www.scb.se/en/services/statistical-programs-for-px-files/px-file-format/)\n\nThe goal of pxRRead is parse px cube files:\n\n* from a download url for a px cube file\n* from a px cube file that has been downloaded previously\n\n## Installation\n\nYou can install the development version of `pxRRead` with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"SDSC-ORD/pxRRead\")\n```\n\n## Usage\n\n``` r\nlibrary(pxRRead)\nscan_px_file('px-x-0102020203_110.px')\nscan_px_file('https://www.pxweb.bfs.admin.ch/DownloadFile.aspx?file=px-x-0602000000_107')\n```\n\n## Output\n\nThe goal of this package is to prepare the data and metadata for data science\napplications. This package is especially meant to also support large \nmultilingual px files and allow to localize them to a supported language.\n\nThe output consist of a list of data and metadata:\n\n* `output$metadata` includes all metadata in the default language\n* `output$dataframe` is a tibble with the length of the `DATA` of the px cube\n* The dimensions in \"STUB\" and \"HEADING\" of the px cube are all turned into columns of the tibble\n\n``` r\noutput \u003c- scan_px_file('https://www.pxweb.bfs.admin.ch/DownloadFile.aspx?file=px-x-0602000000_107')\noutput$metadata\noutput$dataframe\n```\n\n### Option to localize the output for multilingual px cubes\n\nIf the px cube is multilingual: a locale can be specified with `locale=\u003clanguage code\u003e` to localize the output: then the metadata and dataframe will use the translations for the given locale.\n\nThe language code must match the language code used in the px cube and specified with the `LANGUAGES` keyword. \n\n``` r\noutput \u003c- scan_px_file(\n  'https://www.pxweb.bfs.admin.ch/DownloadFile.aspx?file=px-x-0602000000_107',\n  locale=\"en\"\n)\noutput$metadata\noutput$dataframe\n```\n\n### Examples\n\nIn `scripts` directory there are examples to run. Most example are from \nthe Swiss Federal Office of Statistics: `/scripts/bfs_px_files.R` but there \nis also a script `/scripts/other_px_files.R` for other px files. These\nscripts include complete examples. They are meant for further exploration of the output of this package.\n\n### Warnings and Restrictions\n\n#### Encoding\n\nEven though there is a `CODE_PAGE` specified in the px file the specified encoding does not always work to parse the file correctly with `scan` and `fileEncoding`. Therefor the encoding has been added as a parameter: `encoding`. The default is `latin1`. So if the file encoding seems incorrect it can be changed to `UTF-8`:\n\n``` r\noutput \u003c- scan_px_file(\n  'https://www.pxweb.bfs.admin.ch/DownloadFile.aspx?file=px-x-1002020000_101',\n  locale = \"de\",\n  encoding = \"UTF-8\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdsc-ordes%2Fpxrread","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdsc-ordes%2Fpxrread","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdsc-ordes%2Fpxrread/lists"}