Skip to content

Commit c3d556b

Browse files
committed
Add article in package website
1 parent 5b50c6a commit c3d556b

File tree

2 files changed

+272
-0
lines changed

2 files changed

+272
-0
lines changed

vignettes/articles/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.html
2+
*.R
Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
---
2+
title: "Accessing culture datasets with the eurostat package"
3+
date: "`r Sys.Date()`"
4+
---
5+
6+
```{r, include = FALSE}
7+
knitr::opts_chunk$set(
8+
collapse = TRUE,
9+
comment = "#>"
10+
)
11+
```
12+
13+
# Introduction
14+
15+
The eurostat package can be used to access datasets related to various facets of life. Datasets belonging to the culture sector are scattered across different database tables. Eurostat has collected datasets related to the cultural sector, for example datasets that are related to culture, music, and literature, in a special section in their website: [https://ec.europa.eu/eurostat/web/culture/database/data-domain](https://ec.europa.eu/eurostat/web/culture/database/data-domain).
16+
17+
Downloading these datasets manually is demonstrated in this article.
18+
19+
# Loading the eurostat R package
20+
21+
```{r setup}
22+
library(eurostat)
23+
```
24+
25+
# Dataset examples
26+
27+
## EU Labour Force Survey (EU-LFS)
28+
29+
Download like this:
30+
31+
```{r eu-lfs}
32+
# J59: Motion picture, video and television programme production,
33+
# sound recording and music publishing activities
34+
# R90: Creative, arts and entertainment activities
35+
# R91: Libraries, archives, museums and other cultural activities
36+
37+
stats <- get_eurostat(
38+
"lfsq_egan22d",
39+
filters =
40+
list(
41+
nace_r2 = c("R90", "R91", "J59")
42+
)
43+
)
44+
stats_label <- label_eurostat(stats, code = "nace_r2")
45+
```
46+
47+
Quick glance at dataset:
48+
49+
```{r}
50+
head(stats)
51+
```
52+
53+
Quick glance at labeled dataset:
54+
55+
```{r}
56+
head(stats_label)
57+
```
58+
59+
Variable names:
60+
61+
```{r}
62+
label_eurostat_vars(names(stats), id = "lfsq_egan22d")
63+
```
64+
65+
## Structured business statistics (SBS)
66+
67+
First we must ask the question: What are music-related goods and services in the vast sea of structured business statistics? From the [Eurostat website](https://ec.europa.eu/eurostat/web/culture/database/data-domain#Business%20statistics) documentation:
68+
69+
>"No data collection specifically on music exists. The various EU harmonised surveys and data collections include only a few items of information on the topic.
70+
>
71+
>A difficulty with those is that statistical classifications and variables often do not differentiate music from other cultural activities in broader categories, such as live performances, or artistic creation."
72+
73+
Two concrete examples are given: Sound recording and music publishing activities (NACE code 59.2) and Manufacture of musical instruments (NACE code 32.2).
74+
75+
### Sound recording and music publishing activities (NACE code 59.2)
76+
77+
```{r}
78+
# J592: Sound recording and music publishing activities
79+
music_business1 <- get_eurostat(
80+
id = "sbs_na_1a_se_r2",
81+
filters =
82+
list(
83+
indic_sb = c("V11110", "V12110", "V12120",
84+
"V12150", "12170"),
85+
nace_r2 = c("J592")
86+
)
87+
)
88+
head(music_business1)
89+
```
90+
91+
### Manufacture of musical instruments (NACE code 32.2)
92+
93+
```{r}
94+
music_business2 <- get_eurostat(
95+
id = "sbs_na_ind_r2",
96+
filters =
97+
list(
98+
indic_sb = c("V11110", "V12110", "V12120",
99+
"V12130", "12150"),
100+
nace_r2 = c("C322")
101+
)
102+
)
103+
head(music_business2)
104+
# Or
105+
# music_business2 <- get_eurostat(
106+
# id = "sbs_na_ind_r2",
107+
# filters = list(
108+
# indic_sb = c("V11110", "V12110", "V12120",
109+
# "V12130", "12150"),
110+
# nace_r2 = c("C3220")
111+
# )
112+
# )
113+
```
114+
115+
### Music-related goods production
116+
117+
Also, database on the production of various goods contains information about production of music-related goods, such as instruments and recorded media.
118+
119+
The code to download the dataset:
120+
121+
```{r sbs}
122+
stats <- get_eurostat("lfsq_egan22d",
123+
filters =
124+
list(nace_r2 = c("R90", "R91", "J59")))
125+
stats_label <- label_eurostat(stats, code = "nace_r2")
126+
```
127+
128+
## International trade in goods statistics (ITGS) (OM_dataset_sec_eurostat_003)
129+
130+
What, then, are these specified music-related goods? From [Eurostat website](https://ec.europa.eu/eurostat/web/culture/database/data-domain#International%20trade):
131+
132+
>"The domain of international trade in goods includes annual data on trade of musical instruments and parts of thereof.
133+
>
134+
>Since 2017, data on recorded media containing only music have not been collected as a separate category. In statistics on international trade in services, music items are included in the existing categories:
135+
>
136+
>- audio-visual services
137+
>- artistic services
138+
>- licences"
139+
140+
(Source: [https://ec.europa.eu/eurostat/web/culture/database/data-domain#International%20trade](https://ec.europa.eu/eurostat/web/culture/database/data-domain#International%20trade))
141+
142+
Download:
143+
144+
```{r}
145+
stats <- get_eurostat("ext_lt_intertrd")
146+
stats_label <- label_eurostat(stats, code = "sitc06")
147+
```
148+
149+
```{r}
150+
# C322: Manufacture of musical instruments
151+
stats <- get_eurostat("ext_tec09", filters = list(nace_r2 = "C322"))
152+
```
153+
154+
## Data by domain: Culture
155+
156+
### Music
157+
158+
Original information can be found here: [https://ec.europa.eu/eurostat/web/culture/database/data-domain](https://ec.europa.eu/eurostat/web/culture/database/data-domain)
159+
160+
### Employment
161+
162+
There is an Excel file that contains the number of persons employed as musicians, singers and composers (ISCO code 2652, main job) in years 2019-2021.
163+
164+
2 NACE codes could be used to collect data from EU labour force survey (EU-LFS) statistics:
165+
166+
- sound recording and music publishing activities (59.2)
167+
- manufacture of musical instruments (32.2)
168+
169+
170+
## Business statistics
171+
172+
### Sound recording and music publishing activities (NACE code 59.2)
173+
174+
```{r}
175+
music_business1 <- get_eurostat(
176+
id = "sbs_na_1a_se_r2",
177+
filters =
178+
list(
179+
indic_sb = c("V11110", "V12110", "V12120",
180+
"V12150", "12170"),
181+
nace_r2 = c("J592")
182+
)
183+
)
184+
head(music_business1)
185+
```
186+
187+
### Manufacture of musical instruments
188+
189+
```{r}
190+
music_business2 <- get_eurostat(
191+
id = "sbs_na_ind_r2",
192+
filters =
193+
list(
194+
indic_sb = c("V11110", "V12110", "V12120",
195+
"V12130", "12150"),
196+
nace_r2 = c("C322")
197+
)
198+
)
199+
head(music_business2)
200+
# Or
201+
# music_business2 <- get_eurostat(
202+
# id = "sbs_na_ind_r2",
203+
# filters = list(
204+
# indic_sb = c("V11110", "V12110", "V12120",
205+
# "V12130", "12150"),
206+
# nace_r2 = c("C3220")
207+
# )
208+
# )
209+
```
210+
211+
### Music-related goods production
212+
213+
Downloading PRODCOM data is is done via different route than the usual datasets and the functionality is currently experimental. The logic of the functions, however, is identical to the currently existing functions. Here is a non-functional example of how the workflow should look:
214+
215+
```{r remotes-example, eval=FALSE}
216+
remotes::install_github("ropengov/eurostat", ref = "v4.1")
217+
```
218+
219+
```{r prodcom-example, eval=FALSE}
220+
prodcom <- get_eurostat_sdmx(
221+
id = "DS-059359",
222+
compressed = FALSE,
223+
agency = "eurostat_comext",
224+
filters =
225+
list(
226+
FREQ = c("A"),
227+
product = c("18121920", "18201010", "18201030",
228+
"18201050", "18201070", "18202050",
229+
"18202070", "32201110", "32201130",
230+
"32201150", "32201200", "32201310",
231+
"32201340", "32201370", "32201400",
232+
"32201510", "32201530", "32201600",
233+
"32202000"),
234+
DECL = c("001", "003", "004", "005", "006",
235+
"007", "008", "009", "010", "011",
236+
"017", "018", "024", "028", "030",
237+
"032", "038", "046", "052", "053",
238+
"054", "055", "060", "061", "063",
239+
"064", "066", "068", "091", "092",
240+
"093", "096", "097", "098", "2027",
241+
"600"),
242+
INDICATORS = c("PRODVAL"),
243+
PRCCODE = c("18121920", "18201010", "18201030",
244+
"18201050", "18201070", "18202050",
245+
"18202070", "32201110", "32201130",
246+
"32201150", "32201200", "32201310",
247+
"32201340", "32201370", "32201400",
248+
"32201510", "32201530", "32201600",
249+
"32202000")))
250+
251+
prodcom_labeled <- label_eurostat_sdmx(
252+
x,
253+
agency = "eurostat_comext",
254+
id = "DS-056120"
255+
)
256+
```
257+
258+
The URL to this custom dataset: https://ec.europa.eu/eurostat/databrowser/view/DS-056120__custom_4088056/bookmark/table?lang=en&bookmarkId=a25712df-96d0-445a-95d6-4b807e83be43
259+
260+
# Session info
261+
262+
```{r}
263+
sessionInfo()
264+
```
265+
266+
267+
268+
269+
270+

0 commit comments

Comments
 (0)