100% found this document useful (3 votes)
38 views

Instant download Humanities Data in R Exploring Networks Geospatial Data Images and Text 2nd Edition Unknown pdf all chapter

R

Uploaded by

geersfiadho9
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
38 views

Instant download Humanities Data in R Exploring Networks Geospatial Data Images and Text 2nd Edition Unknown pdf all chapter

R

Uploaded by

geersfiadho9
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 81

Visit https://ebookgate.

com to download the full version and


explore more ebooks

Humanities Data in R Exploring Networks Geospatial


Data Images and Text 2nd Edition Unknown

_____ Click the link below to download _____


https://ebookgate.com/product/humanities-data-in-r-
exploring-networks-geospatial-data-images-and-text-2nd-
edition-unknown/

Explore and download more ebooks at ebookgate.com


Here are some recommended products that might interest you.
You can download now and explore!

Data Science Fundamentals with R Python and Open Data 1st


Edition Marco Cremonini

https://ebookgate.com/product/data-science-fundamentals-with-r-python-
and-open-data-1st-edition-marco-cremonini/

ebookgate.com

Statistics for Censored Environmental Data Using Minitab


and R Statistics in Practice 2nd Edition Dennis R. Helsel

https://ebookgate.com/product/statistics-for-censored-environmental-
data-using-minitab-and-r-statistics-in-practice-2nd-edition-dennis-r-
helsel/
ebookgate.com

Modern Statistics With R From Wrangling and Exploring Data


to Inference and Predictive Modelling second edition Måns
Thulin
https://ebookgate.com/product/modern-statistics-with-r-from-wrangling-
and-exploring-data-to-inference-and-predictive-modelling-second-
edition-mans-thulin-2/
ebookgate.com

Modern Statistics with R From Wrangling and Exploring Data


to Inference and Predictive Modelling Second Edition Måns
Thulin
https://ebookgate.com/product/modern-statistics-with-r-from-wrangling-
and-exploring-data-to-inference-and-predictive-modelling-second-
edition-mans-thulin/
ebookgate.com
Data Modeling Made Simple with Embarcadero ER Studio Data
Architect Adapting to Agile Data Modeling in a Big Data
World 2nd Edition Steve Hoberman
https://ebookgate.com/product/data-modeling-made-simple-with-
embarcadero-er-studio-data-architect-adapting-to-agile-data-modeling-
in-a-big-data-world-2nd-edition-steve-hoberman/
ebookgate.com

Data structures and algorithms made easy in Java data


structure and algorithmic puzzles 2nd Edition Narasimha
Karumanchi
https://ebookgate.com/product/data-structures-and-algorithms-made-
easy-in-java-data-structure-and-algorithmic-puzzles-2nd-edition-
narasimha-karumanchi/
ebookgate.com

Automotive informatics and communicative systems


principles in vehicular networks and data exchange 1st
Edition Huaqun Guo
https://ebookgate.com/product/automotive-informatics-and-
communicative-systems-principles-in-vehicular-networks-and-data-
exchange-1st-edition-huaqun-guo/
ebookgate.com

R Data Mining Blueprints 1st edition Edition Mishra

https://ebookgate.com/product/r-data-mining-blueprints-1st-edition-
edition-mishra/

ebookgate.com

The Handbook of Computer Networks Key Concepts Data


Transmission and Digital and Optical Networks Volume 1
Hossein Bidgoli
https://ebookgate.com/product/the-handbook-of-computer-networks-key-
concepts-data-transmission-and-digital-and-optical-networks-
volume-1-hossein-bidgoli/
ebookgate.com
Quantitative Methods in the Humanities
and Social Sciences

Taylor Arnold
Lauren Tilton

Humanities
Data in R
Exploring Networks, Geospatial Data,
Images, and Text
Second Edition
Quantitative Methods in the Humanities
and Social Sciences

Series Editors
Thomas DeFanti, Calit2, University of California San Diego, La Jolla, CA, USA
Anthony Grafton, Princeton University, Princeton, NJ, USA
Thomas E. Levy, Calit2, University of California San Diego, La Jolla, CA, USA
Lev Manovich, Graduate Center, The Graduate Center, CUNY, New York, NY, USA
Alyn Rockwood, KAUST, Boulder, CO, USA
Quantitative Methods in the Humanities and Social Sciences is a book series
designed to foster research-based conversation with all parts of the university
campus – from buildings of ivy-covered stone to technologically savvy walls
of glass. Scholarship from international researchers and the esteemed editorial
board represents the far-reaching applications of computational analysis, statistical
models, computer-based programs, and other quantitative methods. Methods are
integrated in a dialogue that is sensitive to the broader context of humanistic study
and social science research. Scholars, including among others historians, archaeolo-
gists, new media specialists, classicists and linguists, promote this interdisciplinary
approach. These texts teach new methodological approaches for contemporary
research. Each volume exposes readers to a particular research method. Researchers
and students then benefit from exposure to subtleties of the larger project or corpus
of work in which the quantitative methods come to fruition.

Editorial Board:
Thomas DeFanti, University of California, San Diego & University of Illinois at
Chicago
Anthony Grafton, Princeton University
Thomas E. Levy, University of California, San Diego
Lev Manovich, The Graduate Center, CUNY
Alyn Rockwood, King Abdullah University of Science and Technology
Publishing Editor for the series at Springer: Faith Su, faith.su@springer.com
Taylor Arnold • Lauren Tilton

Humanities Data in R
Exploring Networks, Geospatial Data,
Images, and Text

Second Edition
Taylor Arnold Lauren Tilton
University of Richmond University of Richmond
Richmond, VA, USA Richmond, VA, USA

ISSN 2199-0956 ISSN 2199-0964 (electronic)


Quantitative Methods in the Humanities and Social Sciences
ISBN 978-3-031-62565-7 ISBN 978-3-031-62566-4 (eBook)
https://doi.org/10.1007/978-3-031-62566-4

© The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Switzerland
AG 2015, 2024
This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether
the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse
of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and
transmission or information storage and retrieval, electronic adaptation, computer software, or by similar
or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication
does not imply, even in the absence of a specific statement, that such names are exempt from the relevant
protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this book
are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or
the editors give a warranty, expressed or implied, with respect to the material contained herein or for any
errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.

This Springer imprint is published by the registered company Springer Nature Switzerland AG
The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland

If disposing of this product, please recycle the paper.


Preface

Published in 2015, the first edition of this book was written as digital humanities was
fully entering the lexicon of the academy. Debates over ideas such as computation,
digital, and data ensued. Questions such as what does it mean to think of sources
as data, or “humanities data,” were posed by Miriam Posner [75], while Jessica
Marie Johnson brought the longer history of quantification to ask pressing questions
about the process and effect of continuing to turn people into data [47]. Amid
these questions and debates, cultural institutions such as the Library of Congress
made an incredible commitment to digitization and open data, making sources once
only accessible in person available in digital formats that were now amenable to
computational methods. What could be possible with all these sources of data?
We set out to demonstrate how methods from text, spatial, and image analyses
could animate humanities fields by rethinking of our sources as data and using
programming, specifically the language R. This was a rather radical move at the
time, when humanities fields were particularly resistant to the idea of thinking of
materials such as books, photographs, and TV as the subject of analysis through
counting and probabilities, much less algorithms and modeling. The field of digital
humanities was pushing against this impulse, particularly led by scholars in digital
history and what we now call computational literary studies. For those interested in
learning how to bring them together, they were still often on their own. For many,
programming and humanities inquiry still seemed like a contradiction.
Yet, as graduate students, one in American Studies (Lauren) and the other in
Statistics (Taylor), bringing together humanities data such as historical photographs
with computational methods such as mapping seemed incredibly powerful. Our
work building photogrammar.org, and the project’s positive reception, demon-
strated the possibilities of layering mapping, text analysis, and image analysis to
further the study of visual culture. Computational methods did not replace all
the training of humanities fields, but rather fit with the experimentation, trans-
disciplinarity, and creativity that American Studies articulated as central to its
project. At the same time, fields such as Statistics were continuing their emphasis
on mathematical theory, often disconnected from many of the realities of working
with actual data and the methodological problems that the messiness of human data

v
vi Preface

elicited. An openness to thinking across these boundaries is a significant reason why


this book exists.
Our advisors Laura Wexler and Jay Emerson along with graduate colleague Carol
Chiodo at Yale fundamentally understood what was possible, supporting us when
others questioned these two, perhaps precocious, graduate students. We eagerly
joined exciting projects like the Programming Historian and work by Matthew
Jockers and Lev Manovich, both of whom we are deeply grateful for their support,
to demonstrate how computational methods could be a part of the methodological
toolkit of the humanities. Rather than designed for industry or a very technical
audience, Humanities Data in R filled a need for a book designed to introduce
audiences to computational methods and were interested in the sources that served
as primary evidence for understanding the human experience.
Fast forward almost a decade, and a fair amount has changed. We are now
tenured professors at a flourishing small liberal arts college where interdisciplinarity
is celebrated. We teach digital humanities across the Department of Rhetoric
and Communication, Department of Mathematics and Statistics, and programs
in American Studies and Data Science. At the same time, the rapid ascent of
data science over the past 5 years has mostly silenced debates over whether the
humanities should be involved with data and computation. In fact, many of us
are noting how data and computation have never needed the humanities more.
Humanities scholars should be key interlocutors in interpreting the findings of
computational analysis of humanities data as well as have important insights into
the ethical and social impact of computational methods. One goal of this book is
to provide the programming and methodological background to be a part of these
interdisciplinary conversations and debates.
For the computational approaches, fields such as Statistics are now grappling
with the realities of working with messy data. It was already a decade ago that
Taylor realized that the most complicated data came from sources that animated the
humanities. How does one work with film, for example? The data is multimodal,
defies easy classifications, and breaks computer vision algorithms. To use the
gendered logic that permeates so many discussions of academia, humanities fields
weren’t some soft, squishy area of study that was easier, but rather worked with
the hard, complex sources and data that challenged what was seen as a given in
statistical and computational fields. We co-author because we believe that inter-
and transdisciplinary scholarship is key to the (digital) humanities and data science,
and we have so much to learn from each other. We see this book as a part of that
exchange, and for anyone who wants to work with humanities data.

Preface to Second Edition

The second edition is a significant revision, with almost every aspect of the text
rewritten in some way. The biggest difference is the incorporation of the set
of R packages commonly known as the tidyverse, consisting at its core of the
Preface vii

packages ggplot2 and dplyr. These packages have grown significantly in stability
and popularity over the past decade. They allow the kinds of functionality that we
wanted to highlight in the first version of the book, but do so with less code while
being backed by theoretical models of how data processing should work. These
features make them perfect elements to use for an introduction to R for working
with humanities data.
As before, Part I introduces the R programming language and key concepts for
working with data. Exploratory data analysis (EDA) remains a key concept and
philosophy. EDA is an approach for analyzing and summarizing to identify patterns
(and outliers) in data. It is also a way of knowing that is amenable to the kinds
of questions and heuristics that animate how humanistic fields approach studying
the human experience. Based on years of teaching, we have come to realize how
important understanding data collection is to data analysis yet how few resources
there are, so we have added Chap. 5: Collecting Data and Chap. 12: Data Formats to
address perhaps the most time-consuming part, collecting and organizing data.
Part II of the text is still organized around data types. We have decided to reorder
the chapters because of our approach to data. In this edition, we wanted to show how
one can layer types of analysis using the same data set. Rather than each chapter
introducing a new data set, we build our analysis of Wikipedia data from Chaps. 6
to 8 as we move from text to networks to temporal data. Chapter 8: Temporal
Data is a new chapter given the importance of time information, particularly if
we want to study change over time. Chapter 9: Spatial Data returns to the data
that was used in Part I to show how we can layer the information with additional
data. Chapter 10: Image Data introduces a new data set of 1940s photographs to
apply computer vision. While we are always hesitant of hype about technological
change, particularly given all the current (generative) AI boosterism, a significant
methodological shift in the last 10 years is the advances in computer vision,
particularly the ascent of deep learning. We now focus on several of the most popular
tasks such as object detection, and how we can also layer them with additional
methods such as networks. The reorganization, additional chapters, and new data
sets are a part of trying to demonstrate how layering methods can add context and
nuance to our analysis.

Humanities Data

We now return to the term “humanities data.” For us, this means any data that is
engaged with analyzing any aspect of human societies and cultures. This is bigger
than any disciplinary or institutional formation. When we are working with the
messiness of human creativity and meaning, we are engaged in a challenging task,
particularly when we want to understand peoples’ beliefs, values, and behaviors,
whether today or in the past. This is inherently a transdisciplinary project that
traverses any walls that we try to build through academic journals, departments,
scholarly associations, and the university itself. Working with humanities data
viii Preface

happens in industry and beyond. Working with this data carefully, ethically, and
precisely takes collaboration. The book is designed to provide the groundwork for
those who seek to engage with and analyze the data that documents, shapes, and
communicates who we are, where we have been, and the worlds we are building.
No book can do everything, and our orientation is centered around the United
States. The goal of this book is to walk readers through the methods and provide
the code that will give one the resources and confidence to computationally explore
humanities data. Data and methods such as image analysis are the subject of tens of
thousands of articles and books. At the end of each chapter and through our citations,
we offer further reading to start connecting with the wide range of scholarship on
each of these chapters. We also do not go directly into all the debates over the
epistemology and ontology of data and statistics itself; we find a great place to start
is with Lisa Gitelman’s “Raw Data” is an Oxymoron [36] and Chris Wiggins and
Matthew L. Jones’s How Data Happened: A History from the Age of Reason to
the Age of Algorithm [104]. Along with work by dana boyd, Kate Crawford, Safiya
Noble, and Meredith Broussard, we find Catherine d’Ignazio and Lauren Klein’s
Data Feminism to be also be a great place to start when it comes to data ethics and
justice [30].
Zooming out, there is significant domain-specific scholarship to draw on to
see the power of humanities data analysis. There are series and journals such as
Current Research in Digital History, Debates in the Digital Humanities, Digital
Scholarship in the Humanities, Journal of Cultural Analytics, Journal of Open
Source Software, and the new journal Computational Humanities Research along
with digital humanities special issues in journals like American Quarterly, Cinema
Journal, and Digital Humanities Quarterly. There are books like Ted Underwood’s
Distant Horizons, [87] Andrew Piper’s Enumerations [73], and our own Distant
Viewing [7] that offer theories for computational methods. As well, there are
domain-specific works such as Cameron Blevins’ Paper Trails: The US Post and
the Making of the American West [16] and Lincoln Mullen’s America’s Public Bible
[63] that show how computational methods provide key evidence for scholarship in
religious studies, US history, and rhetorical studies. We offer the work above as a
starting point for the rich conversations and debates around humanities data.

Supplementary Materials

We make extensive use of example datasets through this text. Particular care was
taken to use data in the public domain, or otherwise freely and openly accessible.
Whenever possible, subsets of larger archives were used instead of smaller one-
off datasets. This approach has the dual benefit that these larger sets are often of
independent interest, as well as providing an easy source of additional data for
use in course projects, lectures, and further study. These datasets are available (or
Preface ix

linked to) from the text’s website: http://humanitiesdata.org. Complete code


snippets from the text, further references, and additional links and notes are also
included in that site and will continue to be updated.

Acknowledgments

For the first edition, it would not have been possible to write this text without
the collaboration and support offered by our many colleagues, friends, and family.
In particular, we would like to thank those who agreed to read and comment on
the early drafts of this text: Carol Chiodo, Jay Emerson, Alex Gil, Jason Heppler,
Matthew Jockers, Mike Kane, Lev Manovich, Laura Wexler, Jeri Wieringa, and two
anonymous readers.
For the second edition, we are deeply appreciative of the University of Richmond,
which has given us the time and resources to pursue a second edition. We
are grafteful to Justin Wigard, who read a complete draft and offered crucial
feedback, and Agnieska Szymanska, who provided guidance in countless ways.
Working with Rob Nelson and the Digital Scholarship Lab (DSL) has been
incredible; their commitment to bringing together digital humanities and social
justice through award-winning projects like Mapping Inequality continue to inspire.
We are also grateful to our departments—Rhetoric and Communication and Math
and Statistics—along with Dean Jenny Cavanaugh, whose support, generosity, and
deep commitment to the liberal arts is a model for us all. It is a special place where
the University President takes the time to engage with faculty’s scholarship. Thank
you, Kevin Hallock, for your time and leadership. And finally, to the awesome UR
students who took our classes and helped us refine our teaching and shared in the
joys and challenges of working with humanities data.

Richmond, VA, USA Taylor Arnold


April 2024 Lauren Tilton
Contents

Part I Core
1 Working with Data in R. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Working with R and R Markdown. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Running R Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5 Functions in R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.6 Loading Data in R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.7 Datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.8 Formatting R Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.9 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2 EDA I: Grammar of Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2 Text Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.3 Lines and Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.4 Optional Aesthetics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.5 Scales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.6 Labels and Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.7 Conventions for Graphics Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.8 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3 EDA II: Organizing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.2 Choosing Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.3 Data and Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.4 Selecting Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.5 Arranging Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.6 Summarize and Group By . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.7 Geometries for Summaries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.8 Mutate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.9 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
xi
xii Contents

4 EDA III: Restructuring Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59


4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.2 Joining by Relation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.3 Mutating and Filtering Joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.4 Pivot Longer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.5 Pivot Wider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.6 Patterns for Table Pivots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5 Collecting Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.2 Rectangular Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.3 Naming Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.4 What Goes in a Cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
5.5 Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
5.6 Output Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
5.7 Data Dictionary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
5.8 Summary of Data Collection Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
5.9 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

Part II Data Types


6 Textual Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
6.2 Working with a Textual Corpus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
6.3 Natural Language Processing Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
6.4 Term Frequency-Inverse Document Frequency (TF-IDF). . . . . . . . . . 97
6.5 Document Distance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
6.6 Dimensionality Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
6.7 Word Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.8 Texts in Other Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
6.9 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
7 Network Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
7.2 Creating a Network Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
7.3 Centrality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
7.4 Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
7.5 Co-citation Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
7.6 Directed Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.7 Distance Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
7.8 Nearest Neighbor Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
7.9 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
8 Temporal Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
8.2 Temporal Data and Ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Contents xiii

8.3 Date Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147


8.4 Datetime Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
8.5 Language and Time Zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
8.6 Manipulating Dates and Datetimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
8.7 Window Functions and Range Joins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
8.8 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
9 Spatial Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
9.2 Spatial Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
9.3 Polygons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
9.4 Spatial Metrics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
9.5 Spatial Joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
9.6 Raster Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
9.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
10 Image Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
10.2 Loading Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
10.3 Pixels and Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
10.4 Computer Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
10.5 Object Detection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
10.6 Face Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
10.7 Pose Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
10.8 Embeddings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
10.9 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232

Part III Additional Methods


11 Programming in R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
11.2 Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
11.3 Data Types and Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
11.4 Selecting and Modifying Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
11.5 Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
11.6 Control Flow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
11.7 Functional Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
11.8 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
12 Data Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
12.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
12.2 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
12.3 Regular Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
12.4 JSON Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
12.5 XML and HTML Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
12.6 XML Path Language (XPath). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
xiv Contents

12.7 Building Datasets Through an API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270


12.8 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Part I
Core
Chapter 1
Working with Data in R

1.1 Introduction

In this book, we focus on tools and techniques for exploratory data analysis or EDA.
Initially described in John Tukey’s classic text by the same name, EDA is a general
approach to examining data through visualizations and broad summary statistics
[19, 85]. It prioritizes studying data directly in order to generate hypotheses and
ascertain general trends prior to, and often in lieu of, formal statistical modeling.
The growth in both data volume and complexity has further increased the need
for a careful application of these exploratory techniques. In the intervening 50
years, techniques for EDA have enjoyed great popularity within statistics, computer
science, and many other data-driven fields and professions.
The histories of the R programming language and EDA are deeply entwined.
Concurrent with Tukey’s development of EDA, Rick Becker, John Chambers,
and Allan Wilks of Bell Labs began developing software designed specifically
for statistical computing. By 1980, the “S” language was released for general
distribution outside Bell Labs. It was followed by a popular series of books and
updates, including “New S” and “S-Plus” [10–12, 21]. In the early 1990s, Ross
Ihaka and Robert Gentleman produced a fully open-source implementation of S
called “R.” It is called “R” for it is both the “previous letter in the alphabet” and
the shared initial in the authors’ names. Their implementation has become the de
facto tool in the field of statistics and is often cited as being amongst the top 20 used
programming languages in the world. Without the interactive console and flexible
graphics engine of a language such as R, modern data analysis techniques would be
largely intractable. Conversely, without the tools of EDA, R would likely still have
been a welcome simplification to programming in lower-level languages but would
have played a far less pivotal role in the development of applied statistics.
The historical context of these two topics underscores the motivation for studying
both concurrently. In addition, we see this book as contributing to efforts to bring
new communities to learn from and to help shape data analysis by offering other

© The Author(s), under exclusive license to Springer Nature Switzerland AG 2024 3


T. Arnold, L. Tilton, Humanities Data in R, Quantitative Methods in the Humanities
and Social Sciences, https://doi.org/10.1007/978-3-031-62566-4_1
4 1 Working with Data in R

Fig. 1.1 Diagram of the process of exploratory data analysis

fields of study to engage with [4]. It is an attempt to provide an introduction for


students and scholars in the humanities and the humanistic social sciences to both
EDA and R. It also shows how data analysis with humanities data can be a powerful
method for humanistic inquiry. A visual summary of the steps of EDA are shown in
Fig. 1.1. We will see that the core chapters in this text map onto the steps outlined
in the diagram.

1.2 Setup

While it is possible to read this book as a conceptual text, we expect that the majority
of readers will eventually want to follow along with the code and examples that are
given throughout the text. The first step in doing so is to obtain a working copy
of R. The Comprehensive R Archive Network, known as CRAN, is the official
home of the R language and supplies download instructions according to a user’s
operating system (i.e., Mac, Windows, Linux): http://cran.r-project.org/.
Other download options exist for advanced users, up to and including a custom
build from the source code. We make no assumptions throughout this text regarding
which operating system or method of obtaining or accessing R readers have chosen.
In the rare cases where differences exist based on these options, they will be
explicitly addressed. While one can work from the terminal, we recommend using
an integrated development environment (IDE) to more easily see the code and data.
A piece of open-source software called the RStudio IDE is highly recommended:
https://posit.co/download/rstudio-desktop/. When installed in conjunc-
tion with the R environment, RStudio provides a convenient way of running R
code and seeing the output in a single window. We will show in the next section
screenshots from running R code in RStudio.
In addition to the R software, walking through the examples in this text requires
access to the datasets we explore. Care has been taken to ensure that these are all in
the public domain so as to make it easy for us to redistribute to readers. The materials
and download instructions can be found at https://humanitiesdata.org/. A
complete copy of the code from the book is also provided to make replicating (and
extending) the results as easy as possible.
1.3 Working with R and R Markdown 5

A major selling point of R is its extensive collection of user-contributed add-


ons, called packages. Details of how to install packages are included in the
supplemental materials. Specifically, the supplemental materials have a document
called setup.Rmd. Opening this in RStudio provides instructions for installing
all the packages that are needed throughout this book. Like R itself, all the
packages used here are free and open-source software, thanks to a robust community
dedicated to developing and expanding R.
As mentioned in the preface, we make heavy use in this text of a set of R packages
known as the tidyverse. These include ggplot2, readr, dplyr, and tidyr. The meta-
package tidyverse can be loaded to automatically load all the other associated R
packages. One of the other packages included in this book is hdir (Humanities Data
in R), which contains a set of wrapper functions specifically created for the text.
This package, like all the others used in this book, is released under an open-source
license and can be reused in other projects.
Learning to program is hard and invariably questions and issues will arise
in the process (even the most experienced users require help with surprisingly
high frequency). As a first source of help, searching a question or error message
online will often pull up one of the many third-party question and answer sites,
such as http://stackoverflow.com/, which are heavily frequented by new and
advanced R users alike. If we cannot find an immediate answer to a question, the
next best step is to find some local, in-person help. While we have done our best with
this static text to explain the concepts for working with R, nothing beats talking to
a real-life person. As a final step, we could post questions directly on third-party
sites. It may take a few days to get a response, but usually someone helpful from
the R community will answer. We invite everyone to participate in the community
by being active on forums, contributing packages, and supporting colleagues and
friends. There are also great groups like R-Ladies (rladies.org) and regional
groups that can provide further connections (see: r-community.org).

1.3 Working with R and R Markdown

The supplemental materials for this book include all the data and code needed to
replicate all of the analyses and visualizations in this book. We include the exact
same code that will be printed in the book. We have used the R Markdown file
format, which has an .Rmd extension, to store this code, with a file corresponding
to each chapter in the text. The R Markdown file format is a great choice for data
analysis because it allows us mix code and descriptions within the same file [51].
In fact, we even wrote the text of this book in the R Markdown format before
converting it into LaTeX for printing.
The RStudio environment offers a convenient format for viewing and editing R
Markdown files. If we open an R Markdown file in RStudio, we should see a window
similar to the one shown in Fig. 1.2. We made this image on a recent version of
macOS; the specific view may be slightly different on Windows and may change
6 1 Working with Data in R

Fig. 1.2 Default view of an R Markdown file in RStudio shown in a recent version of macOS

slightly depending on the screen size and the version of RStudio being used. On the
left is the actual file itself. Some output and other helpful bits of information are
shown on the right. There is also a Console window, which we generally will not
need. We have minimized it in the graphic, which we often do whenever working
on a smaller screen
Looking at the R Markdown file, notice that the file has parts that are on a
white background and other parts that are on a gray background. The white parts
correspond to text and the gray parts to code. In order to run the code, and to see
the output, click on the green triangle play button on the upper-right corner of each
block. When we run code to read or create a new dataset, the data will be listed in
the Environment tab in the upper-right-hand side of RStudio. Finally, clicking on
the data will open a spreadsheet version of the data that we can view to understand
the structure of our data and to see all the columns that are available for analysis.
As with any digital file, it is a good idea to make sure to save the notebook
frequently. Keep in mind, however, that only the text and code itself is saved.
The results (plots, tables, and other output) are not automatically stored. While
counterintuitive at first, this is a helpful feature because the code is much smaller
compared to the results. Saving the code helps to keep the file sizes small and tidy.
If we would like to save the results in a way that can be shared with others, we need
to knit the file by clicking on the Knit button (it has a ball of yarn icon) at the top of
the notebook. After running all the code from scratch, the knit function will produce
an HTML version of our script that we can open in a web browser.
1.4 Running R Code 7

1.4 Running R Code

Now, let’s see some examples of how to run R code. In this book, we will show
snippets of R code and the output rather than a screenshot of the entire RStudio
session. Though, know that we should think of each of the snippets as occurring
inside of one of the gray boxes in an R Markdown file. In one of its most basic
forms, R can be used as a fancy calculator. We can add 1 and 1 by typing 1+1
into the code chunk of an R Markdown file. Hitting the run button will display the
output (2) below. An example in RStudio is shown in Fig. 1.2. In the book, we will
write this code and output using a black box with the R code written inside of it.
Any output will be shown below, with each line proceeded by two hash tags. An
example is given below.

1 + 1

## [1] 2

We will often see numbers in the output surrounded by square brackets, such as the
[1] in the output above. These are a common cause of confusion and worry for
new users of R. These numbers are simply counting the values in the output. In the
example above, the [1] that it is showing that the value 2 is first output from our
code.
In addition to just returning a value, running R code can also result in storing
values through the creation of new objects within R. Objects in R are used to store
anything—such as numbers, datasets, functions, or models—that we want to use
again later. Each object has a name associated with it that we can use to access it in
future code. To create an object, we will use the <- (arrow) symbol with the name on
the left-hand side of the arrow and code that produces the object on the right-hand
side. For example, we can create a new object called mynum with a value of 8 by
running the following code.

mynum <- 3 + 5

Notice that the code here did not print any results because the result was saved as
a new object. We can now use our new object mynum exactly the same way that we
would use the number 8. For example, adding it to 1 to get the number nine:

mynum + 1

## [1] 9

Object names must start with a letter but can also use underscores and periods. We
recommend using only lowercase letters and underscores. That makes it easier to
8 1 Working with Data in R

read the code later on without needing to remember if and where we used capital
letters.

1.5 Functions in R

A function in R is something that takes a set of input values and returns an output
value. Generally, a function will have a format similar to that given in the code here:

function _name (arg1 = input1 , arg2 = input2 )

Where arg1 and arg2 are the names of the inputs to the function (they are fixed)
and input1 and input2 are the values that we will assign to them. The number
of arguments is not always two, however. There may be any number of arguments,
including zero. Also, there may be additional optional arguments that have default
values that can be modified. Let us look at an example function: seq. This function
returns a sequence of numbers. We can give the function two input arguments: the
starting point from and the ending point to.

seq(from = 1, to = 100)

## [1] 1 2 3 4 5 6 7 8 9 10 11 12
## [13] 13 14 15 16 17 18 19 20 21 22 23 24
## [25] 25 26 27 28 29 30 31 32 33 34 35 36
## [37] 37 38 39 40 41 42 43 44 45 46 47 48
## [49] 49 50 51 52 53 54 55 56 57 58 59 60
## [61] 61 62 63 64 65 66 67 68 69 70 71 72
## [73] 73 74 75 76 77 78 79 80 81 82 83 84
## [85] 85 86 87 88 89 90 91 92 93 94 95 96
## [97] 97 98 99 100

The function returns a sequence of numbers starting from 1 and ending at 100
in increments of 1. Here, we see the benefit of the square brackets in the output;
the [13] at the start of the second line indicates that the second line starts on the
13th value of the output. In addition to specifying arguments by name, we can also
pass arguments by position. When specifying arguments by position, we need to
know and use the default ordering of the arguments. Below is an example of another
equivalent way to write the code to produce a sequence of integers from 1 to 100, this
time without the argument names. (For the sake of saving space, we will sometimes
not display the output of our code, as is the case here.)

seq (1, 100)

How did we know the inputs to each function and what they do? In this text, we
will explain the names and usage of the required inputs to new functions as they
1.5 Functions in R 9

Fig. 1.3 Example documentation page for the function “seq”

are introduced. In order to learn more about all of the possible inputs to a function,
we can look at a function’s documentation. For packages to be on CRAN, they
must include information about each of the inputs to a function and the values that
are returned. In order to see the documentation, we can run a line of code that starts
with a question mark followed by the name of the function, as in the example below.
In RStudio, the information about the function will then show up in the lower-left
corner of the IDE. An example of the page is shown in Fig. 1.3

?seq
10 1 Working with Data in R

As shown in the documentation page, there is also an optional argument, called by,
that controls the spacing between each of the numbers. By default, the by argument
is equal to 1, but we can change it to spread the points out by different intervals. For
example, below are the half-numbers between 1 and 10.

seq(from = 1, to = 10, by = 0.5)

## [1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
## [11] 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0

We will learn how to use numerous functions in the coming chapters, each of which
will help us in exploring and understanding data. In order to do this, we need to first
load our data into R, which we will show in the next section.

1.6 Loading Data in R

In this book, we will be working with data that is stored in a tabular format.
Figure 1.4 shows an example of a tabular dataset consisting of information about
metropolitan regions in the United States supplied by the US Census Bureau.
These regions are called core-based statistical areas or CBSA. In Fig. 1.4, we
have ten rows and five columns. Each row of the dataset represents a particular
metropolitan region. We call each of the rows an observation. The columns in a
tabular dataset represent the measurements that we record for each observation.
These measurements are called variables.

Fig. 1.4 Example of a tabular dataset


1.6 Loading Data in R 11

In our example dataset, we have five variables which record the name of the
region, the quadrant of the country that the region exists in, the population of the
region in millions of people, the density given in tens of thousands of people per
square kilometer, and the median age of all people living in the region. More details
are given in the following section.
A larger version of this dataset, with more regions and variables, is included
in the book’s supplemental materials as a comma-separated value (CSV) file. We
will make extensive use of this dataset in the following chapters as a common
example for creating visualizations and performing data manipulation. In order to
read in the dataset, we use the function read_csv from the readr package [100].
In order to make the functions from readr available, we need to run the line of
code: library(tidyverse). As mentioned above, tidyverse will automatically
load several packages at once that we will use throughout this book. In each chapter,
we will assume that this package has already been loaded without including the
explicit library command. All other packages will be loaded once per chapter as
needed.

library ( tidyverse )

We call this function with the path to where the file is located relative to where this
script is stored. If we are running the R Markdown notebooks from the supplemental
materials, the data will be called cbsa_acs.csv and will be stored in a folder called
data. The following code will load the CBSA dataset into R, save it as an object
called cbsa, and print out the first several rows. The output dataset is stored as a
type of R object called a tibble.

cbsa <- read_csv(file.path("data", "acs_cbsa.csv"))


cbsa

## # A tibble : 934 x 13
## name geoid quad lon lat pop density
## <chr > <dbl > <chr > <dbl > <dbl > <dbl > <dbl >
## 1 New York 35620 NE -74.1 40.8 20.0 1051.
## 2 Los Angeles 31080 W -118. 34.2 13.2 1041.
## 3 Chicago 16980 NC -88.0 41.7 9.61 509.
## 4 Dallas 19100 S -97.0 32.8 7.54 323.
## 5 Houston 26420 S -95.4 29.8 7.05 317.
## 6 Washington 47900 S -77.5 38.8 6.33 364.
## 7 Philadelphia 37980 NE -75.3 39.9 6.22 506.
## 8 Miami 33100 S -80.5 26.2 6.11 430.
## 9 Atlanta 12060 S -84.4 33.7 6.03 263.
## 10 Boston 14460 NE -71.1 42.6 4.91 518.
## # 924 more rows
## # 6 more variables: age_ median <dbl >,
## # hh_ income _ median <dbl >, percent _own <dbl >,
## # rent_1br_ median <dbl >, rent_perc_ income <dbl >,
## # division <chr >
12 1 Working with Data in R

Notice that the display shows that there are a total of 934 rows and 13 columns. Or,
with our terms defined above, there are 934 observations and 13 variables. Only the
first ten observations and seven variables are shown in the output. At the bottom, the
names of the additional variable names are given. As described above, if we run this
RStudio, we can view a full tabular version of the tibble by clicking on the dataset
name in the Environment tab.
The abbreviations in square brackets above the variable names tell us the types
of data stored in each column. The abbreviation <chr>, which is seen below name,
quad (quadrant), and division, indicates that these columns contain character
data. Character data can consist of any sequence of letters, numbers, spaces, and
punctuation marks. Character variables are often used to represent fixed categories,
such as the quadrant and division of each CBSA region. They can also provide
unique identifiers and descriptions for each row, such as the name of the CBSA
region in our example. Values in a character vector are commonly called strings
throughout R documentation, a convention that we will follow in this text by using
it as a synonym for a character value.
The other abbreviation we see in the tibble from the CBSA data is <dbl>, which
indicates that a column contains numeric data. The abbreviation stands for double,
a historical designation of numeric data indicating how much computer memory is
needed to store a single value. While not seen in this example here, the abbreviation
<int> is used as an alternative abbreviation to indicate that a column contains
integer values (i.e., whole numbers). There are limited practical differences between
doubles and integers when working with R code; we will refer to any variable of
either type as numeric data.
Knowing the types of data for each column is important because, as we will
see throughout the book, they will affect the kinds of visualizations and analysis
that can be applied. The data types in the tibble are automatically determined by
the read_csv function. An optional argument col_types can be set to specify an
alternative, or we can modify data types after the tibble has been created using the
techniques shown in Chap. 3. The character and numeric data types are by far the
most common. Other possible options are explored in Chap. 7 (dates and times),
Chap. 9 (spatial variables), and Chap. 11 (lists and logical values).

1.7 Datasets

Throughout this book, we will use multiple datasets to illustrate different concepts
and show how each approach can be used across multiple application domains. We
draw on data that animates humanities inquiry in areas such as American Studies,
history, literary studies, and visual culture studies. While we will briefly reintroduce
new datasets as they appear, for readers making their way selectively through the
text, we offer a somewhat more detailed description of the main datasets that we
will use in this section.
1.7 Datasets 13

To introduce the concept of EDA, we will make sustained use of the CBSA
dataset in Chaps. 2–5 to demonstrate new concepts in data visualization and
manipulation. As described above, the data comes from an annual survey conducted
by the US Census Bureau called the American Community Survey (ACS). The
survey consists of data collected from a sample of 3.5 million households in the
United States. Outside of the constitutionally mandated decennial census, this is
the largest survey completed by the Census Bureau. It asks several dozen questions
covering topics such as gender, race, income, housing, education, and transportation.
Aggregated data are released on a regular schedule, with summaries over one-,
three-, and five-year periods. Our data comes from the five-year summary from the
most recently published version (2021) at the time of writing. We selected a small set
of measurements that we felt did not require extensive background knowledge while
capturing variations across the country. As seen in the table above, we have selected
the median age, median household income (USD), the percentage of households
owning their housing, the median rent for a one-bedroom apartment (USD), and the
median household spending on rent.
The American Community Survey aggregates data to a variety of different
geographic regions. Most regions correspond to political boundaries, such as states,
counties, and cities. One particularly interesting geographic region are the core-
based statistical areas or CBSA. These regions, of which there are nearly a thousand,
are defined by the US Office of Management and Budget. Regions are defined in
the documentation as “an area containing a large population nucleus and adjacent
communities that have a high degree of integration with that nucleus.” We chose
these regions for our dataset because their social, rather than political, definition
makes them particularly well suited for humanities research questions. Our dataset
includes a short, common name for each CBSA, as well as a unique identifier
(geoid), and several geographic categorizations derived from spatial data provided
by the Census Bureau. All of the code to produce this dataset, using the tidycensus
package within R, is included in the book’s supplementary materials [91].
The core chapters of the book also make use of a dataset illustrating the relative
change in the price of various food items for over 140 years in the United States.
This collection was published as is by Davis S. Jacks for his publication “From
boom to bust: a typology of real commodity prices in the long run” [44]. The data is
organized with one observation per year and variables capturing the relative price of
each of thirteen food commodities. We can read this dataset into R using the same
function that we used for the CBSA dataset, shown below.

food_ prices <- read_csv(file.path("data", "food_ prices .csv"))


food_ prices

## # A tibble : 146 x 14
## year tea sugar peanuts coffee cocoa wheat rye
## <dbl > <dbl > <dbl > <dbl > <dbl > <dbl > <dbl > <dbl >
## 1 1870 129. 151. 203. 88.1 78.8 88.1 103.
## 2 1871 132. 167. 222. 109. 66.7 118. 105.
## 3 1872 134. 162. 189. 140. 71.6 122. 102.
14 1 Working with Data in R

## 4 1873 136. 154. 179. 173. 65.8 116. 106.


## 5 1874 146. 153. 231. 187. 69.9 113. 126.
## 6 1875 149. 150. 197. 176. 69.4 110. 116.
## 7 1876 150. 160. 172. 184. 80.7 114. 106.
## 8 1877 149. 189. 153. 198. 87.8 144. 97.0
## 9 1878 150. 165. 160. 169. 96.0 115. 91.6
## 10 1879 144. 158. 133. 149. 108. 118. 113.
## # 136 more rows
## # 6 more variables: rice <dbl >, corn <dbl >,
## # barley <dbl >, pork <dbl >, beef <dbl >, lamb <dbl >

All of the prices are given on a relative scale where 100 is equal to the price in 1900.
We will use this dataset to show how to build data visualizations that show change
over time. It will also be useful for our study of table pivots in Chap. 5.
Part II turns to data types. The first three application chapters focus on text
analysis, temporal analysis, and network analysis, respectively. While these three
chapters introduce different methods, we will make use of a consistent core dataset
across all three that we have created from Wikipedia. Specifically, we have a
dataset consisting of the text, links, page views, and change histories of a set of
75 Wikipedia pages sampled from a set of British authors. These data are contained
in several different tables, each of which will be introduced as needed. The main
metadata for the set of 75 pages is shown in the data loaded by the following code.

meta <- read_csv(file.path("data", "wiki_uk_meta.csv.gz"))


meta

## # A tibble : 75 x 7
## doc_id born died era gender link short
## <chr > <dbl > <dbl > <chr > <chr > <chr > <chr >
## 1 Marie de France 1160 1215 Early female Mari Mari
## 2 Geoffrey Chaucer 1343 1400 Early male Geof Chau
## 3 John Gower 1330 1408 Early male John Gower
## 4 William Langland 1332 1386 Early male Will Lang
## 5 Margery Kempe 1373 1438 Early female Marg Kempe
## 6 Thomas Malory 1405 1471 Early male Thom Malo
## 7 Thomas More 1478 1535 Sixt male Thom More
## 8 Edmund Spenser 1552 1599 Sixt male Edmu Spen
## 9 Walter Raleigh 1552 1618 Sixt male Walt Rale
## 10 Philip Sidney 1554 1586 Sixt male Phil Sidn
## # 65 more rows

We decided to use Wikipedia data because it is freely available and can be easily
generated in the same format for other collection of pages that correspond to nearly
any other topic of interest. Wikipedia is also helpful because it allows us to look
at pages in other languages, which will allow us to demonstrate how to extend our
techniques to texts that are not in English. Finally, we will return to the Wikipedia
data in Chap. 12 to demonstrate how to build a dataset (specifically, this one) by
calling an API from within R using the httr package [95].
1.9 Extensions 15

Several other datasets will be used throughout the book within a single chapter.
For example, Chap. 9 on spatial data makes use of a dataset showing the location
of French cities and Parisian metro stops as a source in our study of geographic
data. Chapter 10 on image data shows a collection of documentary photographs and
associated metadata in our analysis of images. As these datasets are used only in one
section of the book, we will introduce them in more detail as they are introduced.

1.8 Formatting R Code

It is very important to properly format R code in a consistent way. Even though


the code may run without errors and produce the desired results, keeping the code
well formatted will make it easier to read and debug. We will follow the following
guidelines throughout this book:
1. One space before and after an equals sign or assignment arrow.
2. One space after a comma, but no space before a comma.
3. One space around mathematical operations (such as + and *).
4. If a line of code becomes too long, split the argument to a function into separate
lines, indenting the code two additional spaces.
We have found it makes our life a lot easier if we use these rules right from the start
and whenever we are writing R code.

1.9 Extensions

Each chapter in this book contains a short, concluding section of extensions on the
main material. These include references for further study, additional R packages,
and other suggested methods that may be of interest to the study of each specific
type of humanities data.
In this chapter, we will mention a few standard R references that might be useful
to use in parallel or in sequence with our text. The classic introduction to the core R
language is An Introduction to R by William Venables and David Smith [89]. This
is freely available directly on the same CRAN website where the R language itself
is hosted. The content is quite terse to read linearly, but it serves as a great reference
for anyone coming from another programming language who wants to learn how to
do lower-level programing tasks. We briefly cover some of this material in Chap. 12
but not in anywhere near as much detail.
For the higher-level version of R that we are using in the second edition of this
book, the standard reference is Wickham, Çetinkaya-Rundel, and Grolemund’s R
for Data Science [97]. This open-access book roughly follows the same material
covered in the first and third parts of our text. It introduces far more extensions and
often exhaustively explains all of the optional arguments to new functions. It is a
16 1 Working with Data in R

great reference text after learning the basics and can be useful as a primary text when
guided within a classroom environment to provide more motivation and context to
each technique. It does not have any material for modeling textual, network, spatial,
or image data.
When working through the code in this book’s supplemental materials, as
mentioned above, we will need to run code using the R Markdown format. More
information about the format and what can be done with it can be found in R
Markdown: The Definitive Guide [109]. The philosophy behind the format can be
found in the corresponding research focused on reproducible research pipelines
[107, 108]. Recently, Quarto, a new extension of the R Markdown format, has
quickly gained in popularity [74]. It provides an almost backward compatible
version of R Markdown while extending the functionality to all mixing in other
programing languages.
Chapter 2
EDA I: Grammar of Graphics

2.1 Introduction

As we outlined in Chap. 1, the concept of exploratory data analysis (EDA) is key


to our approach. As a result, data visualization is one of the most important tasks
and powerful tools for the analysis of data. We start our study of exploratory data
analysis with visualization because it offers the best immediate payoff for how
statistical programming can help understand datasets of any size. Visualizations also
have the benefit for those new to programming because it is relatively easy to verify
that our code is working. We can just look at the output and see if the resulting plot
is what we expected. Finally, data visualizations can be useful for even very small
collections of data.
In this chapter, we will learn and use the ggplot2 package for building informa-
tive graphics [94, 106]. The package makes it easy to build fairly complex graphics
in a way that is guided by a general theory of data visualization. The only downside
is that, because it is built around a theoretical model rather than many one-off
solutions for different tasks, it has a somewhat steeper initial learning curve. The
chapter is designed to get us started using the package to make a variety of different
data visualizations.
The core idea of the grammar of graphics is that visualizations are composed
of independent layers. The term “grammar” is used to describe visualizations
because the theory builds connections between elements of the dataset to elements
of a visualization. It builds up complex elements from smaller ones, much like a
grammar provides relations between words in order to generate larger phrases and
sentences. To describe a specific layer, we need to specify several elements. First, we
need to specify the dataset from which data will be taken to construct the plot. Next,
we have to specify a set of mappings called aesthetics that describe how elements
of the plot are related to columns in our data. For example, we often indicate which

© The Author(s), under exclusive license to Springer Nature Switzerland AG 2024 17


T. Arnold, L. Tilton, Humanities Data in R, Quantitative Methods in the Humanities
and Social Sciences, https://doi.org/10.1007/978-3-031-62566-4_2
18 2 EDA I: Grammar of Graphics

column corresponds to the horizontal axis of the plot and which one corresponds to
the vertical axis of the plot. It is also possible to describe elements such as color,
shape, and size of elements of the plot by associating these quantities with columns
in the data. Finally, we need to provide the geometry that will be used in the plot.
The geometry describes the kinds of objects that are associated with each row of
the data. A common example is the points geometry, which associates a single point
with each observation.
We can show how to use the grammar of graphics by starting with the CBSA
data that we introduced in the previous chapter, where each row is associated with
a particular metropolitan region in the United States. The first plot we will make is
a scatterplot that investigates the relationship between the median price of a one-
bedroom apartment and the population density of the metropolitan region. In the
language of the grammar of graphics, we can start to describe this visualization by
providing the name of the dataset in R (cbsa). Next, we associate the horizontal
axis (called the x aesthetic) with the column in the data named density. The
vertical axis (the y aesthetic) can similarly be associated with the column named
rent_1br_median. We will make a scatterplot, with each point on the plot
describing one of our metropolitan regions, which leads us to use a point geometry.
Our plot will allow us to understand the relationship between city density and rental
prices.
In R, we need to use some special functions to indicate all of this information
and to instruct the program to produce a plot. We start by indicating the name of the
underlying dataset and piping it into a special function called ggplot that indicates
that we want to create a data visualization. The plot itself is created by adding—
literally, with the plus sign—the function geom_point. This function indicates that
we want to add a points geometry to the plot. Inside of the geometry function, we
apply the function aes (short for aesthetics), which indicates that we want to specify
the mappings between components of the plot and column names in our dataset.
Code to write this using the values described in the previous paragraph is given
below. A breakdown of the role of each component is detailed in Fig. 2.1.

cbsa |>
ggplot () +
geom_ point(aes(x = density , y = rent_1br_ median ))

select (cbsa , name , quad , density , rent_1br_ median )

## # A tibble : 30 x 4
## name quad density rent_1br_ median
## <chr > <chr > <dbl > <dbl >
## 1 New York NE 1051. 1430
## 2 Los Angeles W 1041. 1468
## 3 Chicago NC 509. 1060
## 4 Dallas S 323. 1106
## 5 Houston S 317. 997
## 6 Washington S 364. 1601
2.1 Introduction 19

## 7 Philadelphia NE 506. 1083


## 8 Miami S 430. 1230
## 9 Atlanta S 263. 1181
## 10 Boston NE 518. 1390
## # 20 more rows

Fig. 2.1 Diagram of how the elements of the grammar of graphics correspond to elements of the
code and visualization
20 2 EDA I: Grammar of Graphics

Fig. 2.2 Plot of the largest 30 core-based statistical areas in the United States, showing their
density and the median price to rent a one-bedroom apartment from the 2021 American Community
Survey

Running the code above from an RMarkdown file opened in R Studio will show the
desired visualization right below the block of code. Within this book, we will show
the results of plots within figures. The plot here is shown in Fig. 2.2. In this plot,
each row of our dataset, a CBSA region, is represented as a point in the plot. The
location of each point is determined by the density and median rent price for a one-
bedroom apartment in the corresponding region. Notice that R has automatically
made several choices for the plot that we did not explicitly indicate in the code, for
example, the range of values on the two axes, the axis labels, the grid lines, and
the marks along the grid. R has also automatically picked the color, size, and shape
of the points. While the defaults work as a good starting point, it is often useful to
modify these values; we will see how to change these aspects of the plot in later
sections of this chapter.
Scatterplots are typically used to understand the relationship between two
numeric values. What does our first plot, shown in Fig. 2.2, tell us about the
relationship between city density and median rent? There is not a clear trend
between these two variables. Rather, the plot of these two economic metrics clusters
the regions into several groups. We see a couple of regions with a very high density
but only moderately large rental prices, one city with unusually high rental prices,
and the rest of the regions fairly uniformly distributed in the lower-left corner of the
2.2 Text Geometry 21

plot. Let’s see if we can give some more context to the plot by adding additional
information.

2.2 Text Geometry

A common critique of computational methods is that they obscure a closer


understanding of each individual object of study in an attempt to search for
numeric patterns. This is certainly an important caution; computational analysis
of humanities data should always be paired with close analysis. However, it does
not always have to be the case that visualizations reduce complex collections to a
few numerical summaries. This is particularly so when working with a dataset that
has a relatively small number of observations. Looking back at our first scatterplot,
how could we recover a closer analysis of individual cities while also looking for
general patterns between the two economic variables? One option is to add labels
indicating the names of the regions. These names would let anyone looking at the
plot to adding their own understanding of the individual regions as an additional
layer of information as they interpret the plot.
Adding the names of the regions can be done by using another type of geometry
called a text geometry. This geometry is created with the function geom_text. For
each row of a given dataset, this geometry adds a small textual label. As with the
point geometry, it requires us to specify which columns of our data correspond to the
x and y aesthetics. These values tell the plot where to place the label. Additionally,
the text geometry requires an aesthetic called label that indicates the column of the
dataset that the label should take its text from. In our case, we will use the column
called name to make textual labels on the plot, a reminder that this is a column name
from the data that we loaded into R. The code block below produces a text label
plot by changing the geometry type and adding the additional aesthetic from the
previous example.

cbsa |>
ggplot () +
geom_text(aes(
x = density , y = rent_1br_median , label = name
))

The plot generated by the code is shown in Fig. 2.3. We can now see which region
has the highest rents (San Francisco). And, we can identify which regions have the
highest density (New York and Los Angeles). We can also identify regions such as
Detroit that are relatively dense but inexpensive or regions such as Denver that are
not particularly dense but still one of the more expensive regions to rent in. While
we have added only a single additional piece of information to the plot, each of
the labels uniquely identifies each row of the data. This allows anyone familiar with
metropolitan regions in the United States to bring many more characteristics of each
22 2 EDA I: Grammar of Graphics

Fig. 2.3 Plot of the largest 30 core-based statistical areas in the United States, showing their
density and the median price to rent a one-bedroom apartment from the 2021 American Community
Survey. Here, short descriptive names of the regions are included

data point to the plot through their own knowledge. For example, while the plot does
not include any information about overall population, anyone who knows the largest
cities in the United States can use the plot to see that the two most dense cities (New
York and Los Angeles) are also the most populous. And, while the plot does not have
information about the location of the regions, if we know the general geography of
the country, it is possible to see that many of the cities that are expensive but not
particularly dense (Portland, Denver, Seattle, and San Diego) are on the West Coast.
These observations point to the power of including labels on a scatterplot.
While the text plot adds additional contextual information compared to the
scatterplot, it does have some shortcomings. Some of the labels for points at the
edges of the plot fall off and become truncated. Labels for points in the lower-left
corner of the plot start to overlap one another and become difficult to read. These
issues will only grow if we increase the number of regions in our dataset. Also, it is
not entirely clear what part of the label corresponds to the density of the cities. Is it
the center of the label, the start of the label, or the end of the label? We could add a
note that the value is the center of the label, but that becomes somewhat cumbersome
to have to constantly remember and remind ourselves and others about.
To start addressing these issues, we can add the points back into the plot with
the labels. We could do this in R by adding the two geometry layers (geom_point
and geom_text) one after the other. This will make it more clear where on the x-
2.2 Text Geometry 23

axis each region is associated to but at the same time will make the names of the
cities even more difficult to read. To fix the second problem, we will replace the text
geometry with a different geometry called geom_text_repel. It also places labels
on the plot but has special logic that avoids intersecting labels. Instead, labels are
moved away from the data points and connected (when needed) by a line segment.
As with the text geometry, the text repel geometry requires specifying x, y, and
label aesthetics. Below is the code to make both of these modifications.

library ( ggrepel )

cbsa |>
ggplot () +
geom_ point(aes(x = density , y = rent_1br_ median )) +
geom_text_ repel(aes(
x = density , y = rent_1br_median , label = name
))

The output of the plot with the points and text repelled labels is shown in Fig. 2.4.
Notice that the repel feature has attempted to avoided writing labels that intersect
one another. It has also tried to avoid having the labels intersect the points and avoid

Fig. 2.4 Plot of the largest 30 core-based statistical areas in the United States, showing their
density and the median price to rent a one-bedroom apartment from the 2021 American Community
Survey. Here, short descriptive names of the regions are included but offset from the points to make
the plot easier to read
24 2 EDA I: Grammar of Graphics

having the labels get pushed outside of the plot. Since the points indicate the specific
values of the density and median rents, the labels are free to float around as long as it
is clear which label is associated with each point. Some of the labels do still become
a bit busy in the lower left-hand corner; this could be fixed by making the size of
the labels slightly smaller, which we will learn how to do later in the chapter. Once
the number of points becomes larger, it will eventually not be possible to label all
of the points. Several strategies exist for dealing with this, such as only labeling a
subset of the points. We will see these techniques as they arise in our examples. The
ggplot2 package and communities online have an entire ecosystem of strategies
for increasing interpretability and adding context to plot, providing strategies for
using the exploratory and visual power of data visualization to garner insights from
humanities data.

2.3 Lines and Bars

There a large number of different geometries supplied by the ggplot2 package, in


addition to the even larger collection of extensions by other R packages. We will
look at two other types of geometries in this section that allow us to investigate
common relationships between pairs of columns of a dataset. Other geometries
will be discussed throughout the book as the need arises, and the full list of
geometries can be found in the ggplot2 package’s documentation. A summary of
all the geometries shown in this chapter is given in Fig. 2.5.
For a moment, we will switch gears and look at the food prices dataset, which was
introduced in the previous chapter. This data contains one row for every year from
1870 through 2015, with relative prices for thirteen different food items across the
United States [44]. Consider a visualization showing the change in the price of tea
over the 146 years in the dataset. We could create a scatterplot where each point is a
row of the data, the x aesthetic captures the year of each record, and the y aesthetic
measures the relative cost of tea. This visualization would be fine and could roughly
help us understand the changes in relative prices for this commodity. A common
visualization type, however, for data of this format is a line plot, where the price in
each year is connected by a line to the price in the subsequent year. To create such
a plot, we can use the geom_line geometry. This is most commonly used when the
horizontal axis measures some unit of time but can represent other quantities that we
expect to continuously and smoothly change between measurements on the x-axis.
The line geometry requires the same aesthetics as the point geometry and can be
created with the same syntax, as shown in the following block of code.

food_ prices |>


ggplot () +
geom_line(aes(x = year , y = tea))
2.3 Lines and Bars 25

Fig. 2.5 Examples of common geometries used in the grammar of graphics


26 2 EDA I: Grammar of Graphics

Fig. 2.6 Plot of the price of tea in standardized units (100 is the price in 1900) over time

The output of this visualization, shown in Fig. 2.6, allows us to see the change over
time of the tea prices. Notice that the relative price decreased fairly steadily from
1870 through to 1920. It had a few sudden drops and reversals in the 1920s and
1930s, before increasing again in the 1950s. The relative cost of tea then decreased
again fairly steadily from the mid-1950s through to the end of the data range in
2015.
Another common usage of a visualization is to see the value of a numeric column
of the dataset relative to a character column of the dataset. It is possible to represent
such a relationship with a geom_point layer. However, it is often more visually
meaningful to use a bar for each category and the height or length of the bar
representing the numeric value. This type of plot is most common when showing
the counts of different categories, something we will see in the next chapter, but
can also be used in any situation where a numeric value is associated with different
categories. To create a plot with bars, we use the geom_col function, providing both
x and y aesthetics. R with automatically create vertical bars if we have a character
variable associated with the x aesthetic and horizontal bars if we have one in the
y aesthetic. Putting the character variable on the y-axis usually makes it easier to
read the labels, so we recommend it in most cases. In the code block below, we have
the commands to create a bar plot of the population in each region from the CBSA
dataset, which will be shown in Fig. 2.7.
2.4 Optional Aesthetics 27

Fig. 2.7 Plot of the population of the largest 30 core-based statistical areas in the United States,
showing their population from the 2021 American Community Survey

cbsa |>
ggplot () +
geom_col(aes(x = pop , y = name))

One of the first things that stands out in the output shown in Fig. 2.7 is that the
regions are ordered alphabetically from bottom to top. The visualization would be
much more useful and readable if we could reorder the categories on the y-axis. This
is also something that we will address in the following chapter. For now, we can see
how ggplot2 is offering a range of plot types to see our data from different angles.
We can add additional context through additional aesthetics.

2.4 Optional Aesthetics

In the previous sections, we have shown how visualizations can be built out of
geometry layers, where each geometry is associated with a dataset and a collection
of variable mappings known as aesthetics. The point, line, and bar geometries
require x and y aesthetics; the text and text repel geometries also required an
aesthetic named label. In addition to the required aesthetics, each geometry
28 2 EDA I: Grammar of Graphics

Fig. 2.8 Plot of the largest 30 core-based statistical areas in the United States, showing their
density and the median price to rent a one-bedroom apartment from the 2021 American Community
Survey. Here, the points are colored based on the quadrant in which the city is found in the United
States

type also has a number of optional aesthetics that we can use to add additional
information to the plot. For example, most geometries have a color aesthetic. The
syntax for describing this is exactly the same as with the required aesthetics: we
place the name of the aesthetic followed by the name of the associated variable
name. Let’s see what happens when we add a color aesthetic to our scatterplot
by relating the column called quad to the aesthetic named color. Below is the
corresponding code; the output is shown in Fig. 2.8.

cbsa |>
ggplot () +
geom_ point(aes(
x = density , y = rent_1br_median , color = quad
))

The result of associating a column in the dataset with a color produces a new
variation of the original scatterplot. We have the same set of points and locations on
the plot, as well as the same axes. However, now each color has been automatically
associated with a region and every point has been colored according to the region
column associated with each row of the data. The mapping between colors and
2.4 Optional Aesthetics 29

region names is shown in an automatically created legend on the right-hand side of


the plot. The ability to add additional information to the plot by specifying a single
aesthetic speaks to how powerful the grammar of graphics is in terms of quickly
producing informative visualizations of data. In the first edition of this text, which
used the built-in graphics system in R, it was necessary to write nearly a dozen lines
of code to produce a similar plot. Now that we are able to use the ggplot2 package,
this process has been greatly simplified.
In the previous example, we changed the color aesthetic from the fixed default of
black to a color that changes with another variable. It is also possible to specify an
alternative, fixed value for any aesthetic. We can draw on the color names available
in R. For example, we might want to change all of the points to be a shade of green.
This can be done with a small change to the function call. To do this, we set the
color aesthetic to the name of a color, such as “red.” However, unlike with variable
aesthetics, the mapping needs to be done outside of the aes() function but still
within the geom_* function. Below is an example of the code to redo our plot with
a different color; we use a color called “olivedrab,” which in print is much more
aesthetically pleasing than its name might at first suggest.

cbsa |>
ggplot () +
geom_ point(aes(
x = density , y = rent_1br_ median
), color = " olivedrab")

While minor, the changed notation for specifying fixed aesthetics is a common
source of confusing errors for users new to the geometry of graphics, so be careful to
follow the correct syntax of arguments as in the code above. One can interchange the
fixed and variable aesthetic commands, and the relative order should not effect the
output. Just be sure to put fixed terms after finishing the aes() command (Fig. 2.9).
While each geometry can have different required and optional aesthetics, the
ggplot2 package tries as much as possible to use a common set of terms for the
aesthetics in each geometry. We have already seen the x, y, and label aesthetics
in the previous sections and just introduced the color aesthetic. Color can also
be used to change the color of a line plot or the color of the font in a text or text
repel geometry. For applications such as the bar plot, we might want to modify both
the border and interior colors of the bars; these are set separately by the color
and fill aesthetics, respectively. The size aesthetic can be used to set the size
of the points in a scatterplot or the font size of the labels in a text geometry. The
shape aesthetic is used to modify the shape of the points. An aesthetic named
alpha controls the opacity of points, with a value of 1 being the default and 0
being completely invisible. Some of these, such as alpha, are most frequently used
with fixed values, but if needed, almost all can be given a variable mapping as well.
30 2 EDA I: Grammar of Graphics

Fig. 2.9 Plot of the largest 30 core-based statistical areas in the United States, showing their
density and the median price to rent a one-bedroom apartment from the 2021 American Community
Survey. The color of the points has been changed to a dark green called “olivedrab”

2.5 Scales

R makes many choices for us automatically when creating any plot. In our example
above, Fig. 2.8, in which we set the color of the points to follow another variable
in the dataset, R handles the details of how to pick the specific colors and sizes.
It has figured how large to make the axes, where to add tick marks, and where to
draw grid lines. Letting R deal with these details is convenient because it frees us
up to focus on the data itself. Sometimes, such as when preparing to produce plots
for external distribution, or when the default are particularly hard to interpret, it is
useful to manually adjust these details. This is exactly what scales were designed
for.
Each aesthetic within the grammar of graphics is associated with a scale. Scales
detail how a plot should relate aesthetics to the concrete, perceivable features in a
plot. For example, a scale for the x aesthetic will describe the smallest and largest
values on the x-axis. It will also code information about how to label the x-axis.
Similarly, a color scale describes what colors corresponds to each category in a
dataset and how to format a legend for the plot. In order to change or modify the
default scales, we add an additional function to the code. The order of the scales
2.5 Scales 31

relative to the geometries do not effect the output; by convention, scales are usually
grouped after the geometries.
For example, a popular alternative to the default color palette shown in our
previous plot is the function scale_color_viridis_d(). It constructs a set of
colors that is color-blind friendly, looks nice when printed in black and white, and
displays fine on bad projectors. After specifying that the color of a geometry should
vary with a column in the dataset, we specify that viridis color scale by adding the
function as an extra line in the plot. An example is shown in the following code.

cbsa |>
ggplot () +
geom_ point(aes(
x = density , y = rent_1br_median , color = quad
)) +
scale_ color_ viridis _d()

The output shown in Fig. 2.10 shows that the colors are now given by a range from
dark purple to bright yellow in place of the rainbow of colors in the default plot.
As with the categories in the bar plot, the ordering of the unique colors is given

Fig. 2.10 Plot of the largest 30 core-based statistical areas in the United States, showing their
density and the median price to rent a one-bedroom apartment from the 2021 American Community
Survey. Here, the points color based on the quadrant in which the city is found in the United States,
with a color-blind friendly color scale
32 2 EDA I: Grammar of Graphics

by putting the categories in alphabetical order. Changing this requires modifying


the dataset before passing it to the plot, something that we will discuss in the next
chapter. Note that the _d at the end of the scale function indicates that the colors are
used to create a set of mappings for a character variable (it stands for “discrete”).
There is also a complimentary function scale_color_viridis_c that produces
a similar set of colors when making the color of the points change according to
a numeric variable. The code below demonstrates the continuous case, where the
population is treated as a numeric variable.

cbsa |>
ggplot () +
geom_ point(aes(
x = density , y = rent_1br_median , color = pop
)) +
scale_ color_ viridis _c()

Many other scales exist to control a variety of aesthetics. For example,


scale_size_area can be used to make the size of the points proportional to
one of the other columns in a dataset. There are also several scales to control the x
and y axes. For example, we can add scale_x_log10() and scale_y_log10()
to a plot to produce values on a logarithmic scale, which can be very useful when
working with heavily skewed datasets. We will use this in later chapters as needed.
The default scale for the x-axis is called scale_x_continuous. A correspond-
ing function scale_y_continuous is the default for the y-axis. Adding these to a
plot on their own has no visible effect. However, there are many helpful optional
arguments that we can provide to these functions that change the way a plot is
displayed. Setting n.breaks within one of these scales tells R the (approximate)
number of labels to put on the axis. Also, making minor_breaks equal to NULL
turns off the minor grid lines. We can set the value limits to a pair of numbers
in order to describe the starting and ending range on a plot. Below is the code to
produce the plot in Fig. 2.11, which shows the same data as our original scatterplot,
but now with modified grid lines, axis labels, and vertical range.

cbsa |>
ggplot () +
geom_ point(aes(x = density , y = rent_1br_ median )) +
scale_x_ continuous (n. breaks = 10, minor_ breaks = NULL) +
scale_y_ continuous ( limits = c(0, 2000))

Finally, there are two special scale types that can be useful for working with colors.
In some cases, we may already have a column in our dataset that explicitly describes
the color of an observation; here, it would make sense to use these colors directly. To
do that, we can add the scale scale_color_identity to the plot. Another type of
scale that can be useful for colors is scale_color_manual. Here, it is possible to
describe exactly which color should be used for each category. Below is the syntax
for producing manually defined colors for each region in the CBSA dataset.
Random documents with unrelated
content Scribd suggests to you:
Sur le quai, et dans les deux rues parallèles en arrière du quai,
Water street et Main street, se trouvent les bureaux, magasins,
hôtels, banques, boutiques de General store keeper, magasins
généraux où l’on vend de tout. Les consulats y sont installés
également ; sur la colline, les maisons d’habitation que l’on regagne
le soir, une fois les bureaux fermés. Yokohama a toujours été, depuis
l’ouverture du Japon, la grosse place commerciale, et c’est là que se
trouve encore aujourd’hui la colonie la plus importante d’Européens
et d’Américains. Le « United club » les réunit dans une même
fraternité, et dans ces réunions il n’est jamais question de
nationalités : on est « blanc ».
De magnifiques hôtels se dressent sur le quai : le Grand-Hôtel,
fondé jadis par un Français, actuellement passé dans les mains
d’une Société américaine et où fréquentent principalement les
Américains de passage au Japon, qui sont toujours très nombreux.
— L’Oriental Hôtel, créé et tenu encore par un Français,
somptueusement meublé et décoré et où l’on mange une cuisine qui
n’a pas sa pareille dans tout le Japon. — Enfin le Club-Hôtel, plus
modeste, mais où l’on trouve cependant tout le confortable
désirable.
La colline ou « bluff » est une ravissante petite ville européenne
que rien absolument ne distingue d’une localité quelconque des
environs de Paris, telles Ablon ou Savigny-sur-Orge. Petites villas
coquettes, entourées d’un jardin ; rues très propres et très soignées,
mais aucun cachet particulier. Passé la petite ville, se trouve le
champ de courses, non loin de la Mississipi bay, charmante petite
baie, ainsi nommée par les Américains, lorsqu’en 1852 ils arrivèrent
pour la première fois au Japon. Le champ de courses est la grande
promenade pour les habitants et deux fois par an, au printemps et à
l’automne, les courses y réunissent toute la ville. Ce sont alors les
grands jours de Yokohama.
Les environs de Yokohama sont tous fort agréables, et les jours
fériés voient de nombreux excursionnistes qui, sans s’éloigner
beaucoup, peuvent charmer leurs loisirs au milieu de la verdure des
petites collines qui dressent leurs sommets autour de la baie.
Aujourd’hui, avec le chemin de fer, les environs immédiats de la
ville sont un peu abandonnés, mais on va souvent plus loin pour
trouver des endroits moins agréables.

IV. — Yokohama est donc le point extrême pour les paquebots


qui viennent d’Europe ; il l’est aussi pour ceux qui viennent
d’Amérique ; de ce côté également, plusieurs Compagnies font le
service : trois entre les États-Unis et le Japon ; une entre le Canada
et le Japon.
Les trois Compagnies qui, de Yokohama, rejoignent les États-Unis
sont :
L’Occidental et Oriental qui va à San-Francisco ;
L’American pacific mail qui va également à San-Francisco ;
La Nippon Yu sen Kwaisha qui va à Seattle.
Celle qui fait le service du Canada est la Canadian Pacific qui
aboutit à Vancouver.
Ces bateaux mettent douze jours de Yokohama à Vancouver et
quatorze de Yokohama à San-Francisco ; les bateaux américains, une
fois sur deux, font relâche à Honolulu ; le départ a lieu tous les
quinze jours.
De Paris à Yokohama par cette route, il faut compter une
trentaine de jours ; en effet :

1o de Paris à Londres 1 jour


de Londres à Liverpool 1 —
de Liverpool à Montréal 8 —
de Montréal à Vancouver 5 —
de Vancouver à Yokohama 12 —

Total 27 jours.

Comme on ne peut pas voyager comme une lettre, il faut


compter trois ou quatre jours de plus.
2o de Paris au Havre 1 jour
du Havre à New-York 7 —
de New-York à San-Francisco 5 —
de San-Francisco à Yokohama 14 —

Total 27 jours.

Mais en revanche, le voyage de ce côté coûte plus cher et il faut


compter sur 3.000 francs en première classe ; le moindre séjour en
Angleterre et en Amérique est onéreux et les dépenses effectuées
dans les wagons-restaurants et en bateau sont également très
élevées. Aussi, en dehors des Américains, peu de voyageurs
choisissent cette route qui double presque le tarif du voyage par
l’Océan Indien ou la Sibérie.

V. — En arrivant au Japon, l’étranger ne doit pas s’attendre à


trouver des monuments, de belles constructions architecturales, des
villes de granit et de marbre comme en Europe et en Amérique.
Lorsqu’il a débarqué à Yokohama, à Kobé ou à Nagasaki, et qu’il a
suffisamment parcouru les rues quasi-européennes bordées de
bengalows ou de villas sans style, quelconques, maisons carrées en
briques et bois, construites non pour l’art mais pour le confort et
pour la résistance aux tremblements de terre, il a hâte de connaître
quelque ville indigène, comptant sur une surprise agréable, avec
l’espoir de découvrir quelque chose de riant et de gai. Le Japon,
pour le voyageur qui vient d’Europe, n’est-ce pas le bariolage des
kakémonos ?
Eh bien, il faut le détromper. L’aspect de toute ville japonaise est
immensément triste. Tout est gris. Des maisons basses, en bois
devenu gris avec le temps, recouvertes de tuiles noires, se
succèdent sans interruption ; des habitants, hommes et femmes,
vêtus de couleurs grises (il n’y a que les enfants et les jeunes filles
habillés de couleurs voyantes aux jours de fête) : tout cela donne
une impression complètement dépourvue de gaîté. Dans de grands
centres comme Tokio, Kioto, Osaka, quelques vastes temples rouges,
à la toiture énorme, apportent à certaines parties de la ville un
cachet qui ne manque pas d’une réelle grandeur, mais les villes elles-
mêmes sont misérables et tristes.
Ce qu’il faut voir au Japon c’est la nature, toujours plaisante et
gracieuse, en hiver comme en été, au printemps comme en
automne ; rien de grand, rien d’imposant comme à Java, comme
dans l’Inde, comme dans certaines parties de la Chine occidentale ;
mais tout est souriant, aimable et doux. La nature japonaise n’est
pas empoignante, elle est reposante et accueillante ; même ses
volcans terribles, le Fuji yama, l’Asama, le Onsengatake n’offrent rien
d’effrayant. Les cascades gigantesques comme celles de Kégon à
Chusenji ou de Kirifuri à Nikkô semblent des joujoux de cascades. Et
toujours la même pensée vient à l’esprit du voyageur quand il a
visité un peu ce pays : comment cette nature, en somme si calme et
si gentille, a-t-elle pu conserver aux habitants ce caractère batailleur
des anciens « hommes à deux sabres », caractère encore sensible
aujourd’hui sous une couche d’occidentalisme, à vrai dire très
mince ?
CHAPITRE V

I. La vie indigène ; la nourriture. — II. Coût de la vie au Japon ;


cherté des denrées et des loyers. — III. Hôtels à l’européenne. —
IV. La famille japonaise, sa constitution, ses mœurs. Situation de
la femme et des enfants.

I. — La nourriture, en général, est fort simple : le riz en est la


base principale avec le poisson, dont les mers du Japon abondent.
Cependant aujourd’hui on commence à trouver du pain un peu
partout, dans les grands centres, et aussi de la viande de boucherie.
Néanmoins le Japonais préfère son riz, son poisson et ses légumes,
et si vous l’invitez à dîner et, par conséquent, s’il mange du pain
chez vous, soyez sûr qu’en rentrant chez lui il mangera son bol de
riz ; s’il n’a pas son riz, il n’a pas dîné.
Le poisson se prépare de différentes façons : grillé souvent et
quelquefois cru. Cependant on n’offre guère du poisson cru (dorade
ou carpe) que dans les grandes occasions ; on prend alors le poisson
vivant ; on l’écaille et on le coupe tel quel et on mange les tranches
en les trempant dans une sauce noire appelée shôyu. Au début cela
paraît bizarre, mais on s’y fait.
Les œufs forment aussi une partie de la nourriture japonaise ; ils
en préparent une sorte d’omelette que l’on consomme froide.
Comme légumes, les Japonais ont tous les nôtres ; mais en plus ils
mangent : les oignons de lys ; les racines de lotus ; les jeunes tiges
de fougère ; les jeunes pousses de bambou ; ils aiment beaucoup les
fruits confits dans une espèce de vinaigre ; différentes espèces
d’herbes conservées d’une certaine manière. En somme ils ont un
régime plutôt végétarien. Quelquefois, cependant, quand ils ont un
ami, ils tueront un poulet et feront un « torinabé » ou poulet à la
casserole en le cuisant avec du sucre et du vin de riz (sake).
Les sucreries sont fort appréciées au Japon ; aussi les boutiques
de pâtissiers et les marchands de bonbons ambulants sont-ils
nombreux.
Tout le monde, hommes et femmes, fume au Japon, l’usage des
cigarettes est devenu assez répandu ; mais cependant on a conservé
l’habitude de la petite pipe en métal d’où l’on tire deux bouffées et
qu’on bourre sans cesse avec du tabac coupé aussi fin que des
cheveux.
On a souvent dit que les Japonais étaient très propres et je l’ai
constaté moi-même. Ils ont la propreté du corps, mais ils n’ont pas
le sens de la propreté des objets dans les mêmes proportions que
l’Européen. Ainsi tout Japonais qui se respecte ira prendre un bain
chaud après son dîner ; celui qui n’a pas son « fourô » (baignoire)
chez lui, va aux bains publics où les hommes et les femmes sont
ensemble (séparés par une corde) ; mais, d’un autre côté, votre
servante essuiera très bien, avec la même serviette, le vase de nuit
d’abord et votre assiette ensuite.

II. — Il y a une trentaine d’années la vie était normale, je veux


dire bon marché, et une famille japonaise pouvait vivre facilement
avec quinze yen par mois. C’était le bon temps, mais on n’avait pas
de « gloire ». Maintenant on a de la gloire, mais elle coûte très cher,
et la vie est devenue tellement coûteuse qu’actuellement la famille,
qui dépensait quinze yen, est obligée d’en dépenser cinquante. Il
s’ensuit que la misère est effrayante aujourd’hui au Japon ; il est vrai
que personne ne s’en plaint et on la supporte sans murmurer jusqu’à
présent. Cela durera-t-il ? Tout est imposé à l’extrême et le pays rend
tout ce qu’il peut rendre ; car il est pauvre et ses possibilités sont
très limitées.
Si la cherté de la vie a ainsi augmenté pour l’indigène, c’est
naturellement encore bien pis pour l’Européen, qui lui ne se contente
pas de riz et de légumes, mais qui a besoin de viande, de pain, de
vin, d’huile, de vinaigre, de sucre raffiné, de thé, de café, d’alcool,
de pâtes alimentaires, et en général d’une foule de choses qu’il lui
faut importer d’Europe ou d’Amérique. Achat, transport, et droits de
douane formidables font monter les denrées nécessaires à
l’Européen à un prix tellement élevé qu’il faut être très riche
aujourd’hui pour vivre au Japon à l’européenne.
Une maison japonaise, que l’on payait jadis 30 yen par mois, en
vaut 90 aujourd’hui, un domestique que l’on payait 10 yen en
réclame 30, et tout est à l’avenant.

III. — Autrefois, depuis le moment où le Japon a été ouvert aux


Européens, ces derniers devaient habiter dans les cinq ports ouverts
de Yokohama, Nagasaki, Kobé, Niigata et Hakodate ; ils ne
pouvaient, sous aucun prétexte, résider en dehors sans passeport
délivré par les autorités japonaises ; plus tard les villes de Tokio et
d’Osaka leur furent ouvertes, mais ils furent parqués dans une
certaine partie de la ville avec défense de demeurer en dehors des
limites fixées. Ce régime a pris fin avec la révision des traités, et
depuis 1899 les Européens ont le droit de résider et de voyager
partout au Japon sans être inquiétés. On trouve, dans tous les
grands centres, des hôtels installés à l’européenne et où l’on donne
une nourriture anglo-japonaise d’un goût douteux. Tokio possède
l’Imperial Hôtel, grand bâtiment en pierre, secoué plusieurs fois
violemment par les tremblements de terre ; le Métropole Hôtel, plus
modeste, mais où l’on avait, autrefois, une cuisine assez convenable
quand il était dirigé par un Français.
Kiôtô. — Kiôtô-Hôtel, très bien situé dans la partie centrale de la
ville ; Myako-Hôtel ; Nakamura rô ; Ya ami Hôtel ; situé dans le parc
de Maruyama, il est d’un séjour fort agréable ; les prix sont d’environ
5 à 6 yen par jour.
Osaka. — Osaka-Hôtel à Nakanoshima, et Nippon-Hôtel. Les
hôtels d’Osaka sont peu fréquentés, parce que les étrangers résident
plutôt à Kiôtô et à Kobé et ne vont qu’en passant à Osaka.
Nagasaki. — Cliff House ; Nagasaki Hôtel sur la colline ; Japan
Hôtel ; Hôtel Antonetti ; Hôtel de France, sur la mer ; 5, 6 et 10 yen
par jour.
Kobé. — Club Hôtel ; Grand Hôtel ; Hôtel Français ; Oriental Hôtel
Limited, le plus ancien hôtel de Kobé, très confortable : 5, 6 et 10
yen par jour.

IV. — Il va sans dire que le touriste ou même le négociant, qui


veut goûter la saveur locale, peut toujours descendre dans un des
nombreux hôtels japonais, qui se disputent les voyageurs sur tout le
territoire de l’Empire. Il aura soin, alors, de retirer ses souliers avant
d’entrer (bien des Européens, refusant de le faire, ont ainsi nui au
bon renom occidental et ils ont fermé beaucoup d’hôtels indigènes
aux étrangers) ; il s’assoiera sur les talons, les jambes repliées sous
lui, et il dormira sur le tatami ou grosse natte de paille dans l’épais
fouton (couverture ouatée). Passer quelque temps dans une auberge
japonaise n’a rien de désagréable en somme ; et cela permet de
prendre contact avec la vie et les coutumes indigènes.
Malgré l’installation des étrangers dans les grands centres, il est
bien évident que les mœurs ne se sont point modifiées ; un peuple
ne change pas de mentalité en l’espace de cinquante ans, et, s’il lui
est relativement facile d’adopter la civilisation matérielle de
l’Occident, il lui est plus difficile de changer complètement son
système social.
En Europe, le foyer est constitué par la femme, la mère de
famille ; c’est autour d’elle que l’on se réunit, c’est vers elle que tout
converge. Au Japon il n’y a pas de foyer. La femme ne compte pas ;
le père seul existe, c’est lui le pivot de la famille japonaise ; il est le
représentant de la race et son continuateur. Cependant,
contrairement à certains pays d’Orient, où la femme est séquestrée
ou tenue dans une situation tout à fait inférieure, au Japon la femme
n’est soumise à aucune réclusion jalouse ; elle tient un rang
honorable dans la société et partage les récréations de ses parents
et de son mari, quoique jamais elle ne soit initiée à leurs affaires.
Laissée très libre, elle abuse rarement de cette liberté, bien que,
naturellement, le Japonais ne soit pas plus à l’abri que l’Européen de
certains drames de famille. L’esprit des femmes japonaises est
cultivé aujourd’hui, dans certaines classes, autant que celui des
hommes. D’ailleurs, jadis également, l’éducation des femmes
atteignait quelquefois à une haute culture intellectuelle, et on
trouverait plus d’un nom féminin parmi les historiens, les moralistes
et les poètes. Les femmes japonaises, sans être des beautés, sont
de très gaies et de très agréables compagnes : elles ont beaucoup
d’aise et d’élégance dans leurs manières, sauf lorsqu’elles s’habillent
à l’européenne. Alors elles ont l’air gênées et paraissent en bois.
Autrefois, la femme mariée, durant toute son existence, était
pour ainsi dire en tutelle ; elle dépendait de son mari, ou, à défaut,
de son fils aîné et n’avait aucun droit légal : son témoignage n’était
pas admis. Son mari pouvait introduire, à son choix, autant de
concubines qu’il voulait sous le toit conjugal et pouvait signifier le
divorce à sa femme comme il lui plaisait ; par contre elle-même, en
aucun cas, ne pouvait exiger le divorce. Aujourd’hui les lois ont
changé la condition de la femme, mais en pratique le divorce ancien
système existe encore, et la femme japonaise est encore traitée
plutôt comme une poupée que comme une associée et une
confidente.
Il se prépare cependant actuellement une jeunesse japonaise up
to date, qui commence à marcher sur les traces des féministes et
des suffragettes.
L’enfant, à sa naissance, n’est jamais emmailloté et aucun genre
d’empaquètement ne l’empêche de se développer librement. Le
trente et unième jour pour les garçons et le trentième jour pour les
filles on le portait autrefois au temple pour lui donner un nom que la
prêtresse préposée au temple choisissait ; aujourd’hui l’enfant est
déclaré, dès sa naissance, à la mairie de son quartier ou de la
commune comme en Europe, et on ne lui donne qu’un nom, alors
que, dans les temps anciens et même à une époque encore peu
éloignée, on lui en choisissait plusieurs : il en changeait même assez
souvent.
L’enfant, au Japon, est excessivement gâté, on le laisse faire ce
qu’il veut ; jamais on ne le réprimande et surtout jamais on ne le
bat ; on lui passe toutes ses fantaisies, on le bourre de friandises et
de sucreries. Mais, dès sa jeunesse, on lui inculque le mépris de la
mort, l’amour du Pays et de l’Empereur ; on lui enseigne à être très
poli et déférent vis-à-vis des personnes âgées et des supérieurs.
Vers l’âge de sept ans, tous, garçons et filles, vont à l’école primaire
où ils apprennent les alphabets et quelques caractères, un peu de
géographie et d’arithmétique. Ceux qui veulent faire des études
complètes sont obligés, d’abord de se mettre en mémoire un certain
nombre de caractères chinois sans lesquels ils ne pourraient acquérir
aucune instruction sérieuse. C’est là, évidemment, pour eux, du
temps à peu près perdu, pas tout à fait cependant puisque, en
même temps que les caractères, ils apprennent l’histoire et la
littérature ancienne de leur pays.
Les fêtes spéciales aux enfants sont nombreuses au Japon, et les
deux plus importantes méritent une description spéciale : elles
s’appellent, pour les filles, la fête de Hina no sekku ou Hina no
matsuri, elle a lieu le troisième jour du troisième mois. Celle des
garçons se nomme Go gatsu no sekku, elle est célébrée le cinquième
jour du cinquième mois.
La première de ces fêtes est spécialement réservée aux filles et
c’est pour elles le grand jour de réjouissance de l’année. Les
Européens l’ont surnommée la fête des poupées, parce que, ce jour-
là, chaque famille expose les poupées accumulées et conservées
pendant plusieurs générations. Quelques jours avant la fête on peut
voir, dans les magasins, des collections de gentilles poupées hautes
de vingt à cinquante centimètres, habillées plus ou moins
richement ; chaque famille qui a eu une fille dans l’année achète une
paire de poupées pour donner, comme jouet, à l’enfant. La petite
Japonaise a toujours grand soin des poupées achetées le jour de la
fête de Hinasama, et, lorsqu’elle est grande, et qu’elle se marie, ses
poupées la suivent dans sa nouvelle demeure ; elle les donne à ses
filles et ajoute encore à la collection chaque fois qu’une fille lui naît.
Le troisième jour du troisième mois toutes les poupées de la famille
sont exposées dans la belle chambre à la vue de tout le monde. Ces
poupées sont faites de bois ; elles représentent l’Empereur et
l’Impératrice ; les anciens nobles de Kioto ou Kuge, avec leurs
femmes et leurs filles ; les musiciens de la cour que l’on a soin de
représenter chacun avec son instrument. Quelquefois aussi ces
poupées figurent des Kami (dieux shintoïstes) ou des personnages
mythologiques et historiques. Mais on ne se contente pas de mettre
en ligne ces hauts dignitaires et ces personnages sacrés ; on a soin
de les entourer de tous les objets nécessaires à la vie quotidienne :
petites tables en laque, petits ustensiles de ménage, bols, tasses,
coffres de voyage, etc…, le tout proportionné à la taille des poupées.
Puis on offre le vin de riz, le riz et le poisson sec (katsuobushi) à
l’Empereur et à l’Impératrice, et les jeunes filles de la maison, avec
la mère et les amies, se livrent à la joie et aux plaisirs de cette fête.
Le cinquième jour du cinquième mois est le grand jour pour les
garçons. Ici nous sommes dans tout l’attirail de la guerre. En effet,
quelque temps avant le cinq du mois, les boutiques de la ville
exhibent force effigies et images en bois de demi-dieux et de héros
couverts d’armures brillantes, généraux et soldats de l’antiquité ;
guerriers qui se sont couverts de gloire, notamment Taiko Sama et
Katô Kiyomasa ; il y en a à pied, il y en a montés sur des chevaux
brillamment caparaçonnés ; la couleur rouge domine dans les
drapeaux et oriflammes suspendus à profusion à travers les toits des
maisons. Enfin des lances, des arcs et des flèches, des sabres sont
rangés sur des râteliers spéciaux et alignés aux devantures des
magasins. Chaque famille où il est né un fils fait l’acquisition de
guerriers et d’armes, de sorte que, dans certaines familles, le jour de
la fête, l’exposition a peine à tenir dans une chambre.
En dehors de l’exposition, chaque famille où il est né un fils dans
l’année, fait flotter au bout d’un long bambou, à l’extérieur, par-
dessus le toit, un immense poisson en papier gonflé ; aussi peut-on
voir, tous les ans, le cinquième jour du cinquième mois, une quantité
innombrable d’énormes poissons en papier, flottant au gré du vent
par-dessus les maisons. C’est fort original. Le poisson représenté est
la carpe (Koi) qui est supposée, par les Japonais, remonter les
torrents avec facilité, et qui signifie que chaque homme doit tout
surmonter et résister au courant de la vie.
La maison japonaise n’est pas une maison ; c’est un toit, un toit
ouvert aux quatre vents, sans murs, avec quatre poutres pour le
soutenir. La seule fermeture est représentée par les to, sortes de
portes glissant dans des rainures, et que l’on ferme, le soir, quand la
famille se livre au repos. Entre ces portes et les coulisses en papier
qui entourent et ferment la chambre, il y a une petite vérandah
d’environ un mètre de large. Dans la chambre, rien : aucun meuble,
aucun siège. Seulement, par terre, des nattes fines, très épaisses sur
lesquelles on s’assied les jambes repliées sous soi ; ainsi on mange,
on cause, on fume autour d’un brasero où brûle du charbon de bois.
Pour les repas, la servante (ou la femme dans les ménages
populaires) apporte de petites tables laquées sur lesquelles repose
tout le repas : soupe, poisson, légumes, plus un grand seau en bois
blanc très propre où est le riz chaud, dont chacun prend dans un bol
autant qu’il en désire. Le riz, c’est notre pain.
Les Japonais absorbent généralement trois repas par jour ; en se
levant ils font un bon repas, et ne se contentent pas, comme nous,
d’une tasse de café ; puis ils mangent à midi et le soir ; c’est le repas
de midi qui est le moins copieux ; le soir, souvent, ils prennent un
peu de sake ou vin de riz.
C’est le soir, après dîner, que les Japonais vont au bain. Aller,
après avoir bien mangé, se plonger dans une cuve d’eau bouillante à
40° et même 45°, est une coutume qui a toujours stupéfait les
Européens qui ont habité le Japon. Les familles aisées ont toutes
une cuve chez elles ; quant au peuple, comme je l’ai déjà dit, il va
aux bains publics ; puis les Japonais, rouges comme des écrevisses,
se préparent pour la nuit. On sort de l’armoire, dissimulée dans un
côté des cloisons, les gros matelas appelés fouton, et on les étend
par terre sur les nattes. Tout le monde couche ainsi sans drap, avec,
comme chemise de nuit, un simple Kimono de coton. Il m’est arrivé
bien souvent, à la chasse ou en voyage, de passer ainsi la nuit.
Il existe aujourd’hui à Tokio des maisons à l’européenne, édifiées
par les hauts personnages et par quelques Japonais fortunés ; mais
cependant, à côté de ces maisons, et communiquant avec elles, la
maison japonaise existe, et c’est dans la maison japonaise qu’on vit.
La maison européenne sert de temps en temps lorsqu’il faut
accueillir des étrangers, ou lorsqu’on veut se donner le luxe d’une
réception à l’européenne.
L’Empereur lui-même vit dans un palais japonais,
somptueusement décoré, que j’ai pu visiter comme on venait de
l’achever, mais alors que l’Empereur n’en avait pas encore pris
possession. A côté, le palais européen est utilisé pour les réceptions
à l’européenne.
Au reste, tous les fonctionnaires et tous les officiers, le soir venu,
se hâtent de se dévêtir de leurs redingotes ou uniformes et
d’endosser le costume national.
Bien que le foyer n’existe pas au Japon dans le sens où nous
l’entendons, il ne faudrait pas croire, cependant, que toute intimité
est inconnue dans la famille japonaise. Pendant les soirées d’hiver,
quand les to sont bien fermés et que le braséro ou hibatchi
réchauffe tant bien que mal les mains gelées, les petits enfants, en
compagnie de leurs parents, réunis autour des charbons tout rouges,
écoutent avidement les histoires et les contes de fées que la grand-
mère leur raconte. Car le folklore japonais abonde en histoires tout
aussi jolies que les contes de Perrault. Elles font défiler Momotaro, le
jeune héros sorti d’une pêche, qu’une vieille femme trouve dans la
rivière en lavant son linge, et qui devient riche et puissant ; le
vieillard qui fait fleurir les arbres morts, grâce au génie de son chien
tué méchamment par un voisin jaloux ; le miroir de Matsuyama,
miroir qu’une jeune mère donne à sa fille en mourant, lui disant que
toujours elle y verra son image ; et la jeune fille, si semblable à sa
mère, croit effectivement y voir l’image de la chère disparue ; la
bataille du singe et du crabe ; le moineau qui a la langue coupée ; le
vieillard et les démons, et tant d’autres contes ! La grand-mère (o ba
san) charme son auditoire, et les petits enfants ouvrent tout grands
les yeux et les oreilles pour mieux comprendre ces choses
merveilleuses. Les vieilles histoires venues de l’Inde et de la Chine,
les faits célèbres, les exploits de Yamato dakenomikoto et des
guerriers des âges lointains, font aussi les frais de ces soirées
familiales, ainsi que les méfaits du renard qui peut se changer en
femme pour tromper les hommes et réciproquement ; le renard
(Kitsune), voilà peut-être l’animal le plus craint au Japon à cause de
ses métamorphoses. Aussi le soir ferme-t-on bien les to pour que
maître Kitsune ne vienne pas faire de mauvaises farces dans la
maison.
Vient l’âge du mariage (le Japonais se marie jeune), il faut
trouver une femme pour le fils et un mari pour la fille.
Généralement, les familles s’entendent bien longtemps auparavant,
ce qui simplifie les recherches. Quand on est tombé d’accord, un
certain nombre d’amis du fiancé et autant d’amies de la fiancée sont
désignés pour faire les préparatifs et décider de la cérémonie, puis
on choisit un jour heureux pour la première entrevue des fiancés, et
on fixe le jour du mariage. Alors le fiancé envoie à sa fiancée des
présents en conformité avec sa situation de fortune et ces présents
la fiancée les offre à ses parents en gage de remerciements, avant
de quitter pour toujours leur demeure où elle a passé sa jeunesse au
milieu des soins dévoués. Les parents fournissent le trousseau et les
objets du ménage, comme cela se passe d’ailleurs en Chine.
Quant à la cérémonie du mariage, elle est célébrée soit en
famille, soit dans un restaurant choisi. J’ai eu l’occasion, arrivant
dans un restaurant à Osaka, d’être invité fort aimablement par le
propriétaire, au mariage de sa fille, et j’ai donc assisté à toute la
cérémonie ; la fiancée a sur la tête un long voile blanc, et elle est
accompagnée par deux amies qui la conduisent dans la salle où la
cérémonie doit avoir lieu. Là, le fiancé se trouve déjà, assis au milieu
de ses parents et amis. Dans le centre de la pièce, est placée une
table en laque d’or, magnifiquement décorée, et supportant un
sapin, un prunier en fleur, une grue et une tortue, qui sont les
emblèmes : le sapin, de la force du mari ; le prunier, de la grâce de
la femme ; la grue et la tortue, d’une vie heureuse et longue. Sur
une petite table, à côté, une coupe et une bouteille de sake. Après
quelques cérémonies, les amies de la jeune fille, agissant comme
demoiselles d’honneur, font approcher les deux fiancés près de la
table en laque et leur offrent la coupe pleine où chacun, se tenant
par la main, boit à son tour. C’est par cet acte de boire dans la
même coupe que le mariage est consacré.
Alors les invités arrivent pour les félicitations, puis tout le monde
s’assied et prend part au festin. Je me rappellerai toujours avec
plaisir cette cérémonie où j’ai été si gracieusement invité et traité
d’une manière on ne peut plus aimable.
Il va sans dire que l’état civil existant actuellement au Japon, le
mariage doit être déclaré à la mairie. Le revers de la médaille est la
facilité avec laquelle on divorce ; il existe bien de nouvelles lois à ce
sujet, mais les mœurs restent les plus fortes et le chiffre des
divorces est encore considérable.
Si, dans l’intimité et en famille, le Japonais est assez
généralement gai et libre, dans le monde, il est toujours réservé et
cérémonieux. Dans leurs visites, dans leurs entretiens les Japonais
sont toujours froids et corrects, ils ont néanmoins une sorte de
sourire permanent sur les lèvres ; s’ils sont dans l’affliction par suite
de la perte d’une femme ou d’un enfant, ils ont le même sourire ; on
les a habitués dès l’enfance à ne laisser rien paraître de leur joie ou
de leur douleur.
Souvent les femmes reçoivent leurs amies, et les hommes les
leurs, vers quatre ou cinq heures de l’après-midi pour boire l’usu cha
et causer, en fumant quelques pipes. L’usu cha est une sorte de thé
en poudre, et, pour le préparer il y a tout un cérémonial ; il faut,
d’abord, des tasses en terre spéciale, très estimée au Japon,
généralement grises et biscornues ; sont aussi nécessaires une foule
de petits instruments dont chacun est destiné à un usage spécial ; il
faut savoir prendre l’eau chaude dans la bouilloire, la verser d’une
manière particulière, et enfin il faut recevoir la tasse, des mains de
celui qui vous la présente, avec une certaine position des mains à la
hauteur de la tête, boire religieusement et rendre la tasse suivant les
rites. Et tout cela se fait très sérieusement, sans que le visage
trahisse la moindre envie de rire.
Les hommes, souvent aussi, s’invitent à un banquet dans un
restaurant à la mode ; alors c’est tout différent. Les invités, après
avoir bu le sake, servi par de jeunes artistes musiciennes et
danseuses, sont invités à se mettre à l’aise, et la soirée s’achève
gaiement, après qu’on a admiré les danses nouvelles et les
morceaux les plus choisis du répertoire. Les hommes seuls se
réunissent ainsi ; jamais les femmes ne sont admises à ces
banquets. La musique japonaise, pour nos oreilles, est quelque
chose d’atroce ; il n’y a dans ces sons rien de ce que nous appelons
un son musical, un rythme : c’est une complainte assez semblable
aux cris de plusieurs chats. Il existe pourtant, actuellement, des
troupes de musiciens à l’européenne, mais on sent qu’ils exécutent
mécaniquement leurs notes et qu’ils ne sentent pas, ne
comprennent pas notre art musical.
Les Japonais sont assez joueurs et ils ont adopté tous les jeux
chinois : cartes, dés, échecs ; ils sont aussi très amateurs de
combats de coqs et de cailles, goût qu’ils ont conservé de leurs
ancêtres malais. L’été, ils sont très friands de parties de campagne,
notamment sur l’eau : ils louent des barques disposées à l’usage des
promeneurs et cherchent un endroit agréable, à l’ombre, d’où ils
puissent avoir une belle vue. La fête de Riogoku bashi à Tokio donne
une idée de ces réjouissances en bateau ; pendant plusieurs jours,
des barques, pleines de monde, sillonnent la rivière, et le soir, les
feux d’artifices et les illuminations des restaurants et des maisons
qui la bordent, rivalisent d’éclat avec les lanternes fines et élégantes
de Gifu dont la lumière brille au toit des barques.
Après cette esquisse de la vie japonaise, il convient de voir
comment se termine la carrière d’une individualité humaine aux îles
du Soleil Levant ; c’est peut-être dans les rites funéraires que s’est
conservée le plus exactement la manière antique : quand un
Japonais vient à mourir, ses parents et ses amis lavent le corps et le
revêtent d’un vêtement blanc sur lequel un prêtre a auparavant
inscrit quelques caractères sacrés, généralement le nom posthume
du défunt (car, dans la religion bouddhique chaque défunt a un nom
sous lequel il est désigné désormais), puis on le place dans le
cercueil. Au Japon, le cercueil est une caisse carrée ou un tonneau
(ou plutôt la moitié d’un tonneau), dans lequel le mort est accroupi
de façon que ses genoux viennent rencontrer son visage. Quand
tous les préparatifs sont faits, et quand la famille a également pris le
deuil en blanc, les pieds nus dans des sandales de paille, la
procession funéraire commence. Elle est conduite par un certain
nombre de porteurs de torches suivis par les prêtres ; puis viennent
les serviteurs, portant des bâtons de bambou où sont accrochées
des lanternes et des bandes de papier blanc ornées de sentences
bouddhiques, en caractères sanscrits. Le cercueil suit
immédiatement après, porté par quatre ou six hommes ; il est
recouvert d’une espèce de châsse blanche qui le cache à la vue ;
alors viennent les amis et connaissances du défunt qui escortent les
hommes de la famille, père, fils, frères ; tout ce monde, d’ailleurs,
parents, amis, porteurs, serviteurs de la maison et du temple, est en
grand deuil, c’est-à-dire que tous sont vêtus de coton blanc. Chez le
peuple évidemment ceci est simplifié et souvent même les femmes
conduisent le défunt à sa dernière demeure. Les femmes de noble et
riche famille suivent le cortège également vêtues de blanc, mais
elles ne viennent que derrière et à la fin, autrefois portées en
palanquin, aujourd’hui conduites en voiture. J’ai assisté ainsi, à
Tokio, aux funérailles du prince Arisugawa ; son fils, habillé de blanc,
des sandales aux pieds, un bâton à la main suivait à pied ; c’était un
enterrement shintoïste, et, arrivé au cimetière, le corps fut déposé
sur une sorte d’autel, devant lequel chacun vint offrir aux mânes du
prince une branche de l’arbre sacré, le Sakaki.
Chez les shintoïstes, en effet, les cérémonies sont très simples.
Il n’en est pas de même chez les bouddhistes ; le prêtre ici joue
un grand rôle et, après être venu à la maison mortuaire réciter des
prières, il accomplit une cérémonie ; il récite enfin d’autres prières au
cimetière.
Autrefois, les cimetières étaient autour des temples, comme ils
sont chez nous, dans les villages, autour des églises ; aussi chaque
quartier de Tokio avait plusieurs cimetières. Les Japonais brûlent, ou
enterrent leurs morts, suivant la secte bouddhique à laquelle ils
appartiennent. Les shintoïstes enterrent toujours.
A l’intention de ceux qui emploient la crémation, il existe, sur un
point de la banlieue de Tokio, un four crématoire pour les riches, et
le bûcher de sapin pour les pauvres. Le cadavre réduit en cendres,
les cendres sont recueillies dans une urne et enterrées.
Les tombes se ressemblent toutes : un soubassement en pierre
supportant une petite colonne carrée sur les quatre faces de laquelle
sont gravées toutes sortes de maximes bouddhiques avec le nom
posthume du défunt. Les shintoïstes pauvres se contentent d’un
piquet de bois dégrossi sur les quatre faces, et entouré de bambous
supportant des banderoles de paille et de papier, symbole du shintô.
Les tombes ne sont pas négligées, au contraire ; elles sont
toujours ornées de fleurs, et, au mois de juillet, à l’époque du
« bon » ou fête des morts, la foule se presse dans les cimetières,
absolument comme on fait chez nous à la Toussaint. Il existe une
croyance qui veut, qu’après la fête du bon, le 26e jour du 8e mois, la
lune se lève en trois langues de feu au-dessus de l’horizon ; aussi,
tout vrai bouddhiste, ce soir-là, va-t-il s’installer sur une éminence
où il reste en prière jusqu’à l’apparition des trois langues de feu.
Chacune, en effet, représente un bouddha qui s’élève ainsi au-
dessus de la terre et disparaît presque aussitôt, alors que les trois
langues de feu se réunissent pour former la lune.
Les Japonais qui suivent les enseignements du bonze dissident,
Nichiren, et qui font partie de la secte du Hokkekio, ont une coutume
d’une poésie vraiment naïve et délicieusement idéale : celui qui a
parcouru assez longtemps les routes du Japon n’a pas été sans
rencontrer, dans la campagne, une pièce de coton suspendue aux
quatre coins à des bambous enfoncés en terre près d’une mare, d’un
ruisseau. Derrière cette pièce de coton, se trouve une planchette
avec quelques caractères, généralement les caractères Namu miô hô
ren ge kiô qui veulent dire à peu près : Gloire au lotus de la bonne
loi. Enfin une sorte de gobelet en bois, avec un long manche, repose
sur l’étoffe. Dans le creux des quatre bambous, souvent, on trouve
des fleurs qu’une main pieuse renouvelle. A première vue un
Européen ne comprend pas ; mais voici l’explication qui m’a été
donnée : sur l’étoffe de coton est inscrit le nom d’un défunt ; alors le
passant pieux, après avoir joint les mains et prié quelques instants,
prend le gobelet et répand de l’eau sur l’étoffe ; il attend que toute
l’eau ait traversé l’étoffe avant de poursuivre son chemin ; puis il
salue et repart. Cette petite cérémonie est appelée Nagare Kanjô, la
prière de l’eau courante.
Le Dai Butsu de Kamakura.
CHAPITRE VI

I. Le peuplement : sa densité ; l’expansion au dehors. — II.


Quelques chiffres. — III. Répartition de la population. — IV. Villes
au-dessus de 100.000 habitants. — V. Émigration au Hokkaido
(île d’Yezo).

I. — La population du Japon augmente, tous les ans, d’une


manière inconnue à l’Europe, même à l’Allemagne et à la Russie,
dont, cependant, l’accroissement de population est déjà fort rapide.
On a souvent prétendu que c’était cette augmentation continuelle
qui obligeait les Japonais à chercher d’autres terres pour vivre, leur
pays se trouvant surpeuplé. Je crois qu’il n’est pas très exact
d’énoncer pareille idée d’une façon absolue. Les Japonais ont encore
à peupler tout le Nord du Honshû et l’île de Yezo et, certainement,
ces deux parties de l’Empire pourraient nourrir des milliers de
familles ; ce qui chasse les Japonais de chez eux c’est moins le
besoin de nouveaux territoires que leur esprit d’aventures. En effet,
avant la fermeture complète du Japon par Iyeyasu et l’interdiction
absolue de communiquer avec l’étranger, les jonques des Japonais
parcouraient toutes les mers de Chine, et on les trouve, aux XIVe,
XVe, XVIe siècles, un peu partout en Asie : en Corée, au Siam, en
Annam, au Tonkin, où ils commercent, où ils deviennent ministres,
généraux, et où, en somme, ils sont très appréciés. Le vieux sang
malais, le sang des écumeurs de mer qui coule dans leurs veines, en
fait à cette époque des navigateurs de première valeur. L’édit de
Iyeyasu leur fermant la mer, leur fit oublier leurs ardeurs maritimes ;
mais depuis que le pays s’est ouvert en grand, ils sont repartis sur
les flots et sont redevenus ce qu’ils étaient, d’excellents marins et
des aventuriers sans égaux. C’est ainsi qu’on les voit en Chine, en
Amérique, aux Hawai, aux Philippines, en Mandchourie, en Corée,
voire au Pérou et au Chili.

II. — Quelle que soit, d’ailleurs, la raison particulière qui les fait
ainsi essaimer dans les mers d’Extrême-Orient et dans le Pacifique, il
n’en est pas moins constant que le chiffre de la population japonaise
va toujours en augmentant. De 35.768.584 en 1879, elle est passée
en 1905 à 47.674.460 habitants, après avoir été en 1896 de
42.708.264 habitants.
Le tableau de la population totale de l’Empire, pour les dix
dernières années (le recensement le plus récent étant de 1905, pris
dans le dernier résumé statistique de l’Empire) (1908), donne les
chiffres suivants :

ANNÉES POPULATION
1896 42.708.264
1897 43.228.863
1898 43.763.855
1899 44.260.642
1900 44.815.980
1901 45.437.032
1902 46.022.476
1903 46.732.876
1904 47.215.630
1905 47.674.460

Cette population totale était ainsi répartie à la fin de décembre


1903 (dernier tableau paru) :

1888 1893 1898 1903


Honshu central 15.331.659 16.031.432 16.859.998 17.988.546
— 5.992.017 6.316.774 6.642.917 7.075.571
septentrional
Honshu 9.096.416 9.374.468 9.825.722 10.396.425
occidental
Shikoku 2.828.821 2.907.280 3.013.817 3.167.707
Kiushu 6.103.446 7.379.262 6.811.246 7.260.910
Yezo 254.805 379.097 610.155 843.717

En quinze ans, de 1888 à 1903 la population du Japon a


augmenté de 7.175.642 habitants ; et de 1903 à 1905 de près d’un
million (exactement 941.584 habitants).

III. — Elle est inégalement répartie dans tout l’Empire et les


parties les plus peuplées du Japon sont celles qui composent le
Honshu central, c’est-à-dire tout le centre de la plus grande île, que
les Européens connaissent plus généralement sous le nom de Nihon
ou Nippon, et que les Japonais appellent Honshu ou terre principale,
Nippon et Nihon, chez eux voulant dire le Japon tout entier. La
répartition de la population par Ken ou département, au 31
décembre 1903 (résumé statistique de l’Empire du Japon pour 1908)
est ainsi établie :

Shi et Ken (Honshu central). Population.


Shi de Tokio 1.668.368
Ken de Kanagawa 866.276
— Saitama 1.248.626
— Chiba 1.329.362
— Ibaraki 1.205.231
— Tochigi 858.875
— Gumma 850.081
— Nagano 1.321.581
— Yamanashi 537.938
— Shidzuoka 1.294.917
— Aichi 1.692.771
— Miye 1.051.054
— Gifu 1.046.520
— Shiga 739.608
— Fukui 655.714
— Ishikawa 806.748
— Toyama 814.876
Honshu septentrional :
Ken de Niigata 1.882.574
— Fukushima 1.145.606
— Miyagi 898.531
— Yamagata 889.510
— Akita 834.781
— Iwate 761.281
— Awomori 663.288
Honshu occidental :
Shi de Kioto 984.285
— d’Osaka 1.432.932
Ken de Nara 568.265
— Wakayama 721.411
— Hiogo 1.776.220
— Okayama 1.181.204
— Hiroshima 1.517.185
— Yamaguchi 1.032.879
— Shimane 742.844
— Tottori 439.200
Shikoku :
Ken de Tokushima 729.951
— Kagawa 730.947
— Ehime 1.056.054
— Kôchi 660.755
Kiushiu :
Ken de Nagasaki 878.667
— Saga 666.158
— Fukuoka 1.476.528
— Kumamoto 1.212.187
— Oita 873.659
— Miyazaki 490.275
— Kagoshima 1.194.228
— Okinawa 468.208

Par le tableau ci-dessus, il est facile de se rendre compte de la


façon dont le Japon est peuplé ; depuis le recensement de 1903, la
population s’est encore accrue nécessairement, mais aucune
statistique officielle n’a paru à ce sujet ; toutefois on peut affirmer,
sans se tromper, qu’à l’heure actuelle (1909), la population japonaise
dépasse 50.000.000 d’habitants. (L’Annuaire économique pour 1908
donne exactement 49.232.822.)
Les départements (Ken) les plus peuplés sont, avec les Shi (cités)
de Tokio et d’Osaka, ceux de Saitama, Chiba, Ibaraki, Gumma,
Shidzuoka, Aichi, Miye, Gifu dans le Honshu central ; Niigata,
Tokushima, Hiogo, Okayama, Hiroshima, Yamaguchi, dans le Honshu
occidental ; Ehime, dans l’île de Shikoku ; Fukuoka, Kumamoto,
Kagoshima, dans l’île de Kiushiu.
La population de Yezo, appelé plus généralement Hokkaido par
les Japonais, est de 435.248 hommes et 408.469 femmes, soit un
total de 843.717, compris dans le total du précédent tableau.
Comme densité nous trouvons :

190 habitants par kilomètre carré pour le Honshu central ;


90 habitants par kilomètre carré pour le Honshu septentrional ;
194 habitants par kilomètre carré pour le Honshu occidental ;
174 pour Shikoku ;
166 pour Kiushiu ;
9 seulement pour l’île de Yezo.

Ce qui, en moyenne, donne 122 habitants par kilomètre carré ;


on voit donc que, comparativement aux pays les plus peuplés
d’Europe, la Belgique par exemple, c’est encore peu de chose, et
que le Japon pourrait contenir une population plus considérable.

IV. — La population rurale est très dense, et bien que l’industrie


attire, comme partout ailleurs, les jeunes gens vers les
agglomérations urbaines, cependant on ne trouve guère
actuellement qu’une dizaine de villes ayant une population de
100.000 âmes et au-dessus.

Tokio 1.818.655
Osaka 995.945
Kioto 380.568
Yokohama 326.035
Nagoya 288.639
Kobe 285.002
Nagasaki 153.293
Hiroshima 121.196
Sendai 100.231

Toujours, à la date du 31 décembre 1903 ; donc tous ces chiffres


doivent être majorés aujourd’hui.

V. — En 1907, l’immigration au Hokkaido donnait un chiffre de


66.793 individus dont il faut défalquer 10.092 qui ont abandonné
l’île. La population indigène de cette partie de l’Empire, les Ainos,
n’est plus que d’environ 18.000 individus, à peu près autant
d’hommes que de femmes ; elle tend à disparaître complètement
devant l’invasion japonaise qui contribue beaucoup à leur disparition
progressive en leur livrant de mauvais alcool de riz.
A part les Ainos du Hokkaido, on peut dire qu’à l’heure présente
la population du Japon est homogène. Elle ne forme qu’une même
race d’hommes, parlant la même langue, ayant les mêmes
habitudes, les mêmes mœurs. Évidemment l’isolement dans lequel le
Japon s’est trouvé pendant plus de deux siècles, enfermé dans ses
îles, alors que défense était faite sous peine de mort de quitter de
vue les côtes, a contribué puissamment à mêler les divers éléments
constitutifs et à ne faire qu’un seul peuple ; cependant là n’est pas
l’unique raison : car nous voyons, en Europe, la Grande-Bretagne,
dont les divers éléments, celtes, gallois et anglo-saxons, enfermés
dans des îles aussi, ne se sont pourtant jamais fondus ensemble. La
constitution politique et l’administration uniques pour tout le
territoire, ont dû contribuer certainement à la réalisation de l’unité
de race dans les îles du Soleil Levant.
La population étrangère fixée au Japon n’est pas très
considérable, et elle est estimée à environ 19.000 individus. Les
Chinois sont les plus nombreux, avec un total de 12.434 ; puis
viennent les Anglais au nombre d’environ 2.000 et les Américains
des États-Unis au nombre de 1.500. Les Allemands et les Français ne
sont guère plus de 500 à 600. Quant aux autres pays, ils sont
représentés par un nombre de personnes variant de 1 (Grec) à 90
(Italiens) et 200 (Russes).
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookgate.com

You might also like