-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpreface.qmd
More file actions
488 lines (335 loc) · 31.1 KB
/
preface.qmd
File metadata and controls
488 lines (335 loc) · 31.1 KB
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
::: {.content-visible when-format="pdf"}
```{=latex}
\setDOI{10.4324/9781003393764.0}
\thispagestyle{chapterfirstpage}
```
:::
# Preface {#sec-preface .unnumbered .unlisted}
```{r}
#| label: setup-options
#| child: "../_common.qmd"
#| cache: false
```
```{r}
#| label: textbook-pkgs-bib
#| eval: false
#| include: false
# Changes to the packages should be reflected in the `packages.bib` file
# manually from now on: 2024-06-15.
# automatically create a bib database for R packages
knitr::write_bib(c(
.packages(), "DBI", "dbplyr", "dplyr", "effectsize", "fs", "future", "forcats", "ggplot2", "ggraph", "gibasa", "haven", "igraph", "infer", "janeaustenr", "jiebaR", "jsonlite", "languageR", "lexicon", "lingtypology", "pak", "ProjectTemplate", "purrr", "qtkit", "readr", "readtext", "renv", "reprex", "rsyntax", "rvest", "skimr", "stringr", "swirl", "targets", "TBDBr", "textrecipes", "tidyr", "tidytext", "tidyverse", "tinytex", "tokenizers", "udpipe", "washoku", "word2vec", "wordbankr", "workflowr"
), "textbook-pkgs.bib")
```
<!--
WARN: - add conditional content for the swirl, recipes, and labs for web and PDF outputs
INFO: Object types for prefixing?
- _vec for vectors? or _num, _chr?
- _df for data frames
- _tbl for tibbles
- _lst for lists
- _mat for matrices
- _tdm for term-document matrices
- _dtm for document-term matrices
- _rec for recipes
- _spc model specifications
- _spl for splits
- _wflow for workflows
- _rsmp for resamples
- _fit for fitted models
- _mod for vector models
- _dist for distance matrices
- _clust for clustering objects
- _cv for cross-validation objects
- _coef for coefficients
- _ci for confidence intervals
INFO: Object infixing?
- _spk for spoken data
- _wrt for written data
- _tok for tokenized data
- _lem for lemmatized data
- _pos for part-of-speech tagged data
- _pred for prediction data
- _train for training data
- _test for test data
- other conventions:
INFO: code-block names: (WAIT, not public facing)
- format: chapter-object-verb-adjunct (ex. acquire-masc-read-df)
- operations:
- load for loading packages
- read for reading data
- prep for preparing data
- show for showing data
- plot for plotting data
- model for modeling data
- eval for evaluating data
- write for writing data
- sum for summarizing data
- sel for selecting data
- join for joining
- other conventions?
TODO: Create/ Buy domain name for the book (e.g. qta4l.com)
DONE: added goatcounter tracking code to the book website
-->
::: {.callout}
**{{< fa regular list-alt >}} Outcomes**
- Comprehend the book's rationale, learning goals, and pedagogical approach.
- Navigate and engage with the book's structure and content effectively.
- Set up the computing environment and utilize textbook and support resources for an optimal learning experience.
:::
The purpose of this preface is to present the rationale behind this textbook, outline the key learning objectives, describe the pedagogical approach, and identify the intended audience. Additionally, this chapter will provide readers with a guide to the book's structure and the scope of its content, as well as a summary of supporting learning and instructor resources. Finally, this chapter will provide readers with information on setting up their computing environment and where to seek support.
## Rationale {#sec-preface-rationale .unnumbered .unlisted}
\index{data science}**Data science**, an interdisciplinary field that combines knowledge and skills from statistics, computer science, and domain-specific expertise to extract meaningful insight from structured and unstructured data, has emerged as an exciting and rapidly growing field in recent years, driven in large part by the increase in computing power available to the average individual and the abundance of electronic data now available through the internet. These advances have become an integral part of the modern scientific landscape, with data-driven insights now being used to inform decision-making in a wide variety of academic fields, including linguistics and language-related disciplines.
This textbook seeks to meet this growing demand by providing an introduction to the fundamental concepts and practical programming skills from data science applied to the task of quantitative text analysis. It is intended primarily for undergraduate students, but may also be useful for graduates and researchers seeking to expand their methodological toolbox. The textbook takes a pedagogical approach which assumes no prior experience with statistics or programming, making it an accessible resource for novices beginning their exploration of quantitative text analysis methods.
## Aims {#sec-preface-aims .unnumbered .unlisted}
The overarching goal of this textbook is to provide readers with foundational knowledge and practical skills to conduct and evaluate quantitative text analysis using the R programming language and other open source tools and technologies. The specific aims are to develop the reader's proficiency in three main areas:
- \index{data literacy}**Data literacy**: Identify, interpret and evaluate data analysis procedures and results.\
Throughout this textbook we will explore topics which will help you understand how data analysis methods derive insight from data. In this process you will be encouraged to critically evaluate connections across linguistic and language-related disciplines using data analysis knowledge and skills. Data literacy is an invaluable skillset for academics and professionals but also is indispensable for 21st-century citizens to navigate and actively participate in the "Information Age" in which we live [@Carmi2020].
- \index{research skills}**Research skills**: Design, implement, and communicate quantitative text analysis research.\
This aim does not differ significantly, in spirit, from common learning outcomes in a research methods course. However, working with text will incur a series of key steps in the selection, collection, and preparation of the data that are unique to text analysis projects. In addition, I will stress the importance of research documentation and creating reproducible research as an integral part of modern scientific inquiry [@Buckheit1995].
- \index{programming skills}**Programming skills**: Develop and apply programming skills to text analysis tasks in a reproducible manner.\
Modern data analysis, and by extension, text analysis is conducted using programming. There are various key reasons for this: a programming approach (1) affords researchers unlimited research freedom ---if you can envision it, you can program it, (2) underlies well-documented and reproducible research [@Gandrud2015]\index{Gandrud}, and (3) invites researchers to engage more intimately with the data and the methods for analysis.
These aims are important for linguistics students because they provide a foundation for concepts and in the skills required to succeed in the rapidly evolving landscape of 21st-century research. These abilities enable researchers to evaluate and conduct high-quality empirical investigation across linguistic fields on a wide variety of topics. Moreover, these skills go beyond linguistics research; they are widely applicable across many disciplines where quantitative data analysis and programming are becoming increasingly important. Thus, this textbook provides students with a comprehensive introduction to quantitative text analysis that is relevant to linguistics research and that equips them with valuable skills for their future careers.
## Approach {#sec-preface-approach .unnumbered .unlisted}
The approach taken in this textbook is designed to accommodate linguistics students and researchers with little to no prior experience with programming or quantitative methods. With this in mind the objective is connect conceptual understanding with practical application. Real-world data and research tasks relevant to linguistics are used throughout the book to provide context and to motivate the learning process[^preface-data-lang]. Furthermore, as an introduction to the field, the textbook focuses on the most common and fundamental methods and techniques for quantitative text analysis and prioritizes breadth over depth and intuitive understanding over technical explanations. On the programming side, the \index{Tidyverse}**Tidyverse** approach to programming in \index{R} will be adopted [@Wickham2014]\index{Wickham}. This approach provides a consistent syntax across different packages and is known for its legibility, making it easier for readers to understand and write code. Together, these strategies form an approach that is intended to provide readers with an accessible resource to gain a foothold in the field and to equip them with the knowledge and skills to apply quantitative text analysis in their own research.
[^preface-data-lang]: Research data and questions are primarily based on English for wide accessibility as it is the *de facto* language of academics and research. However, the methods and techniques presented in this textbook are applicable to many other languages.
## Structure {#sec-preface-structure .unnumbered .unlisted}
The aims and approach described above are reflected in the overall structure of the book and each chapter.
### Book level {#sec-preface-structure-book .unnumbered .unlisted}
At the book level, there are five interdependent parts:
Part I "Orientation" provides the necessary background knowledge to situate quantitative text analysis in the wider context of data analysis and linguistic research and to provide a clearer picture of what text analysis entails and its range of applications.
::: {.content-visible when-format="html"}
The subsequent parts are directly aligned with the data analysis process. The building blocks of this process are reflected in **'Data to Insight Hierarchy (DIKI)'** visualized in @fig-diki-hierarchy.
::: {#fig-diki-hierarchy}
[{width=75%}]{fig-alt="Data to Insight Hierarchy (DIKI) which is a pyramid with the following levels: Data, Information, Knowledge, and Insight. The Data level is at the bottom and the Insight level is at the top. The Data level is the largest and the Insight level is the smallest."}
Data to Insight Hierarchy (DIKI)^[Adapted from @Ackoff1989 and @Rowley2007.]
:::
:::
::: {.content-visible when-format="pdf"}
The subsequent parts are directly aligned with the data analysis process. The building blocks of this process are reflected in \index{Data to Insight Hierarchy (DIKI)}**'Data to Insight Hierarchy (DIKI)'** visualized in Figure 0.1.
```{=latex}
\begin{figure}
\centering
\includegraphics[width=0.75\linewidth]{part_0/figures/preface-diki.drawio.png}
\captionsetup{labelformat=empty,labelsep=none}
\caption[Figure 0.1: Data to Insight Hierarchy (DIKI)]{Figure 0.1: Data to Insight Hierarchy (DIKI)\footnotemark{}}
\end{figure}%
\footnotetext{Adapted from Ackoff (\citeproc{ref-Ackoff1989}{1989}) and Rowley (\citeproc{ref-Rowley2007}{2007}).}
```
:::
The DIKI Hierarchy highlights the stages and intermediate steps required to derive insight from data. Part II "Foundations" provides a conceptual introduction to the DIKI Hierarchy and establishes foundational knowledge about data, information, knowledge, and insight which is fundamental to developing a viable research plan.
Parts III "Preparation" and IV "Analysis" focus on the implementation process. Part III covers the steps involved in preparing data for analysis, including data acquisition, curation, and transformation. Part IV covers the steps involved in conducting analysis, including exploratory, predictive, and inferential data analysis.
The final part, Part V "Communication", covers the final stage of the data analysis process, which is to communicate the results of the analysis. This includes the structure and content of research reports as well as the process of publishing, sharing, and collaborating on research.
### Chapter level {#sec-preface-structure-chapter .unnumbered .unlisted}
At the chapter level, both conceptual and programming skills are developed in stages[^bloom]. The chapter-level structure is consistent across chapters and can be seen in @tbl-structure-approach.
[^bloom]: These stages attempt to capture the general progression of learning reflected in Bloom's Taxonomy. See @Krathwohl2002 for a description and revised version.
::: {#tbl-structure-approach tbl-colwidths="[15, 55, 15, 15]"}
| Component | Purpose | Resource | Stage |
| :--- | :--- | :--- | :--- |
| Outcomes | Identify the learning objectives for the chapter | Textbook | Indicate |
| Overview | Provide a brief introduction to the chapter topic | Textbook | Outline |
| Coding Lessons | Teach programming techniques with hands-on interactive exercises | GitHub | Interact |
| Content | Combine conceptual discussions and programming skills, incorporating thought-provoking questions, relevant studies, and advanced topic references | Textbook | Explore |
| Recipes | Offer step-by-step programming examples related to the chapter and relevant for the upcoming lab | Resources Kit website | Examine |
| Labs | Allow readers to apply chapter-specific concepts and techniques to practical tasks | GitHub | Apply |
| Summary | Review the key concepts and skills covered in the chapter | Textbook | Review |
The general structure and learning progression of a chapter
:::
Each chapter will begin with a list of key learning outcomes followed by a brief introduction to the chapter's content. The goal is to orient the reader to the chapter. Next there will be a prompt to complete the interactive coding lesson(s) to introduce readers to key programming concepts related to the chapter though hands-on experience and then the main content of the chapter will follow. The content will be a combination of conceptual discussions and programming skills, incorporating thought-provoking questions ('{{< fa regular lightbulb >}} Consider this'), relevant studies ('{{< fa regular file-alt >}} Case study'), and advanced topic references ('{{< fa medal >}} Dive deeper'). Together these components form the skills and knowledge phase.
The next phase is the application phase. This phase will include step-by-step programming demonstrations related to the chapter (Recipes) and lab exercises that allow readers to apply their knowledge and skills to chapter-related tasks. Finally, the chapters conclude with a summary of the key concepts and skills covered in the chapter and in the associated activities.
## Resources {#sec-preface-resources .unnumbered .unlisted}
The description and location of the available resources to support the aims and approach of this textbook appear in @tbl-resources.
::: {#tbl-resources tbl-colwidths="[15, 70, 15]"}
| Resource | Description | Location |
| :--- | :--- | :--- |
| Textbook | Prose discussion, figures/ tables, R code, case studies, and thought and practical exercises | Physical/ [Web](https://qtalr.com) |
| {qtkit} | R package with functions for accessing data and datasets, as well as various useful functions developed specifically for this textbook | CRAN/ GitHub |
| Resources Kit | Includes Recipes, programming tutorials to enhance the reader's recognition of how programming strategies are implemented, and other supplementary materials including setup Guides, and Instructor materials | GitHub |
| Lessons | A set of interactive R programming lessons associated with each chapter | GitHub |
| Labs | A set of lab exercises designed to direct the reader through practical hands-on programming applications | GitHub |
Resources available to support the aims and approach of this textbook
:::
All resources are freely available and accessible to readers and are found on the GitHub organization <https://github.com/qtalr/>. For the textbook and Resources Kit, the code and a link to the website are provided in each respective repository. The development version of the {qtkit} package is available on GitHub and the stable version is available on the \index{Comprehensive R Archive Network (CRAN)}Comprehensive R Archive Network (CRAN) [@R-qtkit]. The interactive programming lessons and lab exercises are also available on GitHub. Errata should be reported in the respective repository's issue tracker on GitHub.
## Getting started {#sec-preface-getting-started .unnumbered .unlisted}
Before jumping in to this and subsequent chapter's textbook activities, it is important to prepare your \index{computing environment}computing environment and understand how to take advantage of the resources available, both those directly and indirectly associated with the textbook.
### R environment {#sec-preface-r-environment .unnumbered .unlisted}
Programming is the backbone for modern quantitative research. Among the many programming languages available, \index{R}R is a popular \index{open source}open-source language and software environment for statistical computing. R is popular with statisticians and has been adopted as the *de facto* language by many other fields in natural and social sciences, including linguistics. It is freely downloadable from The R Project for Statistical Programming website [@TheRFoundation2024] and is available for macOS, Linux, and Windows operating systems\index{operating system}.
Successfully installing R is rarely the last step in setting up your R-enabled computing environment. The majority of R users also install an \index{integrated development environment (IDE)}**integrated development environment** (IDE). An IDE, such as \index{RStudio}RStudio [@Posit2024], or a \index{text editor}text editor, such as \index{Visual Studio Code}Visual Studio Code [@Microsoft2024], provide a \index{graphical user interface (GUI)}**graphical user interface** (GUI) for working with R[^nvim]. In effect, these interfaces provide a dashboard for working with R and are designed to make it easier to write and execute R code. IDEs also provide a number of other useful features such as syntax highlighting, code completion, and debugging. IDEs are not required to work with R but they are *highly* recommended.
[^nvim]: For those who prefer a terminal-based text editor, \index{Neovim}Neovim is a popular choice. Neovim is a text editor that is designed to be extensible and customizable. It is a modern version of the classic Vim text editor.
Choosing to install R and an IDE directly on your personal computer, which is know as your \index{local environment}**local environment**, is not the only option to work with R. Other options include working with R in a \index{remote environment}**remote environment** or a \index{virtual environment}**virtual environment**.
::: {.callout .halfsize}
**{{< fa regular file-code >}} Guides**
For more information and instructions on setting up an R environment for using this book, consult the Resources Kit "Setting up an R environment" guide.
:::
There are trade-offs in terms of cost, convenience, and flexibility when choosing to work with R in a local, remote, or virtual environment. The choice is yours and you can always change your mind later. The important thing is to get started and begin learning R. Furthermore, any of the approaches described here will be compatible with this textbook.
### R packages {#sec-preface-r-packages .unnumbered .unlisted}
As you progress in your R programming experience, you'll find yourself leveraging code from other R users, which is typically provided as packages. \index{R packages}Packages are sets of functions and/or datasets that are freely accessible for download, designed to perform a specific set of interrelated tasks. They enhance the capabilities of R. Official R packages can be found in repositories like \index{Comprehensive R Archive Network (CRAN)}CRAN [@RCommunity2024] or \index{R Universe}R-universe [@ROpenSci2024], while other packages can be obtained from code-sharing platforms such as \index{GitHub}GitHub [@Github2024].
::: {.callout}
**{{< fa regular lightbulb >}} Consider this**
\index{Comprehensive R Archive Network (CRAN)}CRAN includes groupings of popular packages related to a given applied programming task called Task Views <https://cran.r-project.org/web/views/>. Explore the available CRAN Task Views listings. Note the variety of areas (tasks) that are covered in this listing. Now explore in more detail one of the following task views which are directly related to topics covered in this textbook noting the associated packages and their descriptions: (1) \index{clustering}Cluster, (2) \index{machine learning}MachineLearning, (3) \index{Natural Language Processing (NLP)}NaturalLanguageProcessing, or (4) \index{reproducible research}ReproducibleResearch.
:::
You will download a number of packages at different stages of this textbook, but there is a set of packages that will be key to have from the get go. Once you have access to a working \index{R}R environment, you can proceed to install the following packages.
::: {.callout .halfsize}
**{{< fa regular file-code >}} Guides**
For instructions on how to install the \index{R packages!qtkit}{qtkit} package from CRAN\index{Comprehensive R Archive Network (CRAN)} or GitHub\index{GitHub} and download and use the interactive R programming lessons for this textbook, see the Resources Kit "Getting started" guide.
:::
Install the following packages from CRAN.
- \index{R packages!tidyverse}{tidyverse} [@R-tidyverse]
- \index{R packages!tinytex}{tinytex} [@R-tinytex]
- \index{R packages!swirl}{swirl} [@R-swirl]
- \index{R packages!qtkit}{qtkit} [@R-qtkit]
You can do this by running @exm-install-packages in an R console:
::: {#exm-install-packages}
```r
# install key packages from CRAN
install.packages(c("tidyverse", "tinytex", "swirl", "qtkit"))
```
:::
\cindex{install.packages()}
\cindex{c()}
### Git and GitHub {#sec-preface-git-github .unnumbered .unlisted}
\index{GitHub}GitHub is a code sharing website. Modern computing is highly collaborative and GitHub is a very popular platform for sharing and collaborating on coding projects. The lab exercises for this textbook are shared on GitHub. To access and complete these exercises you will need to sign up for a (free) account and then set up the version control software \index{Git}Git on your computing environment.
::: {.callout .halfsize}
**{{< fa regular file-code >}} Guides**
For more information and instructions on setting up version control and interacting with GitHub consult the Resources Kit "Setting up Git and GitHub" guide.
:::
### Getting help {#sec-preface-getting-help .unnumbered .unlisted}
The technologies employed in this approach to text analysis will include a somewhat steep learning curve. And in all honesty, the learning never stops! Both seasoned programmers and beginners alike need assistance. Fortunately, there is a very large community\index{R community} of programmers who have developed many official support resources and who actively contribute to official and unofficial discussion forums. Together these resources provide many avenues for overcoming challenges.
In @tbl-support-resources, I provide a list of steps for seeking help with R.
::: {#tbl-support-resources tbl-colwidths="[5, 25, 70]"}
| Step | Resource | Description |
|-------|----------|-------------|
| 1 | Official R Documentation | Access the official documentation by running `help(package = "package_name")` in an R console. Use the \index{?}`?` operator followed by the package or function name. Check out available Vignettes by running `browseVignettes("package_name")`. |
| 2 | Web Search | Look for package documentation and vignettes on the web. A popular site for this is R-Universe. |
| 3 | RStudio Help Toolbar | If you're using \index{RStudio}RStudio, use the "Help" toolbar menu. It provides links to help resources, guides, and manuals. |
| 4 | Online Discussion Forums | Sites like Stack Overflow and RStudio Community are great platforms where the programming community asks and answers questions related to real-world issues. |
| 5 | Post Questions with Reprex | When posting a question, especially those involving coding issues or errors, provide enough background and include a \index{reproducible example}reproducible example (reprex) ---a minimal piece of code that demonstrates your issue. This helps others understand and answer your question effectively. |
Recommended order for seeking help with R
:::
\index{RStudio}
::: {.callout .halfsize}
**{{< fa regular file-code >}} Guides**
For information on how to create a minimal reproducible example with the {reprex} package [@R-reprex], consult the Resources Kit "Creating reproducible examples" guide.
:::
\index{R packages!reprex}
The take-home message here is that you are not alone. There are many people world-wide that are learning to program and/or contribute to the learning of others. The more you engage with these resources and communities the more successful your learning will be. As soon as you are able, pay it forward. Posting questions and offering answers helps the community and engages and refines your skills ---a win-win.
## Conventions {#sec-preface-conventions .unnumbered .unlisted}
To facilitate the learning process, this textbook will employ a number of conventions. These conventions are intended to help the reader navigate the text and to signal the reader's attention to important concepts and information.
### Prose {#sec-preface-prose .unnumbered .unlisted}
The following typographic conventions are used throughout the text:
- *Italics*
- File names, file extensions, directory paths, and URLs.
- `Fixed-width`
- Function names, variable and object names, and in-line code including expressions and operators.
- {Curly brackets}
- R package names
- **Bold**
- Key concepts when first introduced.
- [Linked text](https://qtalr.com/resources/)
- Links to internal and external resources and footnotes.
### Code blocks {#sec-preface-code-blocks .unnumbered .unlisted}
More lengthy code will be presented in \index{code blocks}code blocks, as seen in @exm-code-block.
::: {#exm-code-block}
```{r}
#| label: code-block
#| echo: true
# A function that takes a name and returns a greeting
greetings <- function(name) {
paste("Hello", name)
}
# Apply function to a name
greetings(name = "R user")
```
:::
\index{function()}
\index{paste()}
There are a couple of things to note about the code in @exm-code-block. First, it shows the code that is run in R as well as the output that is returned. The code will appear in a box and the output will appear below the box. Both code and output will appear in fixed-width font. Second, the `#` symbol within a code block is used to signal a \index{code comment}**code comment**, a human-facing description. Everything right of a `#` is not run as code. In this textbook you will see code comments above code on a separate line and/or to the right of code on the same line. It is good practice to comment your code to enhance readability and to help others understand what your code is doing.
::: {.content-visible when-format="html"}
::: {.callout .halfsize}
**{{< fa regular hand-point-up >}} Tip**
Since you are reading this textbook in a web browser there are two more features that you should be aware of. First, you can click on the code block to copy the code to your clipboard. Second, you can click on a function name to see the help documentation for that function.
:::
:::
All figures, tables, and images in this textbook are generated by code blocks, but only code for those elements that are relevant for discussion will be shown. However, if you wish to see the code for any element in this textbook, you can visit the GitHub repository <https://qtalr.github.io/book/>.
When referencing a file or portion of a file, it will appear as in @def-r-code.
::: {#def-r-code}
*example.R* file
```{.r}
# Load package
library(tidyverse)
# Add 1 and 1
1 + 1
```
:::
\index{library()}
### Callouts {#sec-preface-callouts .unnumbered .unlisted}
Callouts are used to signal the reader's attention to content, activity, and other important sections. The following callouts are used in this textbook:
**Content**
::: {.callout}
**{{< fa regular list-alt >}} Outcomes**
Learning outcomes for the chapter.
:::
::: {.callout}
**{{< fa regular lightbulb >}} Consider this**
Points to consider and questions to explore.
:::
::: {.callout}
**{{< fa regular file-alt >}} Case study**
Case studies which highlight conceptual knowledge and coding skills.
:::
::: {.callout}
**{{< fa medal >}} Dive deeper**
Additional comments and resources for diving deeper into a topic.
:::
**Activities**
::: {.callout}
**{{< fa terminal >}} Lessons**
Links to interactive lessons for practicing coding skills.
:::
::: {.callout}
**{{< fa regular file-code >}} Recipe**
Reading to examine programming concepts.
:::
::: {.callout}
**{{< fa flask >}} Lab**
Exercises for applying conceptual knowledge and coding skills.
:::
**Other**
::: {.callout}
**{{< fa regular hand-point-up >}} Tip**
Tips for using R and related tools.
:::
::: {.callout}
**{{< fa exclamation-triangle >}} Warning**
Warnings for using R and related tools.
:::
## Activities {#sec-preface-activities .unnumbered .unlisted}
At this point you should have a working R environment with the core packages including {qtkit} installed. You should also have verified that you have a working Git environment and that you have a GitHub account. If you have not completed these tasks, return to the guides listed above in "[Getting started](#sec-preface-getting-started)" of this Preface and complete them before proceeding.
The following activities are designed to help you become familiar with the tools and resources that you will be using throughout this textbook. These and subsequent activities are designed to be completed in the order that they are presented in this textbook.
\pagebreak
::: {.callout}
**{{< fa terminal >}} Lessons**
**What**: Intro to Swirl\
**How**: In the R console load {swirl}, run `swirl()`, and follow prompts to select the lesson.\
**Why**: To familiarize you with navigating, selecting, and completing swirl lessons for interactive R programming tutorials.
:::
::: {.callout}
**{{< fa regular file-code >}} Recipe**
**What**: Literate Programming and Quarto\
**How**: Read Recipe 0, complete comprehension check, and prepare for Lab 0.\
**Why**: To introduce the concept of Literate Programming and how to create literate documents using R and Quarto.
:::
::: {.callout}
**{{< fa flask >}} Lab**
**What**: Writing with code\
**How**: Clone, fork, and complete the steps in Lab 0.\
**Why**: To put literate programming techniques covered in Recipe 0 into practice. Specifically, you will create and edit a Quarto document and render a report in PDF format.
:::
## Summary {#sec-preface-summary .unnumbered .unlisted}
This preface outlines the textbook's underlying principles, learning goals, teaching methods, and target audience. The chapter also offers advice on how to navigate the book's layout, comprehend its subject matter, and make use of supplementary materials. With this foundation, you're now prepared to dig into quantitative text analysis. I hope you enjoy the journey!
## To the instructor {#sec-preface-instructor .unnumbered .unlisted}
For recommendations on how to use this textbook in your course and to access additional resources, visit the Resources Kit "Instructor Guide". The guide provides information on how to structure your course, how to use the textbook, and how to access additional resources to support your teaching.
<!-- Start main content -->
```{=latex}
\mainmatter
```