From 0ed25d97a38864173c15bed2b1036962523ddf51 Mon Sep 17 00:00:00 2001
From: Mans Magnusson This R package provides tools to access PX-WEB API.
+ This R package provides tools to access PX-WEB API.
Your contributions and bug reports and other
feedback are welcome! We can find more information on the PX-Web/PC-Axis API here.2022-10-31
-Available data sources and tools
You can browse the available data sets at:
## PXWEB METADATA
-## Population by region, marital status, age, sex, observations and year
+## Population by region, marital status, age, sex, observations and year
## variables:
## [[1]] Region: region
## [[2]] Civilstand: marital status
@@ -840,7 +840,7 @@ Downloading data
as.matrix
.
<- as.matrix(pxd, column.name.type = "code", variable.value.type = "code")
pxmat head(pxmat)
-## Civilstand Kon Tid BE0101N1
+## Civilstand Kon Tid BE0101N1
## [1,] "OG" "1" "2015" "2762601"
## [2,] "OG" "1" "2016" "2820248"
## [3,] "OG" "1" "2017" "2870477"
@@ -868,14 +868,14 @@ Citation
pxweb_data
object using the pxweb_cite()
function. For full reproducibility, please also cite the package.
pxweb_cite(pxd)
-##
+##
## Statistics Sweden (2022). "Population by region, marital status, age,
## sex, observations and year." [Data accessed 2022-10-31 10:01:52 using
## pxweb R package 0.16.2],
## <https://api.scb.se/OV0104/v1/doris/en/ssd/BE/BE0101/BE0101A/BefolkningNy>.
-##
+##
## A BibTeX entry for LaTeX users is
-##
+##
## @Misc{,
## title = {Population by region, marital status, age, sex, observations and year},
## author = {{Statistics Sweden}},
@@ -885,18 +885,18 @@ Citation
## url = {https://api.scb.se/OV0104/v1/doris/en/ssd/BE/BE0101/BE0101A/BefolkningNy},
## note = {[Data accessed 2022-10-31 10:01:52 using pxweb R package 0.16.2]},
## }
-##
-##
-##
-##
+##
+##
+##
+##
## Kindly cite the pxweb R package as follows:
-##
+##
## Mans Magnusson, Markus Kainu, Janne Huovari, and Leo Lahti
## (rOpenGov). pxweb: R tools for PXWEB API. URL:
## http://github.com/ropengov/pxweb
-##
+##
## A BibTeX entry for LaTeX users is
-##
+##
## @Misc{,
## title = {pxweb: R tools for PX-WEB API},
## author = {Mans Magnusson and Markus Kainu and Janne Huovari and Leo Lahti},
@@ -921,34 +921,34 @@ Session info
## R version 4.2.1 (2022-06-23)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur ... 10.16
-##
+##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
-##
+##
## locale:
## [1] C/sv_SE.UTF-8/sv_SE.UTF-8/C/sv_SE.UTF-8/sv_SE.UTF-8
-##
+##
## attached base packages:
-## [1] stats graphics grDevices utils datasets methods base
-##
+## [1] stats graphics grDevices utils datasets methods base
+##
## other attached packages:
## [1] pxweb_0.16.2
-##
+##
## loaded via a namespace (and not attached):
-## [1] jquerylib_0.1.4 bslib_0.3.1 pillar_1.7.0 compiler_4.2.1
-## [5] prettyunits_1.1.1 remotes_2.4.2 tools_4.2.1 digest_0.6.29
-## [9] pkgbuild_1.3.1 pkgload_1.3.0 evaluate_0.15 jsonlite_1.8.0
-## [13] memoise_2.0.1 lifecycle_1.0.1 tibble_3.1.7 checkmate_2.1.0
-## [17] pkgconfig_2.0.3 rlang_1.0.3 cli_3.3.0 rstudioapi_0.13
-## [21] curl_4.3.2 yaml_2.3.5 xfun_0.31 fastmap_1.1.0
-## [25] httr_1.4.3 withr_2.5.0 stringr_1.4.0 roxygen2_7.2.0
-## [29] knitr_1.39 xml2_1.3.3 sass_0.4.1 desc_1.4.1
-## [33] fs_1.5.2 vctrs_0.4.1 devtools_2.4.3 rprojroot_2.0.3
-## [37] glue_1.6.2 R6_2.5.1 processx_3.6.1 fansi_1.0.3
-## [41] rmarkdown_2.14 sessioninfo_1.2.2 callr_3.7.0 purrr_0.3.4
-## [45] magrittr_2.0.3 htmltools_0.5.2 backports_1.4.1 ps_1.7.1
-## [49] ellipsis_0.3.2 usethis_2.1.6 utf8_1.2.2 stringi_1.7.6
+## [1] jquerylib_0.1.4 bslib_0.3.1 pillar_1.7.0 compiler_4.2.1
+## [5] prettyunits_1.1.1 remotes_2.4.2 tools_4.2.1 digest_0.6.29
+## [9] pkgbuild_1.3.1 pkgload_1.3.0 evaluate_0.15 jsonlite_1.8.0
+## [13] memoise_2.0.1 lifecycle_1.0.1 tibble_3.1.7 checkmate_2.1.0
+## [17] pkgconfig_2.0.3 rlang_1.0.3 cli_3.3.0 rstudioapi_0.13
+## [21] curl_4.3.2 yaml_2.3.5 xfun_0.31 fastmap_1.1.0
+## [25] httr_1.4.3 withr_2.5.0 stringr_1.4.0 roxygen2_7.2.0
+## [29] knitr_1.39 xml2_1.3.3 sass_0.4.1 desc_1.4.1
+## [33] fs_1.5.2 vctrs_0.4.1 devtools_2.4.3 rprojroot_2.0.3
+## [37] glue_1.6.2 R6_2.5.1 processx_3.6.1 fansi_1.0.3
+## [41] rmarkdown_2.14 sessioninfo_1.2.2 callr_3.7.0 purrr_0.3.4
+## [45] magrittr_2.0.3 htmltools_0.5.2 backports_1.4.1 ps_1.7.1
+## [49] ellipsis_0.3.2 usethis_2.1.6 utf8_1.2.2 stringi_1.7.6
## [53] cachem_1.0.6 crayon_1.5.1
From cb02d5c794808d0a621dc5ac134adffa9e5e3e10 Mon Sep 17 00:00:00 2001
From: Mans Magnusson
Date: Sat, 13 Jan 2024 20:14:23 +0100
Subject: [PATCH 2/2] Minor fix S3 consistency
---
R/pxweb_as_data_frame.R | 6 +++---
man/pxweb_as_data_frame.Rd | 24 +++++++++++++++++++++---
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/R/pxweb_as_data_frame.R b/R/pxweb_as_data_frame.R
index f1d0172a..677f0091 100644
--- a/R/pxweb_as_data_frame.R
+++ b/R/pxweb_as_data_frame.R
@@ -46,7 +46,7 @@ pxweb_as_data_frame.pxweb_data <- function(x, row.names = NULL, optional = FALSE
#' @rdname pxweb_as_data_frame
#' @export
-pxweb_as_data_frame.pxweb_data_comments <- function(x, optional = FALSE, ..., stringsAsFactors = FALSE) {
+pxweb_as_data_frame.pxweb_data_comments <- function(x, row.names = NULL, optional = FALSE, ..., stringsAsFactors = FALSE) {
checkmate::assert_flag(optional)
checkmate::assert_flag(stringsAsFactors)
@@ -73,7 +73,7 @@ pxweb_as_data_frame.pxweb_data_comments <- function(x, optional = FALSE, ..., st
#' @rdname pxweb_as_data_frame
#' @export
-pxweb_as_data_frame.pxweb_data_comment <- function(x, optional = FALSE, ..., stringsAsFactors = FALSE) {
+pxweb_as_data_frame.pxweb_data_comment <- function(x, row.names = NULL, optional = FALSE, ..., stringsAsFactors = FALSE) {
checkmate::assert_flag(optional)
checkmate::assert_flag(stringsAsFactors)
@@ -93,7 +93,7 @@ pxweb_as_data_frame.pxweb_data_comment <- function(x, optional = FALSE, ..., str
#' @rdname pxweb_as_data_frame
#' @export
-pxweb_as_data_frame.pxweb_levels <- function(x, optional = FALSE, ..., stringsAsFactors = FALSE) {
+pxweb_as_data_frame.pxweb_levels <- function(x, row.names = NULL, optional = FALSE, ..., stringsAsFactors = FALSE) {
checkmate::assert_flag(optional)
checkmate::assert_flag(stringsAsFactors)
diff --git a/man/pxweb_as_data_frame.Rd b/man/pxweb_as_data_frame.Rd
index ba0a3ca9..f69f4e7c 100644
--- a/man/pxweb_as_data_frame.Rd
+++ b/man/pxweb_as_data_frame.Rd
@@ -36,11 +36,29 @@ pxweb_as_data_frame(
variable.value.type = "text"
)
-\method{pxweb_as_data_frame}{pxweb_data_comments}(x, optional = FALSE, ..., stringsAsFactors = FALSE)
+\method{pxweb_as_data_frame}{pxweb_data_comments}(
+ x,
+ row.names = NULL,
+ optional = FALSE,
+ ...,
+ stringsAsFactors = FALSE
+)
-\method{pxweb_as_data_frame}{pxweb_data_comment}(x, optional = FALSE, ..., stringsAsFactors = FALSE)
+\method{pxweb_as_data_frame}{pxweb_data_comment}(
+ x,
+ row.names = NULL,
+ optional = FALSE,
+ ...,
+ stringsAsFactors = FALSE
+)
-\method{pxweb_as_data_frame}{pxweb_levels}(x, optional = FALSE, ..., stringsAsFactors = FALSE)
+\method{pxweb_as_data_frame}{pxweb_levels}(
+ x,
+ row.names = NULL,
+ optional = FALSE,
+ ...,
+ stringsAsFactors = FALSE
+)
\method{as.data.frame}{pxweb_data}(
x,