You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a pxweb based statbank system defined aggregations can be used in a JSON query. You can locate relevant aggregations on your chosen site, by looking to "About table" - "API query for this table" after viewing a table on screen with selected aggregation
First the standard way - notice "*" (all) for age:
From the Greenlandic Statbank this query extract the female, greenlandic born population on 1-year age groups:
In a pxweb based statbank system defined aggregations can be used in a JSON query. You can locate relevant aggregations on your chosen site, by looking to "About table" - "API query for this table" after viewing a table on screen with selected aggregation
First the standard way - notice "*" (all) for age:
From the Greenlandic Statbank this query extract the female, greenlandic born population on 1-year age groups:
px_data_female <-
pxweb_get(url = "http://bank.stat.gl/api/v1/en/Greenland/BE/BE01/BE0120/BEXST1.PX",
query = list("age"=c(""),
"gender"=c("2"),
"place of birth"=c("N"),
"time"=c("")))
NEXT use and compare agg-file and you get the aggregation in return:
if(!require(pxweb)){install.packages("pxweb")}
library(pxweb)
q_f <- '{"query": [{"code": "age","selection": {"filter": "agg:5-year.agg", "values": ["-4","5-9","10-14","15-19","20-24","25-29","30-34","35-39","40-44","45-49","50-54","55-59","60-64","65-69","70-74","75-79","80-84","85-89","90-94","95+"]}},{"code": "place of birth","selection": {"filter": "item","values": ["N"]}},{"code": "gender","selection": {"filter": "item","values": ["2"]}},{"code": "time","selection": {"filter": "all","values": ["*"]}}],"response": {"format": "px"}}'
px_data_female <-
pxweb_get(url = "http://bank.stat.gl/api/v1/en/Greenland/BE/BE01/BE0120/BEXST1.PX",
query = q_f)
px_data_female <- as.data.frame(px_data_female, column.name.type = "text", variable.value.type = "code")
matrix_female <- matrix(data = px_data_female$
Population January 1st
, ncol = 43, byrow = TRUE )The text was updated successfully, but these errors were encountered: