Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (19.2%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
pxmake: Make PX-Files in R
Basic Info
- Host: GitHub
- Owner: StatisticsGreenland
- License: other
- Language: R
- Default Branch: main
- Homepage: https://statisticsgreenland.github.io/pxmake/
- Size: 141 MB
Statistics
- Stars: 9
- Watchers: 2
- Forks: 6
- Open Issues: 29
- Releases: 20
Created over 3 years ago
· Last pushed about 1 year ago
Metadata Files
Readme
Changelog
License
README.Rmd
---
output: github_document
editor_options:
chunk_output_type: console
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# pxmake
[](https://cran.r-project.org/package=pxmake)

[](https://app.codecov.io/gh/StatisticsGreenland/pxmake?branch=main)
[](https://github.com/SNStatComp/awesome-official-statistics-software)
[](https://cran.r-project.org/package=pxmake)
## Overview
‘pxmake’ is an R package for creating and modifying PX-files.
With pxmake you can:
- Import a PX-file, modify it, and save it as a new PX-file.
- Modify all metadata keywords in a PX-file.
- Do complex modifications to a PX-file, like adding total levels to a
variable.
- Save a PX-file as an Excel workbook.
## Installation
``` r
# Install the latest release from CRAN
install.packages('pxmake')
# Or the development version from GitHub
# install.packages('pak')
pak::pak("StatisticsGreenland/pxmake")
```
## How to use
*(Find complete documentation on [pxmake webpage](https://statisticsgreenland.github.io/pxmake/).)*
Use `px()` to import an existing PX-file into R.
```{r include=FALSE, messages = FALSE}
library(pxmake)
set.seed(1)
```
```{r, eval = FALSE}
library(pxmake)
# Import PX-file
x <- px(input = "example.px")
```
Once imported, use one of pxmake's *modifying functions*.
In general, modifying functions are named after the keyword they modify. It's possible to chain multiple modifying functions together in tidyverse style by using the pipe operator `%>%`.
```{r}
library(magrittr) # import pipe
# Create px object from data frame
x <- px(data.frame(year = as.character(rep(2021:2023, each = 3)),
group = c('a', 'b', 'c'),
value = runif(9)
)
)
head(x$data, 4)
x %>%
px_timeval("year") %>% # Set year as TIMEVAL
px_heading("year") %>% # Set year as HEADING
px_stub("group") %>% # Set group as STUB
px_decimals("2") %>% # Set DECIMALS to 2
px_save("example.px") # Save as PX-file
```
```{r echo = FALSE}
unlink("example.px")
```
### Modifying functions
```{r, include = FALSE}
priority1 <- c("AXIS-VERSION", "CODEPAGE", "CODES", "CONTACT", "CONTENTS", "CONTVARIABLE", "COPYRIGHT", "DATA", "DESCRIPTION", "DOMAIN", "ELIMINATION", "LANGUAGE", "LANGUAGES", "MAP", "NOTE", "NOTEX", "PRECISION", "SHOWDECIMALS", "SOURCE", "STOCKFA", "SUBJECT-AREA", "SUBJECT-CODE", "TABLEID", "UNITS", "UPDATE-FREQUENCY", "VALUENOTE", "VALUENOTE", "VALUENOTEX", "VALUES", "VARIABLE-TYPE", "VARIABLECODE")
priority2 <- c("BASEPERIOD", "CELLNOTE", "CELLNOTEX", "CFPRICES", "CONFIDENTIAL")
easy <- c("AGGREGALLOWED", "AUTOPEN", "AXIS-VERSION", "CODEPAGE", "CONFIDENTIAL", "COPYRIGHT", "NEXT-UPDATE", "SHOWDECIMALS", "SUBJECT-CODE", "TABLEID", "UPDATE-FREQUENCY", "CFPRICES", "DATA", "MAP", "STOCKFA")
medium <- c("CONTACT", "CONTENTS", "DESCRIPTION", "LAST-UPDATED", "LINK", "SOURCE", "SUBJECT-AREA", "TITLE", "UNITS", "DOMAIN", "ELIMINATION", "PRECISION", "VALUENOTE", "VALUENOTEX")
hard <- c("LANGUAGE", "LANGUAGES", "CONTVARIABLE", "NOTE", "NOTEX", "BASEPERIOD", "CELLNOTE", "CELLNOTEX", "VALUES", "VARIABLE-TYPE")
dont_implement <- c("CODES", "VARIABLECODE")
modifying_functions <-
readLines('NAMESPACE') %>%
stringr::str_match("S3method\\((?.*),px\\)") %>%
as.data.frame() %>%
tidyr::drop_na() %>%
dplyr::pull("function")
status <-
px_keywords %>%
as.data.frame() %>%
dplyr::select(Keyword = keyword) %>%
dplyr::mutate(`Function name` = paste0("px_", gsub("-", "_", tolower(Keyword))),
implemented = `Function name` %in% modifying_functions
) %>%
dplyr::mutate(Priority =
dplyr::case_when(
Keyword %in% priority1 ~ "**",
Keyword %in% priority2 ~ "*",
TRUE ~ ""
),
Complexity =
dplyr::case_when(
Keyword %in% easy ~ "Easy",
Keyword %in% medium ~ "Medium",
Keyword %in% hard ~ "Hard",
TRUE ~ ""
)
) %>%
dplyr::arrange(dplyr::across(everything()))
implemented <- dplyr::filter(status, implemented)
not_implemented <- dplyr::filter(status, !implemented & !Keyword %in% dont_implement)
wont_implement <- dplyr::filter(status, Keyword %in% dont_implement)
non_keyword_modifying_functions <-
dplyr::tibble(`Function name` = setdiff(modifying_functions, status %>% dplyr::pull(`Function name`))) %>%
as.data.frame()
```
Currently the following `r nrow(implemented)` keywords have a modifying function in pxmake:
```{r, echo = FALSE}
implemented %>%
dplyr::select(Keyword, `Function name`) %>%
print(row.names = FALSE, right = FALSE)
```
In addition to the above, the following `r nrow(non_keyword_modifying_functions)` modifying functions are available:
```{r, echo = FALSE}
non_keyword_modifying_functions %>%
print(row.names = FALSE, right = FALSE)
```
See the help page for each modifying function for more information.
Keywords without modifying functions
These `r nrow(not_implemented)` keywords currently doesn't have a modifying function, but can be implemented.
```{r, echo = FALSE}
not_implemented %>%
dplyr::select(-implemented) %>%
print(row.names = FALSE, right = FALSE)
```
Finally these `r nrow(wont_implement)` keywords will not have a modifying function, because they are automatically determined by the data.
```{r, echo = FALSE}
wont_implement %>%
dplyr::select(Keyword) %>%
print(row.names = FALSE, right = FALSE)
```
## Need help?
If you have any questions or need help, feel free to [open an issue](https://github.com/StatisticsGreenland/pxmake/issues/new) on GitHub, or contact [Lars and Johan](https://github.com/StatisticsGreenland/pxmake/graphs/contributors) via email.
## For developers
### PX specification
pxmake is based on the [PX-file format specification on Statistics Swedens homepage](https://www.scb.se/globalassets/vara-tjanster/px-programmen/px-file_format_specification_2013.pdf).
### PxJob
Some tests cases uses [PxJob](https://stat.fi/tup/tilastotietokannat/px-tuoteperhe_en.html). Install [pxjob64Win](https://github.com/StatisticsGreenland/pxjob64Win) to be able ro run these tests. This only works on Windows.
### How to create a new release
1. Run `usethis::use_release_issue()` and follow checklist.
2. Sync fork on [PxTools/pxmake](https://github.com/PxTools/pxmake).
Owner
- Name: Statistics Greenland
- Login: StatisticsGreenland
- Kind: organization
- Email: stat@stat.gl
- Website: stat.gl
- Repositories: 3
- Profile: https://github.com/StatisticsGreenland
is the national statistical authority of Greenland
GitHub Events
Total
- Create event: 42
- Release event: 5
- Issues event: 142
- Watch event: 6
- Issue comment event: 103
- Push event: 248
- Pull request event: 76
- Fork event: 2
Last Year
- Create event: 42
- Release event: 5
- Issues event: 142
- Watch event: 6
- Issue comment event: 103
- Push event: 248
- Pull request event: 76
- Fork event: 2
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 169
- Total pull requests: 71
- Average time to close issues: 3 months
- Average time to close pull requests: 2 days
- Total issue authors: 6
- Total pull request authors: 3
- Average comments per issue: 0.59
- Average comments per pull request: 0.01
- Merged pull requests: 64
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 68
- Pull requests: 40
- Average time to close issues: 8 days
- Average time to close pull requests: 2 days
- Issue authors: 6
- Pull request authors: 2
- Average comments per issue: 0.82
- Average comments per pull request: 0.0
- Merged pull requests: 39
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- johan-ejstrud (134)
- larpSTATGL (26)
- gnpe-nuuk (4)
- BDP0 (3)
- amoeba (1)
- larsjohansoderberg-design (1)
Pull Request Authors
- johan-ejstrud (69)
- amoeba (1)
- larpSTATGL (1)
Top Labels
Issue Labels
bug (28)
enhancement (18)
documentation (11)
question (3)
delete? (3)
micromake (2)
excel (2)
nunatta (1)
validate_px (1)
aggregation (1)
Pull Request Labels
documentation (1)
enhancement (1)
Packages
- Total packages: 1
-
Total downloads:
- cran 599 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 5
- Total maintainers: 1
cran.r-project.org: pxmake
Make PX-Files in R
- Homepage: https://github.com/StatisticsGreenland/pxmake
- Documentation: http://cran.r-project.org/web/packages/pxmake/pxmake.pdf
- License: MIT + file LICENSE
-
Latest release: 0.18.0
published about 1 year ago
Rankings
Dependent packages count: 27.4%
Dependent repos count: 33.7%
Average: 49.3%
Downloads: 86.9%
Maintainers (1)
Last synced:
11 months ago
Dependencies
.github/workflows/R-CMD-check.yml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION
cran
- dplyr * imports
- magrittr * imports
- readxl * imports
- rlang * imports
- stringr * imports
- tibble * imports
- tidyr * imports
- testthat >= 3.0.0 suggests