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

Complete Download Visualizing Data in R 4 Graphics Using the base graphics stats and ggplot2 Packages 1st Edition Margot Tollefson PDF All Chapters

Margot

Uploaded by

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

Complete Download Visualizing Data in R 4 Graphics Using the base graphics stats and ggplot2 Packages 1st Edition Margot Tollefson PDF All Chapters

Margot

Uploaded by

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

Download the Full Version of textbook for Fast Typing at textbookfull.

com

Visualizing Data in R 4 Graphics Using the base


graphics stats and ggplot2 Packages 1st Edition
Margot Tollefson

https://textbookfull.com/product/visualizing-data-
in-r-4-graphics-using-the-base-graphics-stats-and-
ggplot2-packages-1st-edition-margot-tollefson/

OR CLICK BUTTON

DOWNLOAD NOW

Download More textbook Instantly Today - Get Yours Now at textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

R Graphics Cookbook Practical Recipes for Visualizing Data


2nd Edition Winston Chang

https://textbookfull.com/product/r-graphics-cookbook-practical-
recipes-for-visualizing-data-2nd-edition-winston-chang/

textboxfull.com

ggplot2 Elegant Graphics For Data Analysis Second Edition


Hadley Wickham

https://textbookfull.com/product/ggplot2-elegant-graphics-for-data-
analysis-second-edition-hadley-wickham/

textboxfull.com

ggplot2 Elegant Graphics For Data Analysis Second Edition


Hadley Wickham Carson Sievert

https://textbookfull.com/product/ggplot2-elegant-graphics-for-data-
analysis-second-edition-hadley-wickham-carson-sievert/

textboxfull.com

Using R and RStudio for Data Management Statistical


Analysis and Graphics 2nd Edition Nicholas J. Horton

https://textbookfull.com/product/using-r-and-rstudio-for-data-
management-statistical-analysis-and-graphics-2nd-edition-nicholas-j-
horton/
textboxfull.com
R in Action Data Analysis and Graphics with R Bonus ch 23
ONLY 2nd Edition Robert Kabacoff

https://textbookfull.com/product/r-in-action-data-analysis-and-
graphics-with-r-bonus-ch-23-only-2nd-edition-robert-kabacoff/

textboxfull.com

R Graphics (Third Edition) Paul Murrell

https://textbookfull.com/product/r-graphics-third-edition-paul-
murrell/

textboxfull.com

R Cookbook Proven Recipes for Data Analysis Statistics and


Graphics Jd Long

https://textbookfull.com/product/r-cookbook-proven-recipes-for-data-
analysis-statistics-and-graphics-jd-long/

textboxfull.com

Fundamentals of Graphics Using MATLAB 1st Edition Ranjan


Parekh

https://textbookfull.com/product/fundamentals-of-graphics-using-
matlab-1st-edition-ranjan-parekh/

textboxfull.com

Computer Graphics Programming in OpenGL Using C++, Third


Edition Gordon Phd

https://textbookfull.com/product/computer-graphics-programming-in-
opengl-using-c-third-edition-gordon-phd/

textboxfull.com
Visualizing
Data in R 4
Graphics Using the base, graphics,
stats, and ggplot2 Packages

Margot Tollefson
Visualizing Data in R 4
Graphics Using the base, graphics,
stats, and ggplot2 Packages

Margot Tollefson
Visualizing Data in R 4: Graphics Using the base, graphics, stats, and ggplot2
Packages
Margot Tollefson
Stratford, IA, USA

ISBN-13 (pbk): 978-1-4842-6830-8 ISBN-13 (electronic): 978-1-4842-6831-5


https://doi.org/10.1007/978-1-4842-6831-5

Copyright © 2021 by Margot Tollefson


This work is subject to copyright. All rights are reserved 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.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Steve Anglin
Development Editor: Matthew Moodie
Coordinating Editor: Mark Powers
Cover designed by eStudioCalamar
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY 10004,
U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.
springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science
+ Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail [email protected]; for reprint,
paperback, or audio rights, please e-mail [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book’s product page, located at www.apress.com/9781484268308. For more
detailed information, please visit http://www.apress.com/source-­code.
Printed on acid-free paper
For Clay.
Table of Contents
About the Author����������������������������������������������������������������������������������������������������� xi

About the Technical Reviewer������������������������������������������������������������������������������� xiii


Acknowledgments���������������������������������������������������������������������������������������������������xv

Part I: An Overview of plot( )��������������������������������������������������������������������������� 1


Chapter 1: Introduction: plot( ), qplot( ), and ggplot( ), Plus Some���������������������������� 3
1.1 plot( ), par( ), layout( ), and split.screen( )��������������������������������������������������������������������������������� 3
1.2 qplot( ) and ggplot( )����������������������������������������������������������������������������������������������������������������� 4
1.3 The Appendixes����������������������������������������������������������������������������������������������������������������������� 4
1.4 Software Versions and Hardware Used in This Book�������������������������������������������������������������� 5
1.5 Graphics Devices�������������������������������������������������������������������������������������������������������������������� 7

Chapter 2: The plot( ) Function��������������������������������������������������������������������������������� 9


2.1 Arguments and Default Values������������������������������������������������������������������������������������������������ 9
2.2 Ancillary Functions���������������������������������������������������������������������������������������������������������������� 10
2.3 Methods�������������������������������������������������������������������������������������������������������������������������������� 10
2.4 The Graphics Devices and the Functions par( ), layout( ), and split.screen( )������������������������� 10
2.5 An Example��������������������������������������������������������������������������������������������������������������������������� 11

Chapter 3: The Arguments of plot( )������������������������������������������������������������������������ 13


3.1 The Dataset��������������������������������������������������������������������������������������������������������������������������� 13
3.2 Changing the Overall Appearance in plot( )��������������������������������������������������������������������������� 15
3.2.1 Labels and Axis Limits�������������������������������������������������������������������������������������������������� 16
3.2.2 Box Type, Aspect Ratio, Annotation, and Expanded Plotting����������������������������������������� 19
3.3 Points and Lines�������������������������������������������������������������������������������������������������������������������� 24
3.3.1 Types of Plots��������������������������������������������������������������������������������������������������������������� 25
3.3.2 The Arguments pch and lty������������������������������������������������������������������������������������������� 28
v
Table of Contents

3.4 Details����������������������������������������������������������������������������������������������������������������������������������� 31
3.4.1 Colors��������������������������������������������������������������������������������������������������������������������������� 31
3.4.2 Fonts and Font Families����������������������������������������������������������������������������������������������� 38
3.4.3 Character Size in plot( )������������������������������������������������������������������������������������������������� 42
3.4.4 Line Details: lwd, lend, ljoin, and lmitre������������������������������������������������������������������������ 46
3.4.5 Making Changes to the Axes���������������������������������������������������������������������������������������� 49
3.4.6 Working with Log Scales���������������������������������������������������������������������������������������������� 58

Chapter 4: Ancillary Functions for plot( )���������������������������������������������������������������� 61


4.1 Functions That Affect Overall Appearance���������������������������������������������������������������������������� 61
4.1.1 The title( ) Function������������������������������������������������������������������������������������������������������� 62
4.1.2 The axis( ) and axTicks( ) Functions������������������������������������������������������������������������������ 67
4.1.3 The box( ), grid( ), clip( ), and rug( ) Functions���������������������������������������������������������������� 79
4.2 Functions Defined at Points�������������������������������������������������������������������������������������������������� 88
4.2.1 The points( ) Function��������������������������������������������������������������������������������������������������� 88
4.2.2 The text( ) Function������������������������������������������������������������������������������������������������������� 90
4.2.3 The symbols( ) Function������������������������������������������������������������������������������������������������ 99
4.2.4 The image( ) and rasterImage( ) Functions������������������������������������������������������������������ 104
4.3 Functions That Use Lines���������������������������������������������������������������������������������������������������� 114
4.3.1 The lines( ) and abline( ) Functions������������������������������������������������������������������������������ 115
4.3.2 The curve( ) Function�������������������������������������������������������������������������������������������������� 118
4.3.3 The segments( ) and arrows( ) Functions�������������������������������������������������������������������� 121
4.3.4 Functions That Plot Lines That Close on Themselves: rect( ), polygon( ), and
polypath( )���������������������������������������������������������������������������������������������������������������������������� 124
4.3.5 The contour( ) Function����������������������������������������������������������������������������������������������� 131
4.4 Functions to Provide Information About or to Interact with a Plot�������������������������������������� 136
4.4.1 The legend( ) and mtext( ) Functions��������������������������������������������������������������������������� 136
4.4.2 The Interactive Functions: identify( ) and locator( )����������������������������������������������������� 151

vi
Table of Contents

Chapter 5: The Methods of plot( )������������������������������������������������������������������������� 159


5.1 Methods������������������������������������������������������������������������������������������������������������������������������ 159
5.2 The Methods for plot( ) in the graphics Package����������������������������������������������������������������� 160
5.2.1 The data.frame Method���������������������������������������������������������������������������������������������� 161
5.2.2 The factor Method������������������������������������������������������������������������������������������������������ 163
5.2.3 The formula Method��������������������������������������������������������������������������������������������������� 166
5.2.4 The function Method��������������������������������������������������������������������������������������������������� 168
5.2.5 The histogram Method������������������������������������������������������������������������������������������������ 170
5.2.6 The raster Method������������������������������������������������������������������������������������������������������ 174
5.2.7 The table Method�������������������������������������������������������������������������������������������������������� 181
5.3 The Methods for plot( ) in the stats Package����������������������������������������������������������������������� 184
5.3.1 The acf Method����������������������������������������������������������������������������������������������������������� 186
5.3.2 The decomposed.ts Method��������������������������������������������������������������������������������������� 191
5.3.3 The dendrogram Method�������������������������������������������������������������������������������������������� 193
5.3.4 The density Method���������������������������������������������������������������������������������������������������� 198
5.3.5 The ecdf Method��������������������������������������������������������������������������������������������������������� 200
5.3.6 The hclust Method������������������������������������������������������������������������������������������������������ 203
5.3.7 The HoltWinters Method��������������������������������������������������������������������������������������������� 206
5.3.8 The isoreg Method������������������������������������������������������������������������������������������������������ 209
5.3.9 The lm Method������������������������������������������������������������������������������������������������������������ 212
5.3.10 The ppr Method�������������������������������������������������������������������������������������������������������� 219
5.3.11 The prcomp and princomp Methods������������������������������������������������������������������������� 222
5.3.12 The profile.nls Method���������������������������������������������������������������������������������������������� 225
5.3.13 The spec, spec.coherency, and spec.phase Methods����������������������������������������������� 229
5.3.14 The stepfun Method�������������������������������������������������������������������������������������������������� 234
5.3.15 The stl Method���������������������������������������������������������������������������������������������������������� 237
5.3.16 The ts Method����������������������������������������������������������������������������������������������������������� 240
5.3.17 The tskernel Method������������������������������������������������������������������������������������������������� 247

vii
Table of Contents

Chapter 6: Graphics Devices and Laying Out Plots����������������������������������������������� 251


6.1 Graphics Devices and Working with Graphics Devices������������������������������������������������������� 251
6.1.1 The Graphics Devices������������������������������������������������������������������������������������������������� 251
6.1.2 Working with Graphics Devices���������������������������������������������������������������������������������� 253
6.2 The par( ), layout( ), and split.screen( ) Functions���������������������������������������������������������������� 257
6.2.1 The par( ) Function������������������������������������������������������������������������������������������������������ 257
6.2.2 The layout( ), layout.show( ), and lcm( ) Functions������������������������������������������������������� 269
6.2.3 The split.screen( ), screen( ), erase.screen( ), and close.screen( ) Functions��������������� 272

Part II: A Look at the ggplot2 Package������������������������������������������������������� 279


Chapter 7: Graphics with the ggplot2 Package: An Introduction������������������������� 281
7.1 The Language and Syntax Used in the ggplot2 Package���������������������������������������������������� 282
7.2 The qplot( ) Function������������������������������������������������������������������������������������������������������������ 282
7.3 An Overview of the ggplot( ) Function��������������������������������������������������������������������������������� 290

Chapter 8: Working with the ggplot( ) Function: The Theme and


the Aesthetics������������������������������������������������������������������������������������� 295
8.1 The Theme Functions���������������������������������������������������������������������������������������������������������� 295
8.1.1 The theme( ) Function������������������������������������������������������������������������������������������������� 295
8.1.2 The Preset Theme Functions�������������������������������������������������������������������������������������� 304
8.1.3 Working with Themes������������������������������������������������������������������������������������������������� 307
8.2 The Aesthetic Functions������������������������������������������������������������������������������������������������������ 315

Chapter 9: The Geometry, Statistic, Annotation, and borders( ) Functions����������� 323


9.1 The Geometry Functions����������������������������������������������������������������������������������������������������� 323
9.2 The Statistic Functions�������������������������������������������������������������������������������������������������������� 325
9.3 The Annotation Functions���������������������������������������������������������������������������������������������������� 330
9.3.1 The annotate( ) Function��������������������������������������������������������������������������������������������� 330
9.3.2 The annotation_custom( ) and ggplotGrob( ) Functions���������������������������������������������� 334
9.3.3 The annotation_logticks( ) Function���������������������������������������������������������������������������� 337
9.3.4 The annotation_map( ) and annotation_raster( ) Functions���������������������������������������� 340
9.4 The borders( ) Function������������������������������������������������������������������������������������������������������� 343

viii
Table of Contents

Chapter 10: Formatting and Plot Management Tools������������������������������������������� 347


10.1 Working with the scale_, coord_, and guide_ Functions������������������������������������������������� 347
10.1.1 The Scale Functions That Affect Color, Size, Shape, and Line Type��������������������������� 348
10.1.2 Setting the Order of Evaluation��������������������������������������������������������������������������������� 360
10.1.3 Formatting Axes with the Scale and Coordinate Functions, Plus Some������������������� 362
10.1.4 The Guide and Draw Key Functions�������������������������������������������������������������������������� 365
10.2 Functions That Cut, Summarize, and Facet����������������������������������������������������������������������� 368
10.2.1 The Cut Functions����������������������������������������������������������������������������������������������������� 368
10.2.2 The Summary Functions and the resolution() Function�������������������������������������������� 369
10.2.3 The Facet Functions������������������������������������������������������������������������������������������������� 372
10.3 Working with Plots, Automatic Plots, and Prototypes�������������������������������������������������������� 376
10.3.1 The ggsave() Function and the plot() and print() Functions Applied to
ggplot Objects��������������������������������������������������������������������������������������������������������������������� 377
10.3.2 The autoplot() and autolayer() Functions������������������������������������������������������������������ 378
10.3.3 Prototype Functions in the ggplot2 Package������������������������������������������������������������ 379

Part III: Appendixes������������������������������������������������������������������������������������ 381


Appendix A: Plots for Contingency Tables and Discrete Data������������������������������� 383

Appendix B: Plots for Continuous Variables��������������������������������������������������������� 385

Appendix C: Functions That Plot Multiple Plots���������������������������������������������������� 387


Appendix D: Smoothers���������������������������������������������������������������������������������������� 389

Appendix E: Plots for Time Series������������������������������������������������������������������������ 391

Appendix F: Miscellaneous Plotting Functions����������������������������������������������������� 393

Index��������������������������������������������������������������������������������������������������������������������� 395

ix
About the Author
Margot Tollefson, PhD, is a semiretired freelance statistician, with her own consulting
business, Vanward Statistics. She received her PhD in statistics from Iowa State
University and has many years of experience applying R to statistical research problems.
Dr. Tollefson has chosen to write this book because she often creates graphics using
R and would like to share her knowledge and experience. Her professional blog is on
WordPress at vanwardstat. She has social media accounts on LinkedIn, Facebook, and
Twitter. Her social media name is @vanstat on Twitter.

xi
About the Technical Reviewer
Tom Barker is an engineer and technology leader, a professor, and an author. He has
authored several books on web development, data visualization, and technical leadership,
including High Performance Responsive Design, Intelligent Caching, Pro JavaScript
Performance: Monitoring and Visualization, and Pro Data Visualization Using R and
JavaScript.

xiii
Acknowledgments
I would like to acknowledge the Comprehensive R Archive Network (CRAN). Without
the R documentation, for which the Comprehensive R Archive Network is responsible,
this book could not have been written. Also, my husband, Clay, for bearing with me
while I wrote.

xv
PART I

An Overview of plot()
CHAPTER 1

Introduction: plot( ), qplot( ),


and ggplot( ), Plus Some
R provides many ways to visualize data. Graphics in the R language are generated by
functions. Some functions create useful visualizations almost instantly. Other functions
combine together to create highly coded sophisticated images. This book shows you how
to generate both types of objects.
In the first part of this book, we look in detail at the plot() function – the most basic
and versatile of the plotting functions. The functions par(), layout(), and split.screen(),
which set global plotting parameters and layout options, are also described, as well as
graphics devices.
The second part covers the functions in the ggplot2 package, starting with qplot() and
ggplot(). The functions qplot() and ggplot() are simpler to use in many ways than the earlier
R functions. Truthfully, the syntax used in the ggplot2 package requires long strings of names
and arguments – but the autocomplete function in RStudio makes code entry quite easy.
The third part of the book includes six appendixes containing the canned plotting
functions in the graphics and stats packages. The appendixes are sorted by the type of
object to be displayed.

1.1 plot( ), par( ), layout( ), and split.screen( )


The function plot() takes an object or objects and creates an image based on the class
of the object(s). There are many arguments to plot() that affect the appearance of the
image. The arguments can be given values within the call to plot(), or many can be
assigned globally using the function par(). After the initial call to plot(), there are several
ancillary functions that can be used to add to the image. If having more than one plot on
a page is the goal of the user, the functions par(), layout(), or split.screen() can be used to
set up the format for multiple plots.

3
© Margot Tollefson 2021
M. Tollefson, Visualizing Data in R 4, https://doi.org/10.1007/978-1-4842-6831-5_1
Chapter 1 Introduction: plot( ), qplot( ), and ggplot( ), Plus Some

In Chapter 2, we describe the basics of the plot() function. In Chapter 3, the various
arguments to plot() are categorized. The ancillary functions for plot() are introduced
in Chapter 4. In Chapter 5, the methods (types of plots) for which plot() is defined are
presented. In Chapter 6, the possible arguments to the function par() are described,
and a way to set up multiple plots using par(), layout() or split.screen() is given. Also,
graphics devices are covered.

1.2 qplot( ) and ggplot( )


The functions qplot() and ggplot() in the ggplot2 package provide alternatives to plot().
Default plots generated by qplot() and ggplot() tend to look nicer than default plots
generated by plot(). For simple plots, qplot() is sufficient to give an elegant-looking
graphic. The function ggplot() provides for more plotting options than qplot(). Some of
the syntax used in the ggplot2 package is not used in standard R.
In ggplot2, a theme for a graphic can be defined using theme() or by a canned theme
function beginning with “theme_”. The objects to be plotted are “mappings” and are
assigned in the function aes(). The type of image to be displayed is a geometry or statistic
and is assigned by functions beginning with “geom_” or “stat_”. The appearance of the
graphic can be changed by using aes(), “aes_” functions, “geom_” functions, “stat_”
functions, and/or other formatting functions. More than one aesthetic, geometry, and
statistic can be used to create an image. The appearance of the image can be changed by
running a formatting function from within another function or by running a formatting
function separately.
In Chapter 7, we look at qplot(), ggplot(), and the syntax of the ggplot2 package.
Chapter 8 introduces the theme(), “theme_”, and “element_” functions, as well as the
aes() and “aes_” functions. In Chapter 9, geometry, statistic, annotate, and the borders()
functions are described. Chapter 10 goes over various functions in the ggplot2 package
that also change the appearance of the image.

1.3 The Appendixes


Other than plot(), qplot(), and ggplot(), which are in the base and ggplot2 packages,
there are many plotting functions in the graphics and stats packages. The functions
are useful for data cleaning, data exploration, and/or model fitting. For many of the
functions, the graphical arguments used by plot() can be assigned. The specialized
4
Chapter 1 Introduction: plot( ), qplot( ), and ggplot( ), Plus Some

plotting functions are given in the appendixes at the end of this book, along with brief
descriptions of what the functions do and how to use them.
Appendix A lists functions used with contingency tables. Appendix B gives functions
for continuous variables. Appendix C lists functions that generate multiple plots.
Appendix D gives functions that smooth data. Appendix E gives plotting functions used
in time series analysis. Appendix F lists the plotting functions that are in the stats and
graphics packages and not covered in the first five appendixes.

1.4 S
 oftware Versions and Hardware Used in
This Book
The versions of R used in this book are R 4.0.1 and R 4.0.3; the versions of RStudio are
1.3.595 and 1.3.1093. Since R and RStudio are constantly changing, the Comprehensive R
Archive Network (CRAN) provides news on changes to R. The news for R 4.0.1 and R 4.0.0
can be found at https://cran.r-­project.org/doc/manuals/r-­release/NEWS.pdf.
The beginning of that news pdf is shown in Figure 1-1.

5
Chapter 1 Introduction: plot( ), qplot( ), and ggplot( ), Plus Some

Figure 1-1. R NEWS screenshot

The computer used for the examples is a MacBook Air running macOS Catalina
version 10.15.5.

6
Chapter 1 Introduction: plot( ), qplot( ), and ggplot( ), Plus Some

1.5 Graphics Devices


R opens graphics objects in a graphics device. By default, R opens the graphics object on
the computer screen, but the object can be written to a file using one of several image
formats. Section 6.1 covers graphics devices.
R and RStudio provide ways to save graphics objects to image files by selecting links
in the menus of the two programs. R automatically opens and closes the relevant devices
when a link is used.
To work with graphics devices through code, see Section 6.1 or the R help pages for
“device” and dev.cur(). Both Section 6.1.1 and the help page for “device” have a list of the
functions on your device that open a graphics device to create a specific type of image
file. Section 6.1.2 and the help page for dev.cur() give a list of the functions that manage
graphics devices.

7
CHAPTER 2

The plot( ) Function


The plot() function in R creates a graphic from objects of specific R classes. A figure
resulting from a call to plot() can contain text, lines, points, and/or images, and the areas
of the graphic can be filled by colors or patterns. The kind of graphic displayed depends
on the class of the object(s) to be displayed. For example, a single time series (an object
of class ts) gives a line plot that is plotted over time.

2.1 Arguments and Default Values


By default, a graphic usually has black lines and text – with preset line, point, and text
sizes and weights. Arguments that change the graphical properties of the graphic can
be set in plot(). Some of the arguments are used to make changes to line, point, or text
color; to line width or style; to point or text size; to the plotting character; to the style and
font weight of text; and to fill colors or patterns.
Other arguments set alternative text for the axis labels or give a main title and a
subtitle to the figure. The orientation, style, and weight of the text in the titles or labels
can be changed.
Axes can be included or not included in the graphic created by plot(). If axes are
initially included, the axis color and the color of tick marks can be changed by arguments
within plot(). Axis line width, tick mark length, and tick mark spacing can be changed.
Axis tick labels can be assigned in the call to plot(). The color, size, and orientation
of the axis tick labels can be changed. If necessary, a blank graphics object can be
generated with plot(). In Chapter 3, we look closely at the arguments that are available
to plot().

9
© Margot Tollefson 2021
M. Tollefson, Visualizing Data in R 4, https://doi.org/10.1007/978-1-4842-6831-5_2
Chapter 2 The plot( ) Function

2.2 Ancillary Functions


After the initial call to plot(), graphical information can be added to the original graphic
by using ancillary functions. These functions are used to overlay other plots over the
original plot and to add annotation to a plot. For example, a regression line can be added
to a scatterplot, or a legend can be included in a plot.
There are several ancillary functions. Titles and axis labels can be added by using the
ancillary function title() – instead of including titles and axis labels in the original call to
plot(). Axes can be added with the function axis() if axes are suppressed in a call to plot().
Regression lines can be added to a graphic (in a few ways).
Most of the ancillary functions are eponymous, such as text(), points(), lines(),
segments(), and arrows(). Others are not, such as polypath() or clip(). In Chapter 4,
we list the ancillary functions in the graphics and stats packages and show how each
function is used.

2.3 Methods
The methods of a function are those classes of objects for which a function is defined.
In the graphics and stats packages, there are 29 methods defined for plot().
In Chapters 3 and 4, we usually use the version of plot() that takes an x, and possibly
a y, as the object(s) to be plotted and which plots a scatterplot of x against index values
or of y against x. The actual name of the function is plot.default().
However, since R automatically determines the method to use when running plot(),
the “.default” extension is not necessary in the call to plot(). For plot.default(), the x and y
would need to be equal-length vectors that can be coerced to numeric. The methods for
plot() are given in Chapter 5, along with what each method creates.

2.4 T he Graphics Devices and the Functions par( ),


layout( ), and split.screen( )
R plots are created in graphics devices. A graphics device can be opened on the screen of a
computer or in a file external to R. (Some graphics devices are specific to a given operating
system.) The arguments used by the plotting functions that are covered in Part 1 can be
assigned in the plot() function and in the ancillary functions. When assigned in a plotting
function, the arguments are used in the specific function in which the arguments are
assigned. To globally assign arguments, the arguments can be assigned in the par() function.
10
Chapter 2 The plot( ) Function

The par() function contains the default values that many of the arguments to plot()
and the ancillary functions use. The default arguments of par() can be changed – for a
given R session or within a function call – by a call to par(). Most of the arguments in
par() are the same as those arguments in plot() that affect the appearance of the graphic.
Some arguments in par() can only be set in par().
R allows multiple plots to be put in one graphic. A grid for multiple plots can be
created using one of two arguments of par(). The grid created by par() has the same
number of columns in each row. Alternatively, the function layout() can be used to create
a more flexible design, with differing numbers of columns in each row. The split.screen()
function allows for placing plots at different locations on a graphics device.
In Chapter 6, the types of graphics devices are listed, as well as ways to work with
graphics devices. More on par(), layout(), and split.screen() is also found in Chapter 6.

2.5 An Example


In Figure 2-1, an example is given of a plot of the sunspot.year time series (from the
datasets package) using default arguments and the same plot done with some arguments
set. The two plots are plotted in one figure.

Figure 2-1. Plots of the time series sunspot.year (found in the datasets package
in R). The first plot uses the default argument settings in plot(). In the second plot,
some of the arguments are set.
11
Chapter 2 The plot( ) Function

The class of sunspot.year is ts, so the values in the time series are plotted against
time. The default axis labels are Time on the x axis and the name of the object that is
plotted on the y axis. By default, no title or subtitle is plotted.
For the preceding figure, the function par() is used to put two plots in a row into one
figure. After plot() is run twice, the number of plots per figure is changed back to one by
running par() again. Changes to par() remain in effect throughout an R session, unless
changed.

12
CHAPTER 3

The Arguments of plot( )


Many arguments can be used in plot(). In this chapter, we go over the arguments. The
arguments are grouped by categories – arguments that affect overall appearance, the
appearance of lines and points, and details. We look at the effects on the appearance of
graphics by using examples, with data from an R dataset. In this chapter, the function
plot.default(), which plots scatterplots, is used for the examples. While most of the
arguments in this chapter can be used in all or most versions of plot(), a few are specific
to plot.default().

3.1 The Dataset


In this section, we work with the LifeCycleSavings dataset from the datasets package.
Since the datasets package is loaded by default in RStudio, for most users the dataset
is available to access. To bring the dataset into the workspace in order to look at the
contents, enter the following at the R prompt:

data( "LifeCycleSavings" )

To look at the dataset in RStudio, double-click “LifeCycleSavings” (in the Data


section of the Environment window in the upper-right pane). The Console (lower-left
window) will display

> force(LifeCycleSavings)
                  sr pop15 pop75     dpi  ddpi
Australia      11.43 29.35  2.87 2329.68  2.87
Austria        12.07 23.32  4.41 1507.99  3.93

(Here, only the first two observations are displayed.) The dataset will also appear in
the Source (upper-left) window.

13
© Margot Tollefson 2021
M. Tollefson, Visualizing Data in R 4, https://doi.org/10.1007/978-1-4842-6831-5_3
Chapter 3 The Arguments of plot( )

A description of the dataset from the R documentation follows:

Intercountry Life-Cycle Savings Data

Description

Data on the savings ratio 1960–1970.

Usage

LifeCycleSavings

Format

A data frame with 50 observations on 5 variables.

[,1] sr numeric aggregate personal savings

[,2] pop15 numeric % of population under 15


[,3] pop75 numeric % of population over 75
[,4] dpi numeric real per-capita disposable income
[,5] ddpi numeric % growth rate of dpi

Details

Under the life-cycle savings hypothesis as developed by Franco


Modigliani, the savings ratio (aggregate personal saving divided by
disposable income) is explained by per-capita disposable income,
the percentage rate of change in per-capita disposable income, and
two demographic variables: the percentage of population less than
15 years old and the percentage of the population over 75 years old.
The data are averaged over the decade 1960–1970 to remove the
business cycle or other short-term fluctuations.

Source

The data were obtained from Belsley, Kuh and Welsch (1980). They
in turn obtained the data from Sterling (1977).

14
Chapter 3 The Arguments of plot( )

References

Sterling, Arnie (1977) Unpublished BS Thesis. Massachusetts


Institute of Technology.

Belsley, D. A., Kuh. E. and Welsch, R. E. (1980) Regression


Diagnostics. New York: Wiley.

—R documentation for the datasets package

The five variables in the dataset are aggregate personal savings (sr), the percentage of
the population under 15 years of age (pop15), the percentage of the population over 75
years of age (pop75), real per-capita disposable income (dpi), and the percentage growth
rate of real per-capita disposable income (ddpi). The values of the variables are averages
taken over the years 1960–1970, and the averages were found for 50 countries.

3.2 Changing the Overall Appearance in plot( )


The first argument to plot() is always x – an R object of an appropriate class. If x (or x and y)
is a vector object of the numeric class, plot() plots a scatterplot. (For scatterplots, a
numeric vector y of the same length as x can be included but is not necessary.) The first
example is a scatterplot using the default values of the arguments of plot().
In Listing 3-1, code that plots a default scatterplot is given. The scatterplot is a plot of
the percentage of the population under 15 (y) against the percentage of the population
over 75 (x), both from the LifeCycleSavings dataset.

For data frames, a variable in the data frame can be accessed by the data frame
name followed by a dollar sign followed by the variable name. For example,
LifeCycleSavings$pop75 accesses the pop75 variable in the LifeCycleSavings data
frame.

Listing 3-1. The code for a default scatterplot


plot(
  LifeCycleSavings$pop75,
  LifeCycleSavings$pop15
)

15
Chapter 3 The Arguments of plot( )

The plot is in Figure 3-1.

Figure 3-1. Default scatterplot of two variables from the LifeCycleSavings dataset

Note that the first argument is on the x axis (horizontal axis) and the second on the
y axis (vertical axis). Also, the graphic does not contain a title or subtitle, and the axis
labels contain the names of the variables in the dataset. The points are scattered so
that the most extreme points are close to the axes. In this chapter, we will show how to
change the appearance of, mainly, this plot by setting arguments.

3.2.1 Labels and Axis Limits


A title and subtitle can be added to the plot, and the axis labels can be changed. To add
a title, we use the argument main. The title will display above the plot. To add a subtitle,
we use the argument sub. The subtitle will display below the x axis label. To specify the
x and y axis labels, we use the arguments xlab and ylab. Setting either to “” will suppress
the label. For all of the four arguments, the value is a character vector that is usually one
element long.

16
Chapter 3 The Arguments of plot( )

Line breaks can be added to a character string by including “\n” in the character
string at the location of the line break. Or a character vector with more than one element
puts each element on a separate line (except with the argument sub).
The axis limits are the values from which the axis starts and at which the axis ends.
Having the start value greater than the end value is an accepted option. To set the x axis
and y axis limits of the plot, we use the arguments xlim and ylim. The format for the two
arguments is a numeric vector of length two, where the first number is the beginning
limit and the second number is the ending limit. By default, points outside the limits do
not plot.
An example of setting the labels and axis arguments is seen in Listing 3-2.

Listing 3-2. Code to plot a scatterplot where the title, subtitle, x axis label, y axis
label, x limits, and y limits have been set
plot(
  LifeCycleSavings$pop75,
  LifeCycleSavings$pop15,
  main="Percentage under 15 versus Percentage over 75\nfor 50 Countries",
  sub="More Under 15 Means Less Over 75 on Average",
  xlab="Percentage over 75",
  ylab="Percentage under 15",
  xlim=c( 0, 5.25 ),
  ylim=c( 18, 52 )
)

17
Chapter 3 The Arguments of plot( )

In Figure 3-2, the code has been run.

Figure 3-2. Scatterplot plotted using the arguments main, sub, xlab, ylab, xlim,
and ylim

18
Chapter 3 The Arguments of plot( )

3.2.2 B
 ox Type, Aspect Ratio, Annotation,
and Expanded Plotting
Whether to include a border, the type of border to include, and the aspect ratio of a plot
can be changed. Also, annotation can be shut off, and points can be plotted outside the
limits of the plot. The relevant arguments are frame.plot for including a border, bty for
the box type, asp for the aspect ratio, ann for annotation, and xpd for expanded plotting.
The argument frame.plot is a logical single-value argument that tells R whether to
put a frame around the plot. If the argument is a vector of length greater than one, only
the first value is used, and a warning is given. The default value is TRUE.
If frame.plot is TRUE, the argument bty describes the type of box. The argument
takes character values and can take on the values “o”, “l”, “7”, “c”, “u”, “]”, and “n”. The value
“o” is the default and indicates a four-sided box. The first six values (the capital letter for
the letters) look like the shape of the box that the value creates.
The value “l” plots the left and bottom axes; the value “7” plots the right and top axes;
the value “c” plots the top, left, and bottom axes; the value “u” plots the left, bottom, and
right axes; and the value “]” plots the bottom, right, and top axes. The value “n” indicates
to not draw a box. Figure 3-3 shows the six options other than the default, “o”.
The following code created the six plots in Figure 3-3.

Listing 3-3. Plotting with bty set to six different values

plot( LifeCycleSavings$pop75, LifeCycleSavings$pop15, bty="l", main="bty = l" )


plot( LifeCycleSavings$pop75, LifeCycleSavings$pop15, bty="7", main="bty = 7" )
plot( LifeCycleSavings$pop75, LifeCycleSavings$pop15, bty="c", main="bty = c" )
plot( LifeCycleSavings$pop75, LifeCycleSavings$pop15, bty="u", main="bty = u" )
plot( LifeCycleSavings$pop75, LifeCycleSavings$pop15, bty="]", main="bty = ]" )
plot( LifeCycleSavings$pop75, LifeCycleSavings$pop15, bty="n", main="bty = n" )

In Figure 3-3 are the plots generated by the code in Listing 3-3.

19
Random documents with unrelated
content Scribd suggests to you:
ungraded class her powers would have progressively deteriorated
and Katie “would be in darkness.”
The teacher who thus first fixed our attention upon these defective
children has long been a member of the settlement family. She has
carried us with her in her zeal for them, and we have come to see
that it is because the public conscience has been sluggish that
means and methods have not been more speedily devised toward
an intelligent solution of this serious social problem.
From the small beginnings of the experimental class in Henry
Street a separate department in the public schools was created in
1908, and this year (1915) there are 3,000 children throughout the
city under the care of specially trained teachers who have liberty to
adapt the school work to the children’s peculiar needs. All these
ungraded classes are under the direction of Miss Farrell.
Looking back upon the struggles to win formal recognition of the
existence of these children, who now so much engage the attention
of educators and scientists, we realize that our colleague’s devotion
to them, her power to excite enthusiasm in us, and her
understanding of the social implications of their existence, came
from a deep-lying principle that every human being, even the least
lovely, merits respectful consideration of his rights and his
personality.
Much is required of the public school teachers, and many of them
rise to every demand; but naturally, in so great a number, there are
some who do not recognize that theirs is the responsibility for
discovering the children who are not normal. Harry sits on our
doorsteps almost every day, ready to run errands, and harmless as
yet. Obviously defective, a “pronounced moron,” he was promoted
from class to class, and when one of his settlement friends called
upon the teacher to discuss Harry’s special needs, the teacher,
somewhat contemptuous of our anxiety, observed that “all that Harry
needed was a whipping.”
From one-half of one per cent. to two per cent. of children of
school age are, it is estimated, in need of special instruction because
of the quality or the imperfect functioning of their mental powers. The
public school has the power, and should exercise it, to bring within its
walls all the children physically and mentally competent to attend it. If
children are under intelligent observation, departures from the
normal can in many instances be recognized in time for training and
education according to the particular need. Long-continued
observation and record of the child are essential to intelligent
treatment of abnormalities concerning which there is even now very
little accurate information. Cumulative experience and data, such as
can be obtained only through the compulsory attendance at school
of the multitudes of children of this type, will finally give a basis for
scientific and humanitarian action regarding them.
Up to a certain period the
child’s helplessness demands
that every opportunity for
development be given him, but
that is not the whole of
society’s responsibility. The
time comes when the child’s
own interests and those of the
community demand the wisest,
least selfish, and most
statesmanlike action. Society
must state in definite terms its
right to be protected from the
hopelessly defective and the
moral pervert, wherever found.
This constitutes the real
problem of the abnormal. At
the adolescent period those
unfit for parenthood should be
guarded—girls and boys—and
society should be vested with
authority and power to
accomplish segregation, the
conditions of which should
attract and not repel.
Because so much needs to be said upon it, if anything is said at
all, I am loath to touch upon the one great obstacle to the effective
use of all the intelligence and the resources available for the well-
being of these children, the most baffling impediment to their and the
community’s protection, namely, the supreme authority of
parenthood, be it never so inefficient, avaricious, or even immoral.

The breaking up of the family because of poverty, through the


death or disappearance of the wage-earner, was, until comparatively
recent years, generally accepted as inevitable.
In the first winter of our residence on the East Side we took care of
Mr. S⸺, who was in an advanced stage of phthisis; and we daily
admired the wonderful ability of his wife, who kept the home dignified
while she sewed on wrappers, nursed her husband, and allowed
nothing to interfere with the children’s daily attendance at school.
When her husband died it seemed the most natural thing in the world
to help her to realize her own wishes and to approve her good
judgment in desiring to keep the family together. The orphan asylum
would doubtless have taken the children from her, leaving her
childless as well as widowed, and with no counterbalancing
advantage for the children to lighten her double woe. A large-minded
lover of children, who gave his money to orphans as well as to
orphanages, readily agreed to give the mother a monthly allowance
until the eldest son could legally go to work. It was our first “widow’s
pension.”
Our hopes in this particular case have been more than realized.
The eldest boy, it is true, has not achieved any notable place in the
community; but his sisters are teachers and most desirable elements
in the public school system of the city,—living testimony to the worth
of the mother’s character.
In no instance where we have prevented the disintegration of the
family because of poverty have we had reason to regret our
decision. Of course, the ability of the mother to maintain a standard
in the home and control the children is a necessary qualification in
any general recommendation for this treatment of the widow and
orphan, and competent supervision is essential to insure the
maintenance of these conditions.
At the famous White House
Conference on Children, held
at the invitation of President
Roosevelt, there was practical
unanimity on the part of the
experts who gathered there
that institutional life was
undesirable and that wherever
possible family life should be
maintained. Testimony as to
this came from many sources;
and keeping the family
together, or boarding the
orphan with a normal family
when adoption could not be
arranged, became the dominant note of the conference.
The children, in this as in many other instances, led us into
searching thought many years ago. Forlorn little Joseph had called
upon me with a crumpled note which he reluctantly dragged from a
pocket. It was from the admitting agent of an orphanage, explaining
that Joseph could not be taken into the institution until his head was
“cured”; and it gave some details regarding the family, the worthiness
of the mother, and her exceeding poverty. The agent hoped that I
might relieve her by expediting Joseph’s admission.
I tried to make the child’s daily visit to me interesting. The
treatment was not painful, but the end of each visit—he came with
patient regularity every day—left me as dolorous as himself. One
day I tried, by promise of a present or of any treat he fancied, to
bring out some expression of youthful spirit—all unavailingly. “But
you must wish for something,” I urged; “I never knew a boy who
didn’t.” For the first time the silent little lad showed enthusiasm. “I
wish you wouldn’t cure my head, so I needn’t go to the orphan
asylum.”
Unscrupulous parents, I am well aware, often try to shift the
responsibility for their children upon public institutions, but there are
many who share Joseph’s aversion to the institutional life, and we
early recognized that the dislike is based upon a sound instinct and
that a poor home might have compensating advantages compared
with the well-equipped institution.
There have been great changes in institutional methods since I
first had knowledge of them, and much ingenuity has been shown in
devising means to encourage the development of individuality and
initiative among the orphans. The cottage plan has been introduced
in some institutions to modify the abnormal life of large
congregations of children. But at best the life is artificial, and the
children lose inestimably through not having day by day the
experiences of normal existence. Valuable knowledge is lost
because the child does not learn from experience the connection
between the cost of necessities and the labor necessary to earn
them. It was somewhat pathetic, at another conference on child-
saving, to hear one of the speakers explain that he tried to meet this
need by having the examples in arithmetic relate to the cost of food
and household expenditures.
The lack of a normal emotional outlet is of consequence, and as a
result astute physiognomists often recognize what they term the
“institution look.” Maggie, an intelligent girl, who has since given
abundant evidence of spontaneity and spirit, spent a short time in an
excellent orphanage. She told me the other day, and wept as she
told it, that she had met no unkindness there, but remembered with
horror that when they arose in the morning the “orphans” waited to
be told what to do; and that feeling was upon her every hour of the
day. In fact, Maggie had stirred me to make arrangements to take
her out of the institution because, when I brought her for a visit to the
settlement, she stood at the window the entire afternoon, wistfully
watching the children play in our back yard, and not joining them
because no one had told her that she might.
One is reluctant to speak only of the disadvantages of institutional
life, for there are many children rescued from unfortunate family
conditions who testify to the good care they received, and who, in
after life, look back upon the orphanage as the only home they have
known. For some children, doubtless, such care will continue to be
necessary, but the conservative and rigid administration can be
softened, and the management and their charges delivered out of
the rut into which they have fallen, and from the tyranny of rules and
customs which have no better warrant than that they have always
existed.
Perhaps these illustrations are not too insignificant to record.
Happening to pass through a room in an asylum when the dentist
was paying his monthly visit, I saw a fine-looking young lad about to
have a sound front tooth extracted because he complained of
toothache. No provision had been made for anything but the
extraction of teeth. An offer to have the boy given proper treatment
outside the institution was not accepted, but it needed no more than
this to insure better dentistry in his case and in the institution in
future. The reports stated that corporal punishment was not
administered. When a little homesick lad displayed his hands,
swollen from paddling, a request for an investigation, and that I be
privileged to hear the inquiry, put a stop, and I am assured a
permanent one, to this form of discipline. These are the more
obvious disadvantages of institutional life for the child. The more
subtle and dangerous are the curbing of initiative and the belittling of
personality.
An intelligent observer of the effects of institution life on boys, a
Roman Catholic priest, established a temporary home in New York to
which they could come on their release from the institution until they
found employment and suitable places to board. His insight was
shown by his provision for the boys during their brief sojourn with
him of a formal table service, and weekly dances to which girls
whom he knew were invited. As he astutely observed, the boys often
went into common society, or society which made no demands,
because, from their lack of experience, they felt ill at ease in a circle
where any conventions were observed.
Where life goes by rule there is little spontaneous action or
conversation, but the children occasionally give clews to their
passion for personal relationships. In an institution which I knew the
children were allowed to write once a month to their friends. More
than one child without family ties took that opportunity to write letters
to an imaginary mother, to send messages of affection to imaginary
brothers and sisters, and to ask for personal gifts. They knew, of
course, that the letters would never leave the institution.
An unusual instance of intense longing for family life and the
desire to “belong” to someone was given by Tillie, who had lived all
her life in an orphan asylum. Sometimes she dreamed of her mother,
and often asked where she was. When she was ten years old the
wife of the superintendent told her that her mother had brought her
to the asylum, but that all she could remember about her was that
she had red hair. From that day the child’s desire to re-establish
relations with her mother never flagged. In the files of the asylum a
letter was discovered from an overseer of the poor in an upstate
town, saying that the woman had wandered there. At Tillie’s urgent
request he was written to again, and after a search on his part it was
learned that she had been declared insane and taken to the hospital
at Rochester. The very day that Tillie was released from the orphan
asylum she secured money for the trip and went to Rochester. The
officials of the hospital received her kindly and took her into the ward
where, although she had no memory of having seen her, she
identified her mother—doubtless by the color of her hair. The mother,
alas, did not recognize her. Two years later the girl revisited the
hospital and found her mother enjoying an interval of memory. Tillie
told me that she learned “two important things”—that she had had a
brother and my name. How I was connected with the fortunes of the
family the poor, bewildered woman could not explain, and I have no
recollection of her. Tillie followed these clews, as she has every
other. She has learned that the brother was sent West with orphans
from an Eastern institution, and that he has joined the army. The
devoted girl is making every effort to establish a home to which she
can bring the mother and brother, utterly regardless of the burden it
will place on her young shoulders.
We must turn to the younger countries for testimony as to the
wisdom of the non-institutional care of dependent children. In
Australia the plan for many years in all the provinces has been to
care for them in homes, and in Queensland and New South Wales
the laws permit the children to be boarded out to their own mothers.
It is encouraging to note the increasing number of responsible
people in America who are ready to adopt children. It may not be
possible to find a sufficient number of suitable homes to provide for
all who are dependent; but once the policy of decentralization is
established, other methods will be evolved to avoid large
congregations of boys and girls. Two of my colleagues and I have
found much happiness in assuming responsibility for eight children.
Quite apart from our own pleasure in taking to ourselves these
“nieces” and “nephews,” we believe that we shall be able to
demonstrate convincingly the practicability of establishing small
groups of children, without ties of their own, as a family unit. Our
children live the year round in our country home, and are identified
with the life of the community; and we hope to provide opportunity for
the development of their individual tastes and aptitudes.
Education and the child is a theme of
widest social significance. To the age-old
appeal that the child’s dependence
makes upon the affections has been
added a conviction of the necessity for a
guarded and trained childhood, that better
men and women may be developed. It is
a modern note in patriotism and civic
responsibility, which impels those who are
brought in contact with the children of the
poor to protect them from premature
burdens, to prolong their childhood and
the period of growth. Biologists bring
suggestive and illuminating analogies, but
On the Farm when one has lived many years in a
neighborhood such as ours the children
themselves tell the story. We know that
physical well-being in later life is largely dependent upon early care,
that only the exceptional boys and girls can escape the
unwholesome effects of premature labor, and that lack of training is
responsible for the enormous proportion of unskilled and
unemployable among the workers.
The stronghold of our democracy is the public school. This
conviction lies deep in the hearts of those social enthusiasts who
would keep the school free from the demoralization of cant and
impure politics, and restore it to the people, a shrine for education, a
center for public uses.
The young members of the settlement clubs hear this doctrine
preached not infrequently. Last June the City Superintendent,
addressing a class graduating from the normal school, made an
appeal for idealism in their work. He spoke of the possibilities in their
profession for far-reaching social service, and named as one who
exemplified his theme the principal of a great city school, once one
of our settlement boys.
CHAPTER VII
CHILDREN WHO WORK

Bessie has had eight “jobs” in six months. Obviously under


sixteen, she has had to produce her “working papers” before she
could be taken on. The fact that she has met the requirements
necessary to obtain the papers, and that her employer has
demanded them, is evidence of the advance made in New York
State since we first became acquainted with the children of the poor.
Bessie has had to prove by birth certificate or other documentary
evidence that she is really fourteen, has had to submit to a simple
test in English and arithmetic, present proof of at least 130 days’
school attendance in the year before leaving, and, after examination
by a medical officer, has had to be declared physically fit to enter
shop or factory.
No longer could Annie, the cobbler’s daughter, by unchallenged
perjury obtain the state sanction to her premature employment.
Gone are the easy days when Francesca’s father, defying school
mandates, openly offered his little ones in the labor market. Yet we
are far from satisfied. Bessie, though she meets the requirements of
the law, goes out wholly unprepared for self-support; she is of no
industrial value, and is easily demoralized by the conviction of her
unimportance to her “boss,” certain that her casual employment and
dismissal have hardly been noted, save as she herself has been
affected by the pay envelope. Her industrial experience is no
surprise to her settlement friends, for she is a type of the boys and
girls who, twice a year, swarm out of the school and find their way to
the Department of Health to obtain working papers. Bessie’s father is
a phthisis case; her mother, the chief wage-earner, an example of
devotion and industry. The girl has been a fairly good student and
dutiful in the home, where for several years she has scrubbed the
floors and “looked after” the children in her mother’s absence.
Tommy also appeared at the office with his credentials and
successfully passed all the tests, until the scale showed him
suspiciously weighty for his appearance. Inquiry as to what bulged
one of his pockets disclosed the fact that he had a piece of lead
there. He had been told that he probably would not weigh enough to
pass the doctor. Talking the matter over with Mrs. Sanderson, I
learned that the immediate reason for taking Tommy out of school
was his need of a pair of shoes. The mother was not insensitive to
his pinched appearance. A few days later Tommy was taken to visit
our children at the farm, and it was pleasant to see that the natural
boy had not been crushed. He devoured the most juvenile story-
books and was “crazy” about the sledding. The self-respecting
mother was not injured in her pride of independence by a little
necessary aid carefully given; and though I have not seen Tommy
recently, I am sure that neither he nor his employer lost anything
because of the better physical condition in which he entered work
after his happy winter at the farm.
This attempt to cheat the law by the very children for whose
protection it was designed, and the occasional disregard of the
purposes of the enactments by enforcing officials, suggest Alice’s
perplexity when she encountered the topsy-turvy Wonderland.
It was about twelve years ago that a group of settlement people in
New York gathered to consider the advisability of organizing public
sentiment against the exploitation of child workers. The New York
Child Labor Committee thereupon came into existence, under the
chairmanship of the then head of the University Settlement, and that
committee has since been steadily engaged in advancing standards
of conditions under which children may work. Through legislative
enactment and publicity it has endeavored to form public opinion on
those socially constructive principles inherent in the conservation of
children.
Of necessity child labor laws approach the problem from the
negative side of prohibition. To meet the problem positively, the
Henry Street Settlement established in 1908 a definite system of
“scholarships” for children from fourteen to sixteen, to give training
during what have been termed the “two wasted years” to as many as
its funds permitted.
A committee of administration receives the applications which
come from all parts of the boroughs of Manhattan and the Bronx,
and preference is given to those children of widows or disabled
fathers whose need seems greatest. Careful inquiry is made by the
capable secretary to discover natural inclinations or aptitudes, and
these are used as guides in determining the character of the
instruction to be given. Three dollars a week—somewhat less than
the sum the children might have been earning—is given weekly for
two years, during which time they are under continual supervision at
home, at school, and through regular visits to the settlement. They
are looked after physically, provided with occasional recreation, and,
in the summer time, whenever possible, a vacation in the country.
The committee keeps in close touch with the educational agencies
throughout the city, gathers knowledge of the trades that give
opportunity for advancement, and, to aid teachers, settlement
workers, parents, and children, publishes from time to time a
directory of vocational resources in the city.[5]
Approval of this endowment for future efficiency comes from many
sources, but no encouragement has been greater than the fact that,
while the plan was still in its experimental stage, my own first boys’
club, the members of which had now grown to manhood, celebrated
their fifteenth anniversary by contributing three scholarships; and
that the Women’s Club, whose members feel most painfully the
disadvantage of the small wage of the unskilled, have given from
their club treasury or by voluntary assessment for this help to the
boys and girls.
The children who show talent and those whose immaturity or
poverty of intellect makes their early venture into the world more
pitiful, have equal claim upon these scholarships.
Pippa was one of the latter. She was scorned at home for obvious
slowness of wit and “bad eyes”; her mother deplored the fact that
there was nothing for her to do but “getta married.” Pippa’s club
leader’s reports were equally discouraging, save for the fact that she
had shown some dexterity in the sewing class. At the time when she
would have begun her patrol of the streets, looking for signs of “Girls
Wanted,” the offer of a scholarship prevailed with the mother, and
she was given one year’s further education in a trade school. After a
conference between the teachers and her settlement friends,
sample-mounting was decided upon as best suited to Pippa’s
capacities. She has done well with the training, and is now looked up
to as the one wage-earner in the family who is regularly employed.
One of the accompanying charts compares the wage-earning
capacity of the boys and girls who have had the advantage of these
scholarships with that of an equal number of untrained young people
whose careers are known through their industrial placement by
perhaps the most careful juvenile employment agency in the city.[6]
The deductions that we made from the experience of the Henry
Street children were corroborated by an inquiry made by one of our
residents into the industrial history of one thousand children who had
applied for working papers at the Department of Health. The
employment-record chart was compiled from data obtained in that
inquiry.
Comparative Weekly Wages of 72 Children Who Have Worked Four Years without
Previous Training, from the Record of ⸺ Employment Bureau; and of
Scholarship Children Who Have Had Two Years of Vocational Training.

Our connections in the city enable us occasionally to coax


opportunities for those boys and girls for whom experience in the
shop itself would seem best. Jimmy had lost a leg “hooking on the
truck,” and his mother supposed that “such things happen when you
have to lock them out all day.” In the whittling class the lad showed
dexterity with the sloyd knife, and he was thereupon given special
privileges in the carpentry and carving classes of the settlement.
When he reached working age, one of our friends, a distinguished
patron of a high-grade decorator, induced the latter to give the boy a
chance. Misgivings as to the permanency of his tenure of the place
were allayed when Jimmy, aglow with enthusiasm over his work,
brought a beautifully carved mahogany box and told of the help the
skilled men in the shop were giving him. On the whole, he
concluded, “a fellow with one leg” had advantages over other
cabinetmakers; “he could get into so many more tight places and
corners than with two.”

The Typical Employment Record of One Child between the Ages of 14 and 16.

Bessie and Jimmy and Pippa and Esther and their little comrades
stir us to contribute our human documents to the propaganda
instituted in behalf of children. In this, as in other experiments at the
settlement, we do not believe that what we offer is of great
consequence unless the demonstrations we make and the
experience we gain are applicable to the problems of the community.
On no other single interest do the members of our settlement meet
with such unanimity. Years of concern about individual children might
in any case have brought this about, but irresistible has been the
influence exercised by Mrs. Florence Kelley, now and for many years
a member of the settlement family. She has long consecrated her
energies to securing protective legislation throughout the country for
children compelled to labor and, with the late Edgar Gardner Murphy,
of Alabama, suggested the creation of the National Child Labor
Committee. In its ten years’ existence it has affected legislation in
forty-seven states, which have enacted new or improved child labor
laws. On this and on the New York State Committee Mrs. Kelley and
I have served since their creation.
Though much has been accomplished during this decade, the field
is immensely larger than was supposed, and forces inimical to
reform, not reckoned with at first, have been encountered. Despite
this opposition, however, we believe that the abolition of child labor
abuses in America is not very far off.
In Pennsylvania, within a very few years, insistence upon
satisfactory proof of age was strenuously opposed. Officials who
should have been working in harmony with the committee persisted
in declaring that the parent’s affidavit, long before discarded in New
York State, was sufficient evidence, despite the fact that coroners’
inquests after mine disasters showed child workers of ten and eleven
years. The Southern mill children, the little cranberry-bog workers,
the oyster shuckers, and the boys in glass factories and mines have
shown that this disregard of children is not peculiar to any one
section of the country, though Southern states have been most
tenacious of the exemption of children of “dependent parents” or
“orphans” from working-paper requirements.
In the archives at Washington much interesting evidence lies
buried in the unpublished portions of reports of the federal
investigation into the work of women and children. The need of this
investigation was originally urged by settlement people. One mill
owner greeted the government inspectors most cordially and, to
show his patriotism, ordered the flag to be raised above the works.
The raising of the flag, as it afterwards transpired, was a signal to the
children employed in the mill to go home. In the early days of child
labor reform in New York the children on Henry Street would
sometimes relate vividly their experience of being suddenly whisked
out of sight when the approach of the factory inspector was signaled.
It is perhaps unnecessary to mention the obvious fact that the
child worker is in competition with the adult and drags down his
wages. At the Child Labor Conference held in Washington in
January, 1915, a manufacturer in the textile industry cited the wages
paid to adults in certain operations in the mills as fourteen cents per
hour where there were prohibitive child labor laws and eleven cents
an hour where there were none.
The National Child Labor Committee now asks Congress through
a federal bill to outlaw interstate traffic in goods produced by the
labor of children. Such a law would protect the public-spirited
employer who is now obliged to compete in the market with men
whose business methods he condemns.

Sammie and his brother sold papers in front of one of the large
hotels every night. The more they shivered with cold, the greater the
harvest of pennies. No wonder that the white-faced little boy stayed
out long after his cold had become serious. He himself asked for
admission to the hospital, and died there before his absence was
noted. After his death relatives appeared, willing to aid according to
their small means, and the relief society increased its stipend to his
family. At any time during his life this aid might have been
forthcoming, had not the public unthinkingly made his sacrifice
possible by the purchase of his papers.
Opposition to regulating and limiting the sale of papers by little
boys on the streets is hard to overcome. A juvenile literature of more
than thirty years ago glorified the newsboy and his improbable
financial and social achievements, and interest in him was
heightened by a series of pictures by a popular painter, wherein
ragged youngsters of an extraordinary cleanliness of face were
portrayed as newsboys and bootblacks. In opposition to the charm of
this presentation, the practical reformer offers the photographs,
taken at midnight, of tiny lads asleep on gratings in front of
newspaper offices, waiting for the early editions. He finds in street
work the most fruitful source of juvenile delinquency, with newsboys
heading the list.
I am aware that at this point numerous readers will recall instances
of remarkable achievements by the barefoot boy, the wide-awake
young news-seller. We too
have known the exceptional
lad who has accomplished
marvels in the teeth of,
sometimes because of, great
disadvantages; but after twenty
years I, for one, have no
illusions as to the outcome for
the ordinary child.
When the New York Child
Labor Committee secured the
enactment of a law making it
mandatory for the schoolboy
who desired to sell papers to
obtain the consent of his
parents before receiving the
permissive badge from the
district school superintendent,
we sent a visitor from the settlement to the families of one hundred
who had expressed their intention to secure the badge. Of these
families over sixty were opposed to the child’s selling papers on the
street. The boy wanted to “because the other fellows did,” and the
parents based their objections, in most cases, on precisely those
grounds urged by social workers,—namely, that street work led the
boys into bad company, irregular hours, gambling, and “waste of
shoe leather.” Some asserted that they received no money from the
children from the sale of the papers. On the other hand, a committee
of which I was chairman, which made city-wide inquiry into juvenile
street work, found instances of well-to-do parents who sent their little
children on the streets to sell papers, sometimes in violation of the
law.
The three chief obstacles to progress in protection of the children
are the material interests of the employers, many of whom still
believe that the child is a necessary instrument of profit; a
sentimental, unanalytical feeling of kindness to the poor; and the
attitude of officials upon whom the enforcement of the law depends,
but who are often tempted by appeals to thwart its humane purpose.
A truant officer of my acquaintance took upon himself discretionary
power to condone the absence of a little child from school on the
ground that the child was employed and the widowed mother poor.
Himself a tender father, cherishing his small son, I asked him if that
was what he would have me do in case he died and I found his child
at work. Oddly enough, he seemed then to realize for the first time
that those who were battling for school attendance for the children of
the poor and prevention of their premature employment, even though
the widow and child might have to receive financial aid, were trying
to take, in part, the place of the dead father.
To meet cases where enforcement of the new standards of the law
involves undeniable hardship, another form of so-called “scholarship”
is given by the New York Child Labor Committee. Upon investigation
a sum approximating the possible earnings of the child is furnished
until such time as he or she can legally go to work. An indirect but
important result of the giving of these scholarships has been the
continuous information obtained regarding enforcement of the school
attendance law. Inquiry into the history of candidates disclosed, at
first, many cases in which, although the family had been in New York
for years, some of the children had never attended school, and
perhaps never would have done so had they not been discovered at
work illegally. The number of these cases is now diminishing.
Allusion to these two forms of “scholarships” should not be made
without mention of one other in the settlement, known as the “Alva
Scholarship.” The interest on the endowment is used to promote the
training of gifted individuals and to commemorate a beloved club
leader. The money to establish it was given by the young woman’s
associates in the settlement, and small sums have been contributed
to it by the girls who were members of her own and other clubs.
CHAPTER VIII
THE NATION’S CHILDREN

Few people have any idea of the extent of tenement-house


manufactures. There are at present over thirteen thousand houses in
Greater New York alone licensed for this purpose, and each license
may cover from one to forty families. These figures give no complete
idea of the work done in tenements. Much of it is carried on in
unlicensed houses, and work not yet listed as forbidden is carried
home. To supervise this immense field eight inspectors only were
assigned in 1913. Changing fashions in dress and the character of
certain of the seasonal trades make it very difficult for the
Department of Labor to adjust the license list. This explains, to some
extent, the lack of knowledge concerning home work on the part of
officials, even when the Department of Labor is efficiently
administered. Nevertheless, home work has greatly decreased.
Twenty years ago, when we went from house to house caring for
the sick, manufacturing was carried on in the tenements on a scale
that does not exist to-day. With no little consternation we saw toys
and infants’ clothing, and sometimes food itself, made under
conditions that would not have been tolerated in factories, even at
that time. And the connection of remote communities and individuals
with the East Side of New York was impressed upon us when we
saw a roomful of children’s clothing shipped to the Southern trade
from a tenement where there were sixteen cases of measles. One of
our patients, in an advanced stage of tuberculosis, until our
appearance on the scene, sat coughing in her bed, making
cigarettes and moistening the paper with her lips. In another
tenement in a nearby street we found children ill with scarlet fever.
The parents worked as finishers of women’s cloaks of good quality,
evidently meant to be worn by the well-to-do. The garments covered
the little patients, and the bed on which they lay was practically used
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!

textbookfull.com

You might also like