This guide provides a basic overview of the use of the csodata package for new users. Install (if necessary) and load the package:
A list of all the table available on the cso StatBank can be downloaded with cso_get_toc
. You can search throught the title field using cso_search_toc
. (A “Loaded cached toc” or “Loaded cached data” message indicates that the data was retrieved from the cache, instead of being downloaded again.)
toc <- cso_get_toc()
#> Loaded cached toc
head(toc)
#> id LastModified
#> 1 A0101 2018-03-14 11:01:00
#> 2 A0102 2018-03-13 13:50:00
#> 3 A0103 2018-03-13 13:50:00
#> 4 A0104 2018-03-13 13:50:00
#> 5 A0105 2018-03-13 13:50:00
#> 6 A0106 2018-03-13 13:50:00
#> title
#> 1 1996 Population and Percentage Change 1991 and 1996 by Province County or City, CensusYear and Statistic
#> 2 1996 Population at Each Census Since 1841 by Sex, Province or County and CensusYear
#> 3 1996 Population by Sex, Aggregate Town or Rural Area, Province County or City and CensusYear
#> 4 Population by Sex, Regional Authority, CensusYear and Statistic
#> 5 1996 Population and Percentage Change 1996 and 2002 by Towns by Electoral Division, CensusYear and Statistic
#> 6 1996 Population Density and Area Size by Electoral Division, CensusYear and Statistic
To download a dataset, use cso_get_data
.
Metadata can be also downloaded or displayed to console:
meta1 <- cso_get_meta("CDP06")
#> Loaded cached data
cso_disp_meta("CDP06")
#> Loaded cached data
#> *** METADATA ***
#> CSO Table = Annual Estimated Net Migration 1951 to 2011 per 1,000 of Average Population by Intercensal Period, Province or County and Year
#> Units = numeric
#> Source = Central Statistics Office, Ireland
#> Time interval in data = Year
#> Date downloaded from statbank = 2020-03-04T12:03:20Z
#> Date last modified = 2012-07-03 11:47:00
#> Variables:
#> [1] "Intercensal Period" "Province or County" "Year"
#>
#> Statistics:
#> [1] "Annual Estimated Net Migration 1951 to 2011 per 1,000 of Average Population (Number)"
Geographic vector data in ESRI shapefile format can be downloaded for use in mapping. This uses the older 2011 data, which includes demographic information. Newer maps, including the revisions to the NUTS regions made in 2016, is also available.
This data can be plotted using the tmap
package. Here we plot the 2011 population, which is included as the “TOTAL2011” column in the map data.