-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.qmd
175 lines (117 loc) · 6.79 KB
/
index.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# Preface {.unnumbered}
::: {.callout-note style="color: blue;"}
#### This is work in progress
At the moment (end of 2024) I am planning four chapters and one annex:
- United Nations `r glossary("M49")` geomscheme classification: 100% (finished)
- World Bank classification: 95%
- World Inequality Database (`r glossary("WID")`): 0%
- World Happiness Report (`r glossary("WHR")`): 0%
- Annex: Used Packages: 5%
:::
::: {.callout-caution}
###### WATCH OUT!
This is my personal learning material. It does not represent an accepted scientific standard nor is the text peer reviewed or otherwise accepted by the scientific community.
:::
## Content and Goals of this Book {.unnumbered}
I am motivated by three reasons to write this book:
1. During my personal research with datasets from countries over the world (concretely working with data from the `r glossary("WID")` and `r glossary("WHR")`) I experienced the problem to analyse and represent this manifold data in a suitable way. With about 250 countries or regions one needs a categorization scheme to summarize the data into plausible groups.
2. I noticed that there are not only different classification systems in place but moreover it was not always clear which countries or regions are member of these groups.
3. I published this text and made it under the [license CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) free available because that forces me to become explicit and explain all my thoughts more carefully.
## Glossary
I am using the {**glossary**} package (see @sec-package-glossary) to create links to glossary
entries . If you hover with your mouse over the double underlined links it opens
an window with the appropriate glossary text. Try this example: `r glossary("IDAx", "IDA")`.
At the end of each chapter I have listed the glossary entries. Sometimes you will find the letter "x" at the end of a glossary abbreviation. The reason for this anomaly is a restriction of the {**glossary**} package: It displays wrong items if the same letter combination is used by another entry and comes first in my alphabetically sorted list of entries. My glossary has for instance the entry of "Cross Val**ida**ted" which would produce a wrong entry because it include the "IDA" abbreviation.
If you fork the [repo of this "Country Classsification" book](https://github.com/petzi53/country-classifications) then the glossary will not work out of the box. Load down the `glossary.yml` file from [my
glossary-pb GitHub
repo](https://github.com/petzi53/glossary-pb/blob/master/glossary.yml),
store it on your hard disk and change the path in the code chunk according to
@lst-preface-load-glossary.
::: my-r-code
::: my-r-code-header
::: {#cnj-load-glossary}
: Load glossary
:::
:::
::: my-r-code-container
```{r}
#| label: load-glossary
#| lst-label: lst-preface-load-glossary
#| lst-cap: "Install and load the glossary package with the appropriate glossary.yml file"
## 1. Install the glossary package:
## https://debruine.github.io/glossary/
library(glossary)
## If you want to use my glossary.yml file:
## 1. fork my repo
## https://github.com/petzi53/glossary-pb
## 2. Download the `glossary.yml` file from
## https://github.com/petzi53/glossary-pb/blob/master/glossary.yml)
## 3. Store the file on your hard disk
## and change the following path accordingly to your configuation
glossary::glossary_path("../glossary-pb/glossary.yml")
```
:::
:::
::: {.callout-caution}
###### The glossary items are not taken uncritically!
The glossary is just my private learning vehicle. The entries are not intended as my suggestions for a textbook or other official accepted definitions. I have added many of the glossary entries when I was working through other books either taking their text passages or taken text via internet inquiries from other resources. Often I have added the source of glossary entry. Sometimes I have used abbreviation for central books I have used for my personal learning career, but I need still to provide a key what these short references mean.
:::
## R Code and Datasets
I am following mainly the [Tidyverse Style Guide](https://style.tidyverse.org/) with two important exceptions inspired by [Google’s R Style Guide](https://google.github.io/styleguide/Rguide.html):
1. Qualify namespace.
2. Start the name of private function with the abbreviation `pb_`.
### Qualifying namespace
To qualify the namespace is important for my personal
learning. Besides preventing conflicts with functions of identical names
from different packages it helps me to learn (or remember) which
function belongs to which package. I think this justifies the small
overhead and helps to make R code chunks self-sufficient. (No previous
package loading, or library calls in the setup chunk.)
To foster learning the relation between function and package I embrace the package
name with curly brakes and format it in bold. Additionally I have added a
special annex file "Used packages" with an alphabetically sorted list of
short package descriptions.
I am using the package name (namespace) also for the default installation of base R packages.
This wouldn't be necessary but it helps me to understand where the base
R functions come from. What follows is a list of base R packages of the
system library included into every installation and attached (opened) by
default:
- {**base**}: The R Base Package
- {**datsets**}: The R Datasets Package
- {**graphics**}: The R Graphics Package
- {**grDevices**}: The R Graphics Devices and Support for Colours and
Fonts
- {**methods**}: Formal Methods and Classes
- {**stats**}: The R Stats Package
- {**utils**}: The R Utils Package
When it is clear then I will follow the advice from Hadley Wickham:
> When you call a function, you typically omit the names of data
> arguments, because they are used so commonly. If you override the
> default value of an argument, use the full name ([tidyverse style
> guide](https://style.tidyverse.org/syntax.html)).
### Private functions
To facilitate my coding I have prepared some private functions. To get a visual clue that they are my own functions their names start with "pb_". They are all collected in the file "R/helper.R" which is sourced at the top of every file (chapter).
My private functions are:
- `pb_create_folder()`: create folder at path
- `pb_save_data_file()`: save data file into "data" folder at path
- `pb_class_scheme()`: list groups with its elements
You will find the descriptions of the parameters and the code with notes in the "helper.R" file.
## Glossary
```{r}
#| label: glossary-table
#| echo: false
glossary::glossary_table()
```
------------------------------------------------------------------------
## Session Info {.unnumbered}
::: my-r-code
::: my-r-code-header
Session Info
:::
::: my-r-code-container
```{r}
#| label: session-info
sessioninfo::session_info()
```
:::
:::