100% found this document useful (10 votes)
200 views69 pages

R in Action 3rd Edition Robert I. Kabacoff - Download The Ebook Today and Own The Complete Version

The document promotes the ebook collection available at textbookfull.com, highlighting key titles such as 'R in Action' by Robert I. Kabacoff and other educational resources. It emphasizes the benefits of using R for data analysis, including its comprehensive statistical capabilities and advanced graphics. The text also outlines the structure of the 'R in Action' book, detailing its contents and the skills readers can expect to gain.

Uploaded by

duttobechev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (10 votes)
200 views69 pages

R in Action 3rd Edition Robert I. Kabacoff - Download The Ebook Today and Own The Complete Version

The document promotes the ebook collection available at textbookfull.com, highlighting key titles such as 'R in Action' by Robert I. Kabacoff and other educational resources. It emphasizes the benefits of using R for data analysis, including its comprehensive statistical capabilities and advanced graphics. The text also outlines the structure of the 'R in Action' book, detailing its contents and the skills readers can expect to gain.

Uploaded by

duttobechev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Explore the full ebook collection and download it now at textbookfull.

com

R in Action 3rd Edition Robert I. Kabacoff

https://textbookfull.com/product/r-in-action-3rd-edition-
robert-i-kabacoff/

OR CLICK HERE

DOWLOAD EBOOK

Browse and Get More Ebook Downloads Instantly at https://textbookfull.com


Click here to visit textbookfull.com and download textbook now
Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

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/

textbookfull.com

Modern Data Visualization with R (Chapman & Hall/CRC The R


Series) 1st Edition Kabacoff

https://textbookfull.com/product/modern-data-visualization-with-r-
chapman-hall-crc-the-r-series-1st-edition-kabacoff/

textbookfull.com

Alternative Investments CAIA Level I 3rd Edition Donald R.


Chambers

https://textbookfull.com/product/alternative-investments-caia-
level-i-3rd-edition-donald-r-chambers/

textbookfull.com

Windows PowerShell in Action 3rd Edition Bruce Payette

https://textbookfull.com/product/windows-powershell-in-action-3rd-
edition-bruce-payette/

textbookfull.com
US Environmental Policy in Action Sara R. Rinfret

https://textbookfull.com/product/us-environmental-policy-in-action-
sara-r-rinfret/

textbookfull.com

Teaching and Researching Speaking Applied Linguistics in


Action 3rd Edition Hughes

https://textbookfull.com/product/teaching-and-researching-speaking-
applied-linguistics-in-action-3rd-edition-hughes/

textbookfull.com

Algebra I Math 200 Robert Boltje

https://textbookfull.com/product/algebra-i-math-200-robert-boltje/

textbookfull.com

Doing Environmental Ethics 3rd Edition Robert Traer

https://textbookfull.com/product/doing-environmental-ethics-3rd-
edition-robert-traer/

textbookfull.com

Blended Learning in Action A Practical Guide Toward


Sustainable Change Catlin R. Tucker

https://textbookfull.com/product/blended-learning-in-action-a-
practical-guide-toward-sustainable-change-catlin-r-tucker/

textbookfull.com
MEAP Edition
Manning Early Access Program
R in Action
Third Edition
Version 7

Copyright 2020 Manning Publications

For more information on this and other Manning titles go to


manning.com

©Manning Publications Co. To comment go to liveBook


welcome
Thank you for purchasing the MEAP for R in Action (3rd edition). If you picked up this book,
you probably have some data that you need to collect, summarize, transform, explore, model,
visualize, or present. If so, then R is for you! R has become the worldwide language for
statistics, predictive analytics, and data visualization. It offers the widest range of
methodologies for understanding data currently available, from the most basic to the most
complex and bleeding edge.
This book should appeal to anyone who deals with data. No background in statistical
programming or the R language is assumed. Although the book is accessible to novices, there
should be enough new and practical material to satisfy even experienced R mavens.
There is a generally held notion that R is difficult to learn. What I hope to show you is that
is doesn’t have to be. R is broad and powerful, with so many analytic and graphic functions
available (more than 80,000 at last count) that it easily intimidates both novice and
experienced users alike. But there is rhyme and reason to the apparent madness. With
guidelines and instructions, you can navigate the tremendous resources available, selecting
the tools you need to accomplish your work with style, elegance, efficiency, and certain degree
of coolness.
By the end of the book, you should be able to use R to

• Access data (importing data from multiple sources)


• Clean data (code missing data, fix or delete miscoded data, transform variables into
more useful formats)
• Explore and summarize data (getting descriptive statistics to help characterize the
data)
• Visualize data (using a wide range of attractive and meaningful graphs)
• Model data (uncovering relationships, testing hypotheses, and developing predictive
models using both basic and advancedl statistical techniques and cutting edge machine
learning approaches)
• Prepare results for others (creating publication-quality tables, graphs, and reports)

If you have any questions, comments, or suggestions, please share them in Manning’s
Author Online forum for my book. Your comments are invaluable and will help me craft
content that is easier to understand and use effectively.

—Rob Kabacoff

©Manning Publications Co. To comment go to liveBook


brief contents
PART 1: GETTING STARTED
1 Introduction to R
2 Creating a dataset
3 Basic data management
4 Getting started with graphs
5 Advanced data management
PART 2: BASIC METHODS
6 Basic Graphs
7 Basic Statistics
PART 3: INTERMEDIATE METHODS
8 Regression
9 Analysis of Variance
10 Power Analysis
11 Intermediate Graphs
12 Resampling statistics and bootstrapping
PART 4: ADVANCED METHODS
13 Generalized Linear Models
14 Principal Components and Factor Analysis
15 Time Series
16 Clustering

©Manning Publications Co. To comment go to liveBook


17 Classification
18 Advanced methods for missing data
PART 5: EXPANDING YOUR SKILLS
19 Advanced Graphics with ggplot2
20 Advanced R Programming
21 Creating a Package
APPENDIXES:
A Version control with git
B Customizing the startup environment
C Exporting data from R
D Matrix Algebra in R
E Packages used in this book
F Working with large datasets
G Updating an R installation

©Manning Publications Co. To comment go to liveBook


1

1
Introduction to R

This chapter covers

• Installing R and RStudio


• Understanding the R language
• Running programs

How we analyze data has changed dramatically in recent years. With the advent of personal
computers and the internet, the sheer volume of data we have available has grown
enormously. Companies have terabytes of data about the consumers they interact with, and
governmental, academic, and private research institutions have extensive archival and survey
data on every manner of research topic. Gleaning information (let alone wisdom) from these
massive stores of data has become an industry in itself. At the same time, presenting the
information in easily accessible and digestible ways has become increasingly challenging.
The science of data analysis (statistics, psychometrics, econometrics, and machine
learning) has kept pace with this explosion of data. Before personal computers and the
internet, new statistical methods were developed by academic researchers who published their
results as theoretical papers in professional journals. It could take years for these methods to
be adapted by programmers and incorporated into the statistical packages widely available to
data analysts. Today, new methodologies appear daily. Statistical researchers publish new and
improved methods, along with the code to produce them, on easily accessible websites.
The advent of personal computers had another effect on the way we analyze data. When
data analysis was carried out on mainframe computers, computer time was precious and
difficult to come by. Analysts would carefully set up a computer run with all the parameters
and options thought to be needed. When the procedure ran, the resulting output could be
dozens or hundreds of pages long. The analyst would sift through this output, extracting

©Manning Publications Co. To comment go to liveBook


2

useful material and discarding the rest. Many popular statistical packages (such as SAS and
SPSS) were originally developed during this period and still follow this approach to some
degree.
With the cheap and easy access afforded by personal computers, modern data analysis has
shifted to a different paradigm. Rather than setting up a complete data analysis all at once,
the process has become highly interactive, with the output from each stage serving as the
input for the next stage. An example of a typical analysis is shown in figure 1.1. At any point,
the cycles may include transforming the data, imputing missing values, adding or deleting
variables, fitting statistical models, and looping back through the whole process again. The
process stops when the analyst believes they understand the data intimately and have
answered all the relevant questions that can be answered.

Figure 1.1 Steps in a typical data analysis

The advent of personal computers (and especially the availability of high-resolution monitors)
has also had an impact on how results are understood and presented. A picture really can be
worth a thousand words, and human beings are adept at extracting useful information from
visual presentations. Modern data analysis increasingly relies on graphical presentations to
uncover meaning and convey results.
Today’s data analysts need to access data from a wide range of sources (database
management systems, text files, statistical packages, spreadsheets, and web pages), merge
the pieces of data together, clean and annotate them, analyze them with the latest methods,
present the findings in meaningful and graphically appealing ways, and incorporate the results
into attractive reports that can be distributed to stakeholders and the public. As you’ll see in

©Manning Publications Co. To comment go to liveBook


3

the following pages, R is a comprehensive software package that’s ideally suited to accomplish
these goals.

1.1 Why use R?


R is a language and environment for statistical computing and graphics, similar to the S
language originally developed at Bell Labs. It’s an open source solution to data analysis that’s
supported by a large and active worldwide research community. But there are many popular
statistical and graphing packages available (such as Microsoft Excel, SAS, IBM SPSS, Stata,
and Minitab). Why turn to R?
R has many features to recommend it:

• Most commercial statistical software platforms cost thousands, if not tens of thousands,
of dollars. R is free! If you’re a teacher or a student, the benefits are obvious.
• R is a comprehensive statistical platform, offering all manner of data-analytic
techniques. Just about any type of data analysis can be done in R.
• R contains advanced statistical routines not yet available in other packages. In fact,
new methods become available for download on a weekly basis. If you’re a SAS user,
imagine getting a new SAS PROC every few days.
• R has state-of-the-art graphics capabilities. If you want to visualize complex data, R
has the most comprehensive and powerful feature set available.
• R is a powerful platform for interactive data analysis and exploration. From its
inception, it was designed to support the approach outlined in figure 1.1. For example,
the results of any analytic step can easily be saved, manipulated, and used as input for
additional analyses.
• Getting data into a usable form from multiple sources can be a challenging proposition.
R can easily import data from a wide variety of sources, including text files, database-
management systems, statistical packages, and specialized data stores. It can write
data out to these systems as well. R can also access data directly from web pages,
social media sites, and a wide range of online data services.
• R provides an unparalleled platform for programming new statistical methods in an
easy, straightforward manner. It’s easily extensible and provides a natural language for
quickly programming recently published methods.
• R functionality can be integrated into applications written in other languages, including
C++, Java, Python, PHP, Pentaho, SAS, and SPSS. This allows you to continue working
in a language that you may be familiar with, while adding R’s capabilities to your
applications.
• R runs on a wide array of platforms, including Windows, Unix, and Mac OS X. It’s likely
to run on any computer you may have. (I’ve even come across guides for installing R
on an iPhone, which is impressive but probably not a good idea.)
• If you don’t want to learn a new language, a variety of graphic user interfaces (GUIs)
are available, offering the power of R through menus and dialogs.

©Manning Publications Co. To comment go to liveBook


4

You can see an example of R’s graphic capabilities in figure 1.2. This graph describes the
relationships between years of experience and wages for men in women in six industries,
collected from the US Current Population Survey in 1985. Technically, it’s a matrix of
scatterplots with gender displayed by color and symbol. Trends are described using linear
regression lines. If these terms scatterplot and regression lines are unfamiliar to you, don’t
worry. We’ll cover them in later chapters.

Figure 1.2 Relationships between wages and years of experience for men and women in six industries. Source:
mosaicData package. Graphs like this can be created easily with a few lines of code in R.

©Manning Publications Co. To comment go to liveBook


5

Some of the more interesting findings from this graph:

• The relationship between experience and wages varies by both gender and industry.
• In the service industry, wages do not appear to go up with experience for either men or
women.
• In management positions, wages tend to go up with experience for men, but not for
women.

Are these differences real or can they be explained as chance sampling variation? We'll discuss
this further in Chapter 8 Regression. The important point is that R allows you to create
elegant, informative, highly customized graphs in a simple and straightforward fashion.
Creating similar plots in other statistical languages would be difficult, time-consuming, or
impossible.
Unfortunately, R can have a steep learning curve. Because it can do so much, the
documentation and help files available are voluminous. Additionally, because much of the
functionality comes from optional modules created by independent contributors, this
documentation can be scattered and difficult to locate. In fact, getting a handle on all that R
can do is a challenge.
The goal of this book is to make access to R quick and easy. We’ll tour the many features
of R, covering enough material to get you started on your data, with pointers on where to go
when you need to learn more. Let’s begin by installing the program.

1.2 Obtaining and installing R


R is freely available from the Comprehensive R Archive Network (CRAN) at http://cran.r-
project.org. Precompiled binaries are available for Linux, Mac OS X, and Windows. Follow the
directions for installing the base product on the platform of your choice. Later we’ll talk about
adding functionality through optional modules called packages (also available from CRAN).
Appendix A describes how to install or update an existing R installation to a newer version.

1.3 Working with R


R is a case-sensitive, interpreted language. You can enter commands one at a time at the
command prompt (>) or run a set of commands from a source file. There are a wide variety of
data types, including vectors, matrices, data frames (similar to datasets), and lists (collections
of objects). We’ll discuss each of these data types in chapter 2.
Most functionality is provided through built-in and user-created functions and the creation
and manipulation of objects. An object is basically anything that can be assigned a value. For
R, that is just about everything (data, functions, graphs, analytic results, and more). Every
object has a class attribute (basically one or more associated text descriptors) that tells R how
to print, plot, summarize, or in some other way, manipulate the object.

©Manning Publications Co. To comment go to liveBook


6

All objects are kept in memory during an interactive session. Basic functions are available
by default. Other functions are contained in packages that can be attached to a current
session as needed.
Statements consist of functions and assignments. R uses the symbol <- for assignments,
rather than the typical = sign. For example, the statement
x <- rnorm(5)

creates a vector object named x containing five random deviates from a standard normal
distribution.

NOTE R allows the = sign to be used for object assignments. But you won’t find many programs written that
way, because it’s not standard syntax, there are some situations in which it won’t work, and R programmers
will make fun of you. You can also reverse the assignment direction. For instance, rnorm(5) -> x is
equivalent to the previous statement. Again, doing so is uncommon and isn’t recommended in this book.

Comments are preceded by the # symbol. Any text appearing after the # is ignored by the R
interpreter. An example program is given in the next section.

1.3.1 Getting started


The first step in using R is, of course, to install it. Instructions are provided in Appendix A.
Once R is installed, start it up. If you’re using Windows, launch R from the Start menu. On a
Mac, double-click the R icon in the Applications folder. For Linux, type R at the command
prompt of a terminal window. Any of these will start the R interface (see figure 1.3 for an
example).
To get a feel for the interface, let’s work through a simple, contrived example. Say that
you’re studying physical development and you’ve collected the ages and weights of 10 infants
in their first year of life (see table 1.1). You’re interested in the distribution of the weights and
their relationship to age.

©Manning Publications Co. To comment go to liveBook


7

Figure 1.3 Example of the R interface on Windows

Table 1.1 The ages and weights of 10 infants

Age (mo.) Weight (kg.)

01 4.4

03 5.3

05 7.2

02 5.2

11 8.5

09 7.3

03 6.0

09 10.4

12 10.2

03 6.1

Note: These are fictional data.

The analysis is given in listing 1.1. Age and weight data are entered as vectors using the
function c(), which combines its arguments into a vector or list. The mean and standard

©Manning Publications Co. To comment go to liveBook


8

deviation of the weights, along with the correlation between age and weight, are provided by
the functions mean(), sd(), and cor(), respectively. Finally, age is plotted against weight
using the plot() function, allowing you to visually inspect the trend. The q() function ends
the session and lets you quit.

Listing 1.1 A sample R session


> age <- c(1,3,5,2,11,9,3,9,12,3)
> weight <- c(4.4,5.3,7.2,5.2,8.5,7.3,6.0,10.4,10.2,6.1)
> mean(weight)
[1] 7.06
> sd(weight)
[1] 2.077498
> cor(age,weight)
[1] 0.9075655
> plot(age,weight)
> q()

You can see from listing 1.1 that the mean weight for these 10 infants is 7.06 kilograms, that
the standard deviation is 2.08 kilograms, and that there is strong linear relationship between
age in months and weight in kilograms (correlation = 0.91). The relationship can also be seen
in the scatter plot in figure 1.4. Not surprisingly, as infants get older, they tend to weigh
more.

©Manning Publications Co. To comment go to liveBook


9

Figure 1.4 Scatter plot of infant weight (kg) by age (mo)

The scatter plot in figure 1.4 is informative but somewhat utilitarian and unattractive. In later
chapters, you’ll see how to create more attractive and sophisticated graphs.

TIP To get a sense of what R can do graphically, take a look at the graphs described in Data Visualization with
R (http://rkabacoff.github.io/datavis) and The Top 50 ggplot2 Visualizations – The Master List (http://r-
statistics.co/Top50-Ggplot2-Visualizations-MasterList-R-Code.html).

1.3.2 Using RStudio


The standard interface to R is very basic, offering little more than a command prompt for
entering lines of code. For real-life projects, you'll want a more comprehensive tool for writing
code and viewing output. Several such tools, called Integrated Development Environments
(IDEs) have been developed for R, including Eclipse with StatET, Visual Studio for R, and
RStudio Desktop.
RStudio Desktop (http://www.rstudio.com) is by far the most popular choice. It provides a
multi-window, multi-tabbed environment, with tools for importing data, writing clean code,
debugging errors, visualizing output, and writing reports.

©Manning Publications Co. To comment go to liveBook


10

RStudio is freely available as an open source product, and is easily installed on Windows,
Mac, and Linux. Since RStudio is an interface to R, be sure to install R before installing RStudio
Desktop.

TIP You can customize the RStudio interface by selecting the Tools> Global Options… from the menu bar. On
the General tab, I recommend unchecking Restore .RData into workspace at startup, and selecting
Never for Save workspace to .Rdata on exit. This will ensure a clean startup each time you run
RStudio.

Let's rerun the code from Listing 1.1 using RStudio. If you’re using Windows, launch RStudio
from the Start menu. On a Mac, double-click the RSudio icon in the Applications folder. For
Linux, type rstudio at the command prompt of a terminal window. The same interface will
appear on all three platforms (see Figure 1.5).

Figure 1.5 RStudio Desktop

©Manning Publications Co. To comment go to liveBook


11

SCRIPT WINDOW

From the File menu, select New File > R Script. A new script window will open in the upper
right hand corner of the screen (Figure 1.5 A). Type the code from Listing 1.1. into this
window.
As you type, the editor offers syntax highlighting and code completion (see figure 1.6).
For example, as you type plot a pop-up window will appear with all functions that start with
the letters that you've typed so far. Use can use the UP and DOWN arrow keys to select a
function from the list and press TAB to select it. Within functions (parentheses) press TAB to
see function options. Within quote marks, press TAB to complete file paths.
To execute code, highlight/select it and click the Run button or press Cntr+Enter. Pressing
Cntrl+Shift+Enter will run the entire script.
To save the script, press the Save icon or select File > Save from the menu bar. Select a
name and location from the dialog box that opens. By convention, script files end with a.R
extension. The name of the script file will appear in the window tab in a red starred format if
the current version has not been saved.

CONSOLE WINDOW

Code runs in the Console window (Figure 1.5 B). This is basically the same console you would
see if you were using the basic R interface. You can submit code from a script window with a
Run command, or enter interactive commands directly in this window at the command prompt
(>).
If the command prompt changes to a plus (+) sign, the interpreter is waiting for a
complete statement. This will often happen if the statement is too long for one line or if there
are mismatched parentheses in the code. You can get back to the command prompt by
pressing ESC.
Additionally, pressing the UP and DOWN arrow keys will cycle through past commands. You
can edit a command and resubmit it with the ENTER key. Clicking on the broom icon clears
text from the window.

©Manning Publications Co. To comment go to liveBook


12

Figure 1.6 Script window

ENVIRONMENT AND HISTORY WINDOWS

Any objects that were created (age and weight in this example) will appear in the
Environment window (see figure 1.5 C). A record of executed commands will be saved in the
History window (the tab the right of Environment).

PLOT WINDOW

Any plots that are created from the script will appear in the plot window(Figure 1.5 D). The
toolbar for this window allows you to cycle through the graphs that have been created. In
addition, you can open a zoom window to see the graph at different sizes, export the graphs in
several formats, and delete one or all the graphs created so far.

1.3.3 Getting help


R provides extensive help facilities, and learning to navigate them will help you significantly in
your programming efforts. The built-in help system provides details, references, and examples
of any function contained in a currently installed package. You can obtain help by executing
any of functions listed in table 1.2.
Help is also available through the RStudio interface. In the Script window, place the cursor
on a function name and press F1 to bring up the help window.

©Manning Publications Co. To comment go to liveBook


13

Table 1.2 R help functions

Function Action

help.start() General help

help("foo") or ?foo Help on function foo

help(package ="foo") Help on a package named foo

help.search("foo") or ??foo Searches the help system for instances of the string foo

example("foo") Examples of function foo (quotation marks optional)

data() Lists all available example datasets contained in currently loaded packages

vignette() Lists all available vignettes for currently installed packages

vignette("foo") Displays specific vignettes for topic foo

help.start() General help

The function help.start() opens a browser window with access to introductory and advanced
manuals, FAQs, and reference materials. Alternatively, choose Help > R Help form the menu.
The vignettes returned by the vignette() function are practical introductory articles provided
in PDF or HTML format. Not all packages have vignettes.
All help files have a similar format (see figure 1.7). The help page has a title and brief
description, followed by the function's syntax and options. Computational details are provided
in the Details section. The See Also section describes and links to related functions. The help
page almost always ends with examples illustrating typical uses of the function.

©Manning Publications Co. To comment go to liveBook


14

Figure 1.7 Help window

As you can see, R provides extensive help facilities, and learning to navigate them will
definitely aid your programming efforts. It’s a rare session that I don’t use ? to look up the
features (such as options or return values) of some function.

©Manning Publications Co. To comment go to liveBook


15

1.3.4 The workspace


The workspace is your current R working environment and includes any user-defined objects
(vectors, matrices, functions, data frames, and lists). The current working directory is the
directory from which R will read files and to which it will save results by default. You can find
out what the current working directory is by using the getwd() function. You can set the
current working directory by using the setwd() function. If you need to input a file that isn’t in
the current working directory, use the full pathname in the call. Always enclose the names of
files and directories from the operating system in quotation marks. Some standard commands
for managing your workspace are listed in table 1.3.

Table 1.3 Functions for managing the R workspace

Function Action

getwd() Lists the current working directory.

setwd("mydirectory") Changes the current working directory to mydirectory.

ls() Lists the objects in the current workspace.

rm(objectlist) Removes (deletes) one or more objects.

help(options) Provides information about available options.

options() Lets you view or set current options.

save.image("myfile") Saves the workspace to myfile (default = .RData).

save(objectlist, file="myfile") Saves specific objects to a file.

load("myfile") Loads a workspace into the current session.

To see these commands in action, look at the following listing.

Listing 1.2 An example of commands used to manage the R workspace


setwd("C:/myprojects/project1")
options()
options(digits=3)

First, the current working directory is set to C:/myprojects/project1. The current option
settings are then displayed, and numbers are formatted to print with three digits after the
decimal place.
Note the forward slashes in the pathname of the setwd() command. R treats the backslash
(\) as an escape character. Even when you’re using R on a Windows platform, use forward
slashes in pathnames. Also note that the setwd() function won’t create a directory that
doesn’t exist. If necessary, you can use the dir.create() function to create a directory and
then use setwd() to change to its location.

©Manning Publications Co. To comment go to liveBook


16

1.3.5 Projects
It’s a good idea to keep your projects in separate directories. RStudio provides a simple
mechanism for this. Choose File > New Project … and specify either New Directory to start
a project in a brand new working directory, or Existing Directory to associate a project with
an existing working directory. All your program files, command history, report output, graphs
and data will be saved in the project directory. You can easily switch between projects using
the Project dropdown menu in the upper right portion of the RStudio application.
It is easy to become overwhelmed with project files. I recommend creating several
subfolders within the main project folder. I usually create a data folder to contain raw data
files, an img folder for image files and graphical output, a docs folder for project
documentation, and a reports folder for reports. I keep the R scripts and a README file in the
main directory. If there is an order to the R scripts I number them (e.g., 01_import_data.R,
02_clean_data.R, etc.). The README is a text file containing information such as author, date,
stakeholders and their contact information, and the purpose of the project. Six months from
now, this will remind me what I did and why I did it.

1.4 Packages
R comes with extensive capabilities right out of the box. But some of its most exciting features
are available as optional modules that you can download and install. There are more than
10,000 user-contributed modules called packages that you can download from http://cran.r-
project.org/web/packages. They provide a tremendous range of new capabilities, from the
analysis of geospatial data to protein mass spectra processing to the analysis of psychological
tests! You’ll use many of these optional packages in this book.
One set of packages, collectively called the tidyverse, deserves particular attention. This is
a relatively new collection of packages that offers a streamlined, consistent, and intuitive
approach to data manipulation and analysis. The advantages offered by tidyverse packages
(with names like tidyr, dplyr, lubridate, stringr and ggplot2) is changing the way data
scientists write code in R, and we will be employing these packages often. In fact, the
opportunity to describe how to use these packages for data analysis and visualization was a
major motivation for writing a third edition of this book!

1.4.1 What are packages?


Packages are collections of R functions, data, and compiled code in a well-defined format. The
directory where packages are stored on your computer is called the library. The function
.libPaths() shows you where your library is located, and the function library() shows you
what packages you’ve saved in your library.
R comes with a standard set of packages (including base, datasets, utils, gr-Devices,
graphics, stats, and methods). They provide a wide range of functions and datasets that are
available by default. Other packages are available for download and installation. Once

©Manning Publications Co. To comment go to liveBook


17

installed, they must be loaded into the session in order to be used. The command search()
tells you which packages are loaded and ready to use.

1.4.2 Installing a package


A number of R functions let you manipulate packages. To install a package for the first time,
use the install.packages() command. For example, the gclus package contains functions
for creating enhanced scatter plots. You can download and install the package with the
command install.packages("gclus").
You only need to install a package once. But like any software, packages are often updated
by their authors. Use the command update.packages() to update any packages that you’ve
installed. To see details on your packages, you can use the installed.packages() command.
It lists the packages you have, along with their version numbers, dependencies, and other
information.
You can also install and update packages using the RStudio interface. Select the Packages
tab (from the window on the lower right). Enter the name (or partial name) in the search box
in the upper right of that tabbed window. Place a check mark next to the package(s) you want
to install and click the install button. Alternatively, click the update button to update a
package already installed.

1.4.3 Loading a package


Installing a package downloads it from a CRAN mirror site and places it in your library. To use
it in an R session, you need to load the package using the library() command. For example,
to use the package gclus, issue the command library(gclus).
Of course, you must have installed a package before you can load it. You’ll only have to
load the package once in a given session. If desired, you can customize your startup
environment to automatically load the packages you use most often. Customizing your startup
is covered in appendix B.

1.4.4 Learning about a package


When you load a package, a new set of functions and datasets becomes available. Small
illustrative datasets are provided along with sample code, allowing you to try out the new
functionalities. The help system contains a description of each function (along with examples)
and information about each dataset included. Entering help(package="package_name")
provides a brief description of the package and an index of the functions and datasets
included. Using help() with any of these function or dataset names provides further details.
The same information can be downloaded as a PDF manual from CRAN. To get help on a
package using the RStudio interace, click on the Packages tab (lower right window), enter the
name of the package in the search window, and click on the name of the package.

©Manning Publications Co. To comment go to liveBook


18

Common mistakes in R programming


Some common mistakes are made frequently by both beginning and experienced R programmers. If your program
generates an error, be sure to check for the following:

• Using the wrong case—help(), Help(), and HELP() are three different functions (only the first will work).
• Forgetting to use quotation marks when they’re needed—install.packages-("gclus") works, whereas
install.packages(gclus) generates an error.
• Forgetting to include the parentheses in a function call—For example, help() works, but help doesn’t. Even if
there are no options, you still need the ().
• Using the \ in a pathname on Windows—R sees the backslash character as an escape character.
setwd("c:\mydata") generates an error. Use setwd("c:/mydata") or setwd("c:\\mydata") instead.
• Using a function from a package that’s not loaded—The function order.clusters() is contained in the gclus
package. If you try to use it before loading the package, you’ll get an error.

The error messages in R can be cryptic, but if you’re careful to follow these points, you should avoid seeing many of
them.

1.5 Using output as input: reusing results


One of the most useful design features of R is that the output of analyses can easily be saved
and used as input to additional analyses. Let’s walk through an example, using one of the
datasets that comes preinstalled with R. If you don’t understand the statistics involved, don’t
worry. We’re focusing on the general principle here.
R comes with many built in datasets that can be used to practice data analyses. One such
dataset, called mtcars, contains information 32 automobiles collected from Motor Trend
magazine road tests. Suppose we're interested in describing the relationship between a car's
fuel efficiency and weight.
First, we could run a simple linear regression predicting miles per gallon (mpg) from car
weight (wt). This is accomplished with the following function call:
lm(mpg~wt, data=mtcars)

The results are displayed on the screen, and no information is saved.


Alternatively, run the regression, but store the results in an object:
lmfit <- lm(mpg~wt, data=mtcars)

The assignment creates a list object called lmfit that contains extensive information from the
analysis (including the predicted values, residuals, regression coefficients, and more).
Although no output is sent to the screen, the results can be both displayed and manipulated
further.
Typing summary(lmfit) displays a summary of the results, and plot(lmfit) produces
diagnostic plots. The statement cook<-cooks.distance(lmfit) generates and stores

©Manning Publications Co. To comment go to liveBook


19

influence statistics, and plot(cook) graphs them. To predict miles per gallon from car weight
in a new set of data, you’d use predict(lmfit, mynewdata).
To see what a function returns, look at the Value section of the R help page for that
function. Here you’d look at help(lm) or ?lm. This tells you what’s saved when you assign
the results of that function to an object.

1.6 Working with large datasets


Programmers frequently ask me if R can handle large data problems. Typically, they work with
massive amounts of data gathered from web research, climatology, or genetics. Because R
holds objects in memory, you’re generally limited by the amount of RAM available. For
example, on my 3-year-old Windows PC with 8 GB of RAM, I can easily handle datasets with
10 million elements (100 variables by 100,000 observations). On an iMac with 16 GB of RAM, I
can usually handle 100 million elements without difficulty.
But there are two issues to consider: the size of the dataset and the statistical methods
that will be applied. R can handle data analysis problems in the gigabyte to terabyte range,
but specialized procedures are required. The management and analysis of very large datasets
is discussed in appendix F.

1.7 Working through an example


We’ll finish this chapter with an example that ties together many of these ideas. Here’s the
task:

1. Open the general help, and look at the “Introduction to R” section.


2. Install the vcd package (a package for visualizing categorical data that you’ll be using in
chapter 11).
3. List the functions and datasets available in this package.
4. Load the package, and read the description of the dataset Arthritis.
5. Print out the Arthritis dataset (entering the name of an object will list it).
6. Run the example that comes with the Arthritis dataset. Don’t worry if you don’t
understand the results; it basically shows that arthritis patients receiving treatment
improved much more than patients receiving a placebo.

©Manning Publications Co. To comment go to liveBook


20

Figure 1.8 RStudio window when executing the code in Listing 1.3.

The code required is provided in the following listing, with a sample of the results displayed in
figure 1.8. As this short exercise demonstrates, you can accomplish a great deal with a small
amount of code.

Listing 1.3 Working with a new package


help.start()
install.packages("vcd")
help(package="vcd")
library(vcd)

©Manning Publications Co. To comment go to liveBook


21

help(Arthritis)
Arthritis
example(Arthritis)

1.8 Summary
• R provides a comprehensive, highly interactive environment for analyzing and
visualizing data.
• RStudio is an integrated development environment that makes programming in R
easier and more productive.
• Packages are freely available add-on modules that greatly extend the power of the R
platform.
• R has an extensive help system and learning to use it will greatly facilitate your ability
to program effectively.

In this chapter, we looked at some of the strengths that make R an attractive option for
students, researchers, statisticians, and data analysts trying to understand the meaning of
their data. We walked through the program’s installation and talked about how to enhance R’s
capabilities by downloading additional packages. We explored the basic interface and produced
a few simple graphs. Because R can be a complex program, we spent some time looking at
how to access the extensive help that’s available. Hopefully you’re getting a sense of how
powerful this freely available software can be.
Now that you have R and RStudio up and running, it’s time to get your data into the mix.
In the next chapter, we’ll look at the types of data R can handle and how to import them into
R from text files, other programs, and database management systems.

©Manning Publications Co. To comment go to liveBook


22

2
Creating a dataset

This chapter covers

• Exploring R data structures


• Using data entry
• Importing data
• Annotating datasets

The first step in any data analysis is the creation of a dataset containing the information to be
studied, in a format that meets your needs. In R, this task involves the following:

• Selecting a data structure to hold your data


• Entering or importing your data into the data structure

The first part of this chapter (sections 2.1–2.2) describes the wealth of structures that R can
use to hold data. In particular, section 2.2 describes vectors, factors, matrices, data frames,
and lists. Familiarizing yourself with these structures (and the notation used to access
elements within them) will help you tremendously in understanding how R works. You might
want to take your time working through this section.
The second part of this chapter (section 2.3) covers the many methods available for
importing data into R. Data can be entered manually or imported from an external source.
These data sources can include text files, spreadsheets, statistical packages, and database-
management systems. For example, the data that I work with typically comes as comma
delimited text files or EXCEL spreadsheets. On occasion, though, I receive data as SAS and
SPSS datasets or through connections to SQL databases. It’s likely that you’ll only have to use
one or two of the methods described in this section, so feel free to choose those that fit your
situation.

©Manning Publications Co. To comment go to liveBook


23

Once a dataset is created, you’ll typically annotate it, adding descriptive labels for
variables and variable codes. The third portion of this chapter (section 2.4) looks at annotating
datasets and reviews some useful functions for working with datasets (section 2.5). Let’s start
with the basics.

2.1 Understanding datasets


A dataset is usually a rectangular array of data with rows representing observations and
columns representing variables. Table 2.1 provides an example of a hypothetical patient
dataset.

Table 2.1 A patient dataset

PatientID AdmDate Age Diabetes Status

1 10/15/2018 25 Type1 Poor

2 11/01/2018 34 Type2 Improved

3 10/21/2018 28 Type1 Excellent

4 10/28/2018 52 Type1 Poor

Different traditions have different names for the rows and columns of a dataset. Statisticians
refer to them as observations and variables, database analysts call them records and fields,
and those from the data-mining and machine-learning disciplines call them examples and
attributes. We’ll use the terms observations and variables throughout this book.
You can distinguish between the structure of the dataset (in this case, a rectangular array)
and the contents or data types included. In the dataset shown in table 2.1, PatientID is a row
or case identifier, AdmDate is a date variable, Age is a continuous (quantitative) variable,
Diabetes is a nominal variable, and Status is an ordinal variable. Both nominal and ordinal
variables are categorical, but the categories in an ordinal variable have a natural ordering.
R contains a wide variety of structures for holding data, including scalars, vectors, arrays,
data frames, and lists. Table 2.1 corresponds to a data frame in R. This diversity of structures
provides the R language with a great deal of flexibility in dealing with data.
The data types that R can handle include numeric, character, logical (TRUE/FALSE),
complex (imaginary numbers), and raw (bytes). In R, PatientID, AdmDate, and Age are
numeric variables, whereas Diabetes and Status are character variables. Additionally, you
need to tell R that PatientID is a case identifier, that AdmDate contains dates, and that
Diabetes and Status are nominal and ordinal variables, respectively. R refers to case
identifiers as rownames and categorical variables (nominal, ordinal) as factors. We’ll cover
each of these in the next section. You’ll learn about dates in chapter 3.

©Manning Publications Co. To comment go to liveBook


24

2.2 Data structures


R has a wide variety of objects for holding data, including scalars, vectors, matrices, arrays,
data frames, and lists. They differ in terms of the type of data they can hold, how they’re
created, their structural complexity, and the notation used to identify and access individual
elements. Figure 2.1 shows a diagram of these data structures. Let’s look at each structure in
turn, starting with vectors.

Figure 2.1 R data structures

Some definitions
Several terms are idiosyncratic to R and thus confusing to new users.
In R, an object is anything that can be assigned to a variable. This includes constants, data structures, functions, and
even graphs. An object has a mode (which describes how the object is stored) and a class (which tells generic functions
like print how to handle it).
A data frame is a structure in R that holds data and is similar to the datasets found in standard statistical packages
(for example, SAS, SPSS, and Stata). The columns are variables, and the rows are observations. You can have variables
of different types (for example, numeric or character) in the same data frame. Data frames are the main structures you
use to store datasets.
Factors are nominal or ordinal variables. They’re stored and treated specially in R. You’ll learn about factors in
section 2.2.5.
Most other terms used in R should be familiar to you and follow the terminology used in statistics and computing in
general.

©Manning Publications Co. To comment go to liveBook


Discovering Diverse Content Through
Random Scribd Documents
impossible to calculate. This would require that such women should
marry, which is what the lady whose views are referred to above,
desired to avoid. In fact it is typical women who will marry, and
typical women will be therefore produced to the end of time, unless
some new system of sex relations shall be introduced.

It is sometimes suggested that a change in intersex relations is


desirable in order to effect a fuller emancipation of women from
present conditions. With the remark in passing, that the natural
restraints imposed by the present marriage system on woman are
not greater than those imposed on man, although different, we may
refer to the alternative arrangement which has been sometimes
adopted. This is that woman should be free from all obligation to
fidelity to any particular man, and that man should be free from the
obligation to support any particular woman. In other words it is
sometimes proposed that we return to the primitive state of human
society. Such a system has descended to us from ancient times, and
it only needs to be mentioned to satisfy us that woman is the loser
by it to a degree that is disastrous to the interests of society in every
respect. It is only a being devoid of the developed traits of
womanhood who could succeed in a polyandrous career, since she
must renounce the pleasures of family life, even if she is
exceptionally able to accumulate the means of support for her self
and children in later years.

A second alternative, that woman may secure the support of one


man, while her marital relations are polyandrous, is an impossible
dream of the imagination. This could be only possible under the
condition that the child-bearing sex should be the stronger sex, and
fully capable of self-support and self-protection; a condition which is
not found in mankind.
A third alternative is the communistic relation where the state
supports women and children, without inquiry as to parentage, and
without reference to the monogamic or promiscuous relation of the
sexes. Such a system, could it continue long enough, would result in
the breaking up of the sentiment of conjugal affection which now
characterises our race, and the destruction of marital fidelity. The
question is whether or not this system would be preferable to that of
monogamic marriage above described. As it is a proposition for the
amelioration of the present condition of women, the decision should
rest with them. The women of the white race would probably
declare against it by a very large majority, were a vote to be taken.
This vote would be, however, largely influenced by custom, and not
by a deliberate conclusion derived from experience. Since experience
of such system cannot be had at present, we are compelled to rely
on such knowledge as we possess in the premises.

It may be safely assumed that the monogamic tendency is


constitutional with the majority of women. In spite of curiosity and
other inducements, the idea of love for a single person is deeply
ingrained in her nature. It is an ideal to be realised somehow and at
some time, and anything short of it is a disaster only to be endured
through some irresistible necessity. No normal woman would hazard
the risks to person and property involved in indefinite matrimonial
relations. The idea of the family becomes the more fixed in
proportion as it is realised in actual experience. In spite of pessimists
and unfortunates, the mutual love of man and woman is a sentiment
deeply seated in the nature of both. Its strength is attested by the
enormous popularity of the literature of which it forms the theme,
and of the drama where its history and vicissitudes are depicted.
Men and women who underrate its power, or who attempt to resist
its effects, are like dead leaves before the winds. Would men and
women be satisfied with a system which should place these
affections in constant suspense, and which should afford no
safeguard for the protection of inexperience, or defense against the
temporary effects of superficial attractions and repulsions? I suspect
not, for more would be lost than gained by such possibilities. Relief
from unfortunate connections is certainly proper, but this can be had
in such a way as to render it certain that the best interests of both
parties are subserved, by a system of time contracts of marriage,
such as I crudely suggested in The Open Court for November 1888.
But the emotions of sex cannot be safely left without safeguards
derived from the experience of mankind. This is not only on account
of the force of these passions themselves, but because of the
material necessities which are so intimately involved with them. The
element of paternal interest will have to be eliminated from the man,
and of conjugal fidelity from the woman before a communal system
can be possible. And the absence of these traits is only characteristic
of some of the lower races of men at the present time. Evolution has
not weakened, but has greatly strengthened them, and it is not likely
that our race will go backward in this respect.

Of course it may be asserted that this evolution has taken the


wrong direction, and is not an improvement. I think the contrary
may be shown to be true. The paternal instinct is as important to the
adolescent stages of man as the maternal is for the period of
infancy. Paternity stimulates the man to labor for the support and
education of his children, and for their general well-being. Without
such support many would die, reach an imperfect development, or
become feeble members of society. The fidelity of the woman
develops the same trait in man, and it stimulates him to the greatest
exertions to secure her well-being also. Such forces as these cannot
be withdrawn from society without infinite loss. It is the knowledge
that this is my wife and that these are my children, that sustains
more than half of human industry. With a communistic system these
inducements would be withdrawn, and mankind would sink into
comparative apathy, were it possible for the system to endure long
enough.

It is evident that monogamic and polygamic systems are the only


ones possible to modern society. The polygamic requires little notice
because the general equality in numbers of the sexes deprives it of
foundation. It is only possible where women are in excess, and
where they are willing to sustain it. No man who is successfully
married is likely to incur the additional obligations which it imposes.
It may be therefore dismissed from notice with the further remark
that it is not on the other hand deserving of the obloquy cast upon it
by certain persons who are evidently "compounding for sins they
have a mind to by damning those they're not inclined to."

The monogamic relation having been defined in the preceding


paragraphs I recur to some of its obligations. I have spoken of the
infidelity of woman as of a higher degree of criminality than that of
man, and have shown the basis of justice on which this general
sentiment rests. But it must not be forgotten that while he who hires
a murderer, and he who receives stolen goods does not commit the
actual crime, he is highly culpable, and shares in the condemnation
which should follow it. In the case of the marital infidelity of the
woman, he may be the greater criminal of the two, as the instigator
to a deed which would not have been otherwise even suggested. In
any case his folly is extraordinary, as he takes his life in his hands,
and risks that of his partner; for men are wont to preserve their
family rights by summary process. It would be incredible that such
risks should be taken were it not that history and contemporary
literature offer many examples. The few cases where palliating
circumstances could be claimed would chiefly occur in countries
where divorce laws do not exist.

The advantages to woman, arising from the monogamic relation,


are then, support and protection, and undivided affection if she
deserve it, together with the satisfaction of the conjugal and
maternal instincts. In order to secure these advantages she must
pursue a course towards her husband in some degree comparable to
that by which her husband secures the confidence and esteem of his
fellow man. Faithfulness in adhering to contracts, and personal
complaisance cover much of the ground. As regards the man, he
must see to it, that he does nothing that tends to the disintegration
of the family relations of other men. The ill disguised laudation of
the infidelity of wives which is so prominent in French literature, is a
mark of a low civilisation, and it rightly excites the disgust of all men
who have any respect for their own rights. It looks as though certain
French literature had been written by boys. Men who are responsible
for such invasion of the rights of others, cannot expect better
treatment themselves, and they must not be surprised if they are
repaid in their own coin. While the preservation of the rights of the
marriage contract lies primarily with woman, for natural reasons;
man is held by his fellow man to a strict accountability, and he
attempts any invasion of them at his personal peril.

The principles above laid down are those out of which have grown
our laws on the subject. Some women and men appear to think
them unjust to women. It is true that in some respects, woman is at
a disadvantage. This disadvantage is, however, of natural origin and
cannot be overcome. On the other hand, she has a full equivalent in
the advantages which she also derives from the natural order of
things. The result is that there is no real cause of complaint, unless
it be that sometimes the gallantry of men towards women whom
they do not know, leads them to do injustice to man in cases of
dispute. And here is an advantage to women which is an offset to
the injustice which they sometimes experience from the same
source. The correction of these faults is a part of the process of
ethical development which is going on in human society. And
perhaps the most effective agency in this development is the relation
of the members of the family to each other, where affection takes
the place of force, since it is the source of our deepest pleasures and
our severest pains.

E. D. COPE.
THE ANALYSIS OF THE
SENSATIONS.

ANTIMETAPHYSICAL.

I.

The great results that physical research in the last centuries has
achieved, not only in its own domain, but also, by the assistance it
has afforded, in the domain of other sciences, have brought it about
that physical ways of thinking and physical methods of procedure
have everywhere attained to especial prominence, and that the
greatest expectations are associated with their employment. In
conformity with this drift of modern research the physiology of the
senses, gradually leaving the paths that had been entered upon by
men like Goethe, Schopenhauer, and others, but especially with the
greatest success by Johannes Müller, has also almost exclusively
assumed a physical character. This tendency must appear to us as
not exactly the proper and the desirable one, when we reflect that
physics despite its considerable development nevertheless
constitutes but a portion of a greater collective body of knowledge,
and that it is incompetent with its limited intellectual methods,
created for especial and limited purposes, to exhaust the entire
material of the province now under consideration. However, without
renouncing the support of the science of physics, it is possible for
the physiology of the senses not only to continue its own special
development, but also to afford physical science itself valuable
assistance. The following simple considerations will serve to illustrate
this relation.

II.

Colors, sounds, temperatures, pressures, spaces, times, and the like,


are united with one another in the most manifold ways; and to these
are joined moods of mind, feelings, and wills. Out of this
complication, that which is relatively the more fixed and the more
permanent stands prominently forth, engraves itself in the memory,
and expresses itself in language. As relatively more permanent
appear, first, complexes of colors, sounds, pressures, and so forth,
that are connected in time and space, that therefore receive special
names, and are designated as bodies. Such complexes are by no
means absolutely permanent.

My table is now brightly and now darkly lighted. It may be warmer


or colder. It may receive an ink stain. One of its legs may get
broken. It can be repaired, polished, and replaced part for part. But
for me, amid all, it remains the table at which I daily write.

My friend can put on a different coat. His countenance can


assume a serious or joyful expression. The complexion of his face,
under the effects of light or of emotion, can change. His shape can
be altered by a movement, or can be permanently transformed. But
the sum total of the permanent, as compared with gradual
alterations of this kind, always remains so great, that the latter
vanish. It is the same friend with whom I take my daily walk.

My coat can receive a stain, a tear. The very manner of my


expression indicates that the gist of the thing is a quantity of
permanency, to which the new element is added and from which
that which is lacking is subsequently deducted.

Our greater intimacy with this quantity of permanency, and its


preponderance as contrasted with the changeable, impel us to the
partly instinctive, partly voluntary and conscious economy of mental
representation and designation which is expressed in ordinary
thought and speech. That which has been once perceptually
represented receives a single designation, a single name.

As relatively permanent, is exhibited, further, that complex of


memories, moods, and feelings, joined to a particular body (the
human body), which is denominated the "I" or "Ego." I can be
engaged with this subject or with that subject, I can be quiet or
animated, excited or ill-humoured. Yet—pathological cases not
considered—enough that is permanent remains to recognise the ego
as the same. Moreover, the ego also is only of relative permanency.

*****

The apparent permanency of the ego consists pre-eminently in the


fact of its continuity, and in its slow change. The many thoughts and
plans of yesterday that are continued to-day, and of which our
environment in waking hours continually reminds us (and therefore
in dreams the ego can be very indistinct, doubled, or entirely
wanting), and the little habits that are unconsciously and
involuntarily kept up for longer periods of time, constitute the
fundamental root of the ego. There can hardly be greater differences
in the ego of different people, than occur in the course of years in
one person. When I recall to-day my early youth, I should take the
boy that I then was, with the exception of a few single features, for
a different person, did not the chain of memories that make up my
personality now lie before me. Many a treatise that I myself wrote
twenty years ago, now makes upon me a very strange impression.
The very gradual character of the changes of the body also
contributes to the permanency of the ego, but in a much less degree
than people imagine. Such things are much less analysed and
noticed than the intellectual and the moral ego. Individually,
personally, people have a very poor knowledge of themselves.

Once, when a young man, I espied in the street a face in profile


that was very displeasing and repulsive to me. I was not a little
taken aback when a moment afterwards I found that it was my own,
which, in passing by a place where mirrors were sold, I had
perceived reflected from two mirrors that stood at the proper
inclination to each other.

Not long ago, after a trying railway journey by night, being much
fatigued, I got into an omnibus just as another gentleman appeared
at the other end. "What degenerated pedagogue is that, who has
just entered," thought I. It was myself: opposite me hung a large
mirror. My ordinary dress, accordingly, was more familiar to me than
my travelling attire.

The ego is as little absolutely permanent as bodies. That which we


so greatly fear in death, the annihilation of our permanency, actually
occurs in life in abundant measure. That which is most valued by us,
remains preserved in countless copies, or, in cases of exceptional
excellence, as a rule preserves itself. In the best human being,
however, there are individual traits the loss of which neither he
himself nor others need regret. Indeed, at times, death, viewed as
liberation from individuality, can even become a pleasant thought.

*****

After the first survey has been obtained, by the formation of the
concepts of substance, "body" "ego" (matter, soul), the will is
impelled to a more exact examination of the changes that take place
in this relatively permanent existence. The changeable element in
bodies and in the ego, indeed, is the very thing that moves the will.
Now, for the first time, do the constituent elements of the complex
stand forth as properties of the same. A fruit is sweet; but it can also
be bitter. So, too, other fruits can be sweet. The red color that is
sought is found in many bodies. The neighborhood of some bodies is
pleasant, that of others unpleasant. Thus, gradually, do different
complexes appear to be composed of common constituent elements.
The visible, the audible, the tangible, are separated from bodies. The
visible is broken up into color and into form. Out of the manifold
constitution of colors issue, again, in lesser numbers, certain other
constituent elements—the primary colors, and so forth. The
complexes are disintegrated into elements.

III.

The proper and useful habit of designating that which is permanent


by a single name, and of comprehending the same in a single
thought, without analysing at each operation its constituent parts, is
liable to come into singular conflict with the tendency to separate
these constituent parts. The obscure image formed of the
permanent, which does not perceptibly change when one or another
constituent part is taken away, appears to be something existent by
itself. Inasmuch as it is possible to take away singly every
constituent part without effecting the capacity of the image formed
to represent the totality involved, or effecting its subsequent
recognition, it is imagined that it is possible to take away all these
parts and yet have something remaining. Thus arises the monstrous
idea of a thing of itself, different from, and incognisable with relation
to, its "phenomenal" existence.

Thing, body, matter, are nothing apart from this complex of colors,
sounds, and so forth—apart from their so-called marks, or
characteristics. That Protean, illusory philosophical problem of a
single independent thing with many properties, arises from the
misunderstanding of the fact, that extensive comprehension and
accurate separation, although both are temporarily justifiable and
profitable for a number of purposes, can not and must not be
employed simultaneously. A body is single and unchangeable so long
as it is not required to take details into consideration. Thus both the
earth and a billiard ball are spheres so long as we disregard all minor
deviations from the spherical form, and greater exactitude is not
necessary. But if we are compelled to carry on investigations in
orography or microscopy both bodies cease to be spheres.

IV.

Man possesses in pre-eminence the power to determine arbitrarily


and consciously his point of view. He can at one time disregard the
most salient features, and immediately afterwards take into account
the smallest trifles; now regard a current of electricity as fixed,
without consideration of its contents, and now determine the width
of a Frauenhofer line in the solar spectrum; he can rise, at will, to
the most general abstractions, or bury himself in the minutest
particulars. The animal possesses this capacity in a much less
degree. It does not assume a point of view, but usually is brought to
it by impressions. The baby that does not recognise its father with
his hat on, the dog that is perplexed at the new coat of its master,
have succumbed in the conflict of points of view. Who has not been
thus worsted in similar cases? Even the man of philosophy at times
succumbs, as the fantastic problem above referred to, shows.

Indeed, do not certain circumstances actually appear to furnish a


justification of that problem? Colors, sounds, the odors of bodies are
evanescent. But the tangible part, as a sort of constant, durable
nucleus, not easily liable to annihilation, remains behind; appearing
as the vehicle of the more fugitive properties annexed to it. Habit
firmly affixes our thought to this central nucleus, even where the
knowledge has found its way, that seeing, hearing, smelling, and
touching are intimately akin in character. Added to this, also, comes
the fact, that in consequence of the singularly extensive
development of mechanical physics a kind of higher reality is
ascribed to Space and Time than to colors, sounds, and odors.
Agreeably to which, the junction in space and time of colors, sounds,
and odors appears more real than colors, sounds, and odors
themselves. The physiology of the senses, however, demonstrates,
that spaces and times can with as much justice be termed
sensations, as colors and sounds.

V.
Also the ego, as well as the relation of bodies to the ego, occasions
the rise of analogous seeming-problems, the character of which may
be briefly presented in the following manner.

The complexes of colors, sounds, and so forth, that are commonly


called bodies, we shall designate for the sake of simplicity by A B C
…; the complex that is known as our own body, and which
constitutes a part of the former, we shall call K L M …; the complex
composed of volitions, memory-images, and the like, we shall
represent by α β γ. Usually, now, the complex α β γ … K L M … is
opposed as ego, to the complex A B C … regarded as world of
substance; sometimes, too, α β γ … is comprehended as ego, and K
L M … A B C … comprehended as world of substance. Now A B C …
first appears as independent of the ego. But this independence is
only relative, and gives way before closer inspection. Much, it is true,
may change in the complex α β γ … without much becoming
noticeable in A B C …; and so vice versa. But many changes in α β γ
… pass, by way of changes in K L M …, over to A B C …; and vice
versa. (As, for example, when vivid ideas break forth into acts, or
our environment brings about perceptible changes in our body.) At
the same time K L M … appears to be more closely connected with α
β γ … and A B C … respectively, than the latter do with one another;
relations that find their commonest expression in thought and
speech.

Closely examined, however, it appears that A B C … is always


determined with and by K L M. A die, when seen close at hand,
looks large; when seen at a distance, small; it looks different with
the right eye from what it does with the left; sometimes it appears
double; with closed eyes it is invisible. The properties of the same
body, therefore, appear as modified by our own body; they appear
as conditioned by it. But where, pray, is this same body that
phenomenally appears so different? All that can be said is, that
different A B C … are annexed to different K L M.[18]

[18] I expressed this thought many years ago (in the


Vierteljahrsschrift für Psychiatrie, Leipsic and Neuwied, 1868:
Ueber die Abhängigkeit der Netzhautstellen von einander) as
follows: The expressions "sense-deception" and "illusion of the
senses" prove, that we are not yet fully conscious, or at least that
we have not yet found it necessary to incorporate this
consciousness into our ordinary terminology, that the senses
represent things neither wrongly nor correctly. All that can be
truly said of the sensory organs is, that, under different
circumstances they produce different sensations and perceptions.
Since these "circumstances" are of so extremely manifold a
character, being partly external (inherent in the objects), partly
internal (inherent in the sensory organs), and partly interior
(having the seat of their activity in the central organs), it would
naturally seem, especially when attention is paid only to external
circumstances, that an organ acts differently under like
conditions. And it is customary to call the unusual effects,
deceptions or illusions.

We see an object with a point S. If we touch S, that is bring it into


relation with our body, we receive a prick. We can see S, without
feeling the prick. But as soon as we feel the prick we find S. The
visible point therefore is a permanent fact or nucleus, to which the
prick is annexed, according to circumstances, as something
accidental. From the frequency of occurrences analogous to this we
ultimately accustom ourselves to regard all properties of bodies as
"effects" proceeding from permanent persistent nuclei and conveyed
to the ego through the mediation of the body; which effects we call
sensations. By this very operation, however, these imagined nuclei
lose their entire sensory content, and become mere mental symbols.
The assertion is correct then that the world consists only of our
sensations. In which case we have knowledge only of sensations,
and the assumption of the nuclei mentioned, as well as of a
reciprocal action between the same, from which sensations might be
supposed originally to proceed, turns out to be wholly idle and
superfluous. Such a view can only suit a halting realism or a half-
matured philosophic criticism.

VI.

Ordinarily the complex α β γ … K L M … is opposed as ego to the


complex A B C. Those elements only of A B C … that more actively
alter α β γ …, as a prick, a pain, are we accustomed to comprehend
in the ego. Afterwards, however, through observations of the kind
above mentioned, it appears that the right to annex A B C … to the
ego at no point ceases. In conformity to which the ego can be so
extended as ultimately to comprehend the entire world.

*****

When I say that the table, the tree, and so forth, are sensations of
mine, there is contained in this, as contrasted with the method of
representation of the ordinary man, an actual extension of my ego.
And so, too, upon the emotional side, such extensions actually
occur; as for the virtuoso, who possesses as perfect a mastery of his
instrument as he does of his own body; for the skilful orator in
whom the eyes of an audience converge, and who controls the
thoughts of his hearers; for the energetic politician who directs with
ease his party; and so on. In conditions of depression, on the other
hand, such as nervous people often have to endure, the ego
contracts and shrinks. A wall seems to separate it from the world.

*****

The ego is not sharply defined, its limits are very indefinite, and
arbitrarily displaceable. Only by mistaking this, and by unconsciously
narrowing these limits, as well also as by enlarging them, do
metaphysical difficulties, in the conflict of points of view, arise.

As soon as we have recognised that the supposed unities "body"


and "ego" are only make-shifts for a provisional survey and for
certain practical ends (that we may apprehend bodies, protect
ourselves from pain, and so forth), we are obliged, in many
thorough-going scientific investigations, to abandon them as
insufficient and inappropriate. The opposition between ego and
world, sensation (or phenomenon) and thing, then vanishes, and we
are brought to deal simply with the connection and relation of the
elements α β γ … A B C … K L M …, for which indeed this very
opposition was only a partially appropriate, imperfect expression.
This connection is nothing more than the combination of those
elements with other homologous elements (time and space). This
connection science has simply to accept, and set itself aright with
regard to it, without attempting to explain its existence.

Upon superficial examination the complex α β γ … appears to


consist of much more evanescent elements than A B C … and K L M
…, in which two last the elements appear to be joined with more
stability and in a more permanent manner (being joined to solid
nuclei as it were). Although upon closer inspection the elements of
all complexes appear as homologous, yet even in spite of the
recognition of this fact, the ancient notion of an opposition of body
and spirit easily creeps in. The spiritualist feels, at times, the
difficulty of imparting the necessary solidity to his world of substance
created by mind: the materialist is at a loss what to do when called
upon to animate and endow with sensation the world of matter. The
monistic point of view that reflection and reason have evolved, is
easily overcast by the older and more powerful instinctive notions.

VII.

The difficulty described is especially felt in the following


considerations. In the complex A B C … which we have designated
as the material world, we find as part, not only our own body K L M
…, but also the bodies of other persons (or animals) K' L' M' …, K" L"
M" …, annexed to which, after the analogy of the complex α β γ …,
we conceive similar α' β' γ' …, α" β" γ". As long as we deal with K' L'
M' …, we find ourselves in a thoroughly familiar province, at every
point sensorially accessible to us. But when we inquire after the
sensations or feelings that belong to the body K' L' M' …, we no
longer find in the province of sense the elements we seek: but we
add them in thought. Not only is the domain into which we now
enter much less familiar to us, but also the transition to it is
relatively unsafe. We are possessed of a feeling as if we were about
to plunge into an abyss. They that always pursue this direction of
thought and this direction only, will never get completely rid of the
feeling of insecurity that is very productive as a source of apparent
problems.

But we are not limited to this way of reasoning. Let us consider


first the reciprocal relation of the elements of the complex A B C …,
without regarding K L M … (our body). Every physical investigation is
of this kind. A white bullet falls upon a bell; a sound is heard. The
bullet turns yellow before a sodium lamp, red before a lithium lamp.
Here the elements (A B C …) appear to be connected only among
each other and to be independent of our body (K L M …). But if we
take santonine the bullet turns yellow again. If we turn one eye
sidewise we see two bullets. If we close our eyes entirely we see no
bullet at all. If we sever our auditory nerve no sound is heard. The
elements A B C …, therefore, are not only connected among each
other, but also with K L M. To this extent and to this extent only do
we call A B C … sensations, and regard A B C … as belonging to the
ego. In this way, accordingly, we do not meet with the gap between
bodies and sensations before described, between that which is
without and that which is within, between the material and the
spiritual world.[19] All elements A B C … K L M … constitute but one
single coherent mass, which when any one element in it is disturbed
all is put in motion; except that a disturbance has a more extensive
and profound action in K L M …, than in A B C. A magnet in our
neighborhood disturbs the particles of iron near it; a falling boulder
shakes the earth; but the severing of a nerve sets in motion the
entire system of elements. Quite involuntarily does this relation of
things suggest the picture of a viscous mass, at certain places (as in
the ego) more firmly coherent than at others.

[19] Compare my Grundlinien der Lehre von den


Bewegungsempfindungen. Leipsic, Engelmann, 1875, p. 54.

*****

When I first came to Vienna from the country, as a boy four or five
years of age, and was taken by my father upon the walls of the city's
fortifications, I was very much surprised to see people below in the
moat and could not understand how, regarded from my point of
view, they could have gotten down there; for the thought of another
possible way never occurred to me. I remarked the same
amazement, once afterwards in life, in the case of a three-year old
boy of mine, while taking a walk with him upon the walls about
Prague. I recall this feeling to mind every time I engage myself with
the reflection above referred to, and I frankly confess that this
accidental experience of mine greatly helped to strengthen the
opinion upon this point that I adopted a long time ago. The habit of
pursuing the same ways in material and psychical things operates to
confuse greatly our field of survey. A child forcing its way through a
wall in a house in which it has long dwelt, can experience an actual
enlargement of its view of the world, and a slight scientific hint can
bring much enlightenment.

VIII.

Accordingly, the great chasm between physical and psychological


research exists only for the common stereotyped method of
observation. A color is a physical object when, for example, we
regard its dependence upon its luminous source (upon other colors,
upon heat, upon space, and so forth). Regarding however its
dependence upon the retina (the elements K L M …), it becomes a
psychological object, a sensation. Not the subject-matter, but the
direction of our investigation is different in the two domains.

When, from the observation of the bodies of other men or


animals, we infer their sensations, as well also as when we
investigate the influence of our own body upon our own sensations,
we are forced to complete observed facts by analogy. This work of
completion by analogy is done with much more accuracy and facility,
when it relates, let us say, to nervous processes, which cannot be
fully observed in our own bodies—that is when it occurs in the more
familiar physical domain—than when the completion relates to
psychical processes. Otherwise there is no material difference.

IX.

The thoughts presented gain greatly in fixity and vividness if in


addition to simply expressing them in abstract form we bring
ourselves face to face with the facts from which they arise. For
example, I lie upon my sofa. If I close my right eye the picture
represented in the accompanying cut is presented to my left eye. In
a frame formed by the ridge of my eyebrow, by my nose, and by my
moustache, appears a part of my body, so far as it is visible, and
also the things and space about it. My body differs from other
human bodies—leaving out of account the fact that every vivid
motory idea immediately passes into movement and that contact
with it determines more perceptible changes than contact with other
bodies—by the circumstance, that it is only partly seen, and,
especially, is seen without a head. If I observe an element A within
my field of vision, and investigate its connection with another
element B within the same field, I go out of the domain of physics
into that of physiology or psychology, if B, to use the apposite
expression that a friend[20] of mine employed upon seeing this
drawing, passes through my skin. Reflections like that for the field of
vision may be made with regard to the province of touch and the
perceptual domains of the other senses.
[20] J. Popper of Vienna.

[Illustration]

X.

Reference has already been made to the different character of the


groups of elements that we have designated by A B C … and α β γ.
As a matter of reality, when we see a green tree before us, or
remember a green tree, that is conceive a green tree to ourselves,
we know right well how to distinguish these two cases. The imaged
tree has a much less determinate, a much more changeable form;
its green is much paler and more evanescent; and, what is of
especial note, it distinctly appears in a different sphere. A movement
that we propose to execute is always only a conceived movement,
and appears in a different field or sphere from that of the executed
movement, which moreover always takes place where the image
becomes vivid enough. The statement that the elements A or α
appear in a different sphere, means, if we go to the bottom of it,
nothing more than that they are united with divers other elements.
To this extent, accordingly, the basal component parts in A B C …, α
β γ … would be the same (colors, sounds, spaces, times, motory
sensations, innervations …), and only the character of their union
different.

Pain and pleasure are ordinarily regarded as different from


sensory sensations. Yet not only tactile sensations, but also all other
kinds of sensations, can gradually pass into pleasure and pain.
Pleasure and pain can also justly be called sensations. Only they are
not so well analysed and so familiar as sensory sensations.
Sensations of pleasure and pain, however faint the mode of their
appearance, make up indeed the real content of all so-called
feelings. Thus perceptions, as well as ideas, volition, and feelings, in
short the entire inner and outer world, are composed of a small
number of homologous elements united in relations now more
evanescent and now more lasting. These elements are commonly
called sensations. But since vestiges of a one-sided theory now
inhere in this term, we prefer to speak simply of elements, as we
have already done. All research aims at the resolution of the union
of these elements.[21]

[21] Compare the remarks appended to my treatise: Die


Geschichte und die Wurzel des Satzes der Erhaltung der Arbeit.
Prague. Calve. 1872.

XI.

That out of this complex of elements which at bottom is simply one,


the limits of bodies and the ego do not admit of being fixed in a
manner certain and sufficient for all cases, has already been said.
The composition of the elements, intimately connected with pleasure
and pain, into an ideal mental-economical unity, the ego, is a work
of the highest significance for the intellectual functions that act in
the service of the pain-avoiding, pleasure-seeking will. The formation
of the ego by this process of circumscription and delimitation is
therefore instinctively effected, it grows familiar and natural, and
fixes itself perhaps through heredity. By their high practical value,
not only for the individual, but also for the entire race, the
composites "ego" and "body" instinctively assert their existence, and
operate with the power of original elements. In special
circumstances, however, in which practical ends are not concerned,
but knowledge becomes an object in itself, this delimitation often
turns out to be insufficient, obstructive, and untenable.

Professional esprit de corps, and even professional bias, the


sentiment of nationality, the most narrow-minded local patriotism
may also have a high value, for certain purposes. But such
conceptions will not characterise the far-sighted investigator, at least
not in the moment of research. All these egoistic conceptions are
adequate for practical purposes only. Of course, even the
investigator can succumb to custom. Trifling scholastic fiddle-faddle,
the cunning appropriation of others' labor and perfidious silence with
regard to it, the numerous objections and complaints when
unavoidably compelled to give recognition, and the scanty
illumination of others' performances on such occasions, abundantly
show that the scientist and scholar have also to fight the battle of
existence, that the ways of science yet lead to the mouth, and that
the pure quest of knowledge amid our present social relations is still
an ideal.

*****

The primary fact is not the I, the ego, but the elements
(sensations). The elements constitute the I. I perceive the sensation
green, means, that the element green occurs in a given complex of
other elements (sensations, memories). When I cease to perceive
the sensation green, when I die, then the elements no longer occur
in their customary, common way of association. That is all. Only an
ideal mental-economical unity, not a real unity, has ceased to exist.

*****
The ego is not an unchangeable, definite, sharply-defined unity.
The important factor is not unchangeability, not determinate
distinguishability from other things, and not accurate limitation, for
all these factors even vary within the sphere of individual life itself,
and their alteration is even sought by the individual. Continuity alone
is important. This view admirably accords with that to which
Weismann recently attained by biological investigations ("Regarding
the Immortality of Unicellular Beings," Biolog. Centralbl., Vol. IV,
Nos. 21, 22; compare especially pp. 654 and 655, where the division
of the individual into two equal halves is spoken of). But this
continuity is only a means to dispose and to assure the content of
the ego. This content and not the ego is the principal thing. But this
content is not confined to the individual. With the exception of
insignificant, valueless, personal memories or reminiscences, it
remains preserved in others even after the death of the individual.
The ego is unsavable. It is partly the discernment of this fact, partly
the fear of the same, that leads to the most extravagant pessimistic
and optimistic, religious and philosophical absurdities. We shall not
be able in the long run to close our eyes to this simple truth, the
immediate result of psychological analysis. We shall then no longer
place so high a value upon the ego which even during individual life
greatly changes, and which, indeed, in sleep or during absorption in
some conception or in some thought, just in our happiest moments,
may be partially or wholly absent. We shall then gladly renounce
individual immortality, and shall not place more value upon the
accessory elements than upon the principal. We shall in this way
arrive at a freer and a more enlightened conception of life, which will
exclude the neglect of other egos and the over-estimation of our
own.

*****
If, now, the knowledge of the connection of the elements
(sensations) does not suffice us, and we must ask Who, What,
possesses this connection of sensations, Who, What, perceives
sensations? we have succumbed, we may be sure, to our old habit
of arranging every element (every sensation) within some
unanalysed complex, and we are falling back imperceptibly to an
older, lower, and more limited point of view.

*****

The habit of treating the unanalysed ego-complex as an indivisible


unity is often scientifically presented in peculiar ways. First, the
nervous system is separated from the body as the seat of
sensations. In the nervous system again the brain is selected as
fitted for the performance of this function, and finally, to save the
pretended psychical unity, a further point is sought in the brain as
the seat of the soul. But rough conceptions like these are hardly
adapted to trace out even in the crudest lines the ways that future
research will follow in investigating the connection of the physical
and the psychical. The fact that the different organs of sensation
and memory are physically connected with one another, and can be
easily excited by one another is probably the foundation of the
"psychical unity."

I once heard the question seriously discussed of "How the percept


of a very large tree found room in the little head of a man?" Now
though this "problem" does not exist, yet we perceive by the
question the absurdity that is so easily committed in conceiving
sensations to exist spacially in the brain. When I speak of the
sensations of another person, these sensations of course present no
activity in my optical space or my physical space generally; they are
mentally added, and I conceive them to be causally annexed, not
spacially, to the brain observed or represented. When I speak of my
sensations, these sensations do not exist spacially in my head, but
rather my "head" shares with them the same spacial field, as was
explained above (compare what was said regarding the cut).

*****

Let there be no mention of the so-called unity of consciousness.


Since the apparent opposition of the real and the perceived world
exists only in the mode according to which it is viewed, and no real
chasm exists, a multiplex interconnected content of consciousness is
in no respect more difficult to understand than the multiplex
interconnection of the world.

If we are determined to regard the ego as an actual unity, we


cannot extricate ourselves from the following dilemma: either to set
over against it—viz., the ego—the world of incognisable substances
(which would be wholly idle and purposeless), or to regard the
whole world, the egos of other people included, as only contained in
our own ego (to which, seriously, we could hardly make up our
minds).

But if we take the ego merely as a practical unity, composed for


purposes of provisional survey; in fact, take it as a more strongly
coherent group of elements, which is less strongly connected with
other groups of this kind; questions like these will not arise and
research will have a free outlook.

In his philosophical notes Lichtenberg says: "We become


conscious of certain ideas that are not dependent upon us; and
there are other ideas that, at least as we think, are dependent upon
us. Where is the border-line? We know only the existence of our
sensations, percepts, and thoughts. We should say, It thinks, just as
we say, It lightens. It is going too far to say cogito, when we
translate it by I think. Assuming the I, postulating it, is merely
practical necessity." Though the method by which Lichtenberg
arrives at this result is somewhat different from our own, we must
nevertheless give our assent to the conclusion itself.

XII.

Bodies do not produce sensations, but complexes of sensations


(complexes of elements) form bodies. If bodies appear to the
physicist as that which is permanent, that which is real, and
sensations as their evanescent transitory semblance, the physicist
forgets that all bodies are but thought-symbols for complexes of
sensation (complexes of elements). The elements designated also
form here the real, immediate, and ultimate foundation which
physiological research has now further to investigate. Through the
discernment of this, many things in psychology and physics assume
more distinct and economical forms, and many imagined problems
are disposed of.

The world therefore does not consist for us of mysterious


substances, which through their interaction with another equally
mysterious substance, the ego, produce sensations as solely
accessible. Colors, sounds, spaces, times, … are for us the ultimate
elements, whose given connection it is our task to investigate. In
this investigation we dare not allow ourselves to be hindered by the
composites and circumscriptions (body, ego, matter, mind …) that
have been formed for especial, practical, provisional, and limited
purposes. On the contrary, the appropriate and best adapted forms
of thought must arise within research itself, as happens in every
special science. In the place of the traditional instinctive conception
must come a freer, fresher view, conforming with developed
experience.

*****

I have always felt it as a special good fortune, that early in my life,


at about the age of 15, I came across in the library of my father
Kant's "Prolegomena to Any Future Metaphysic." The book made at
that time a powerful, ineffaceable impression upon me, that I never
afterwards experienced to the same degree in any of my
philosophical reading. Some two or three years later I suddenly
discovered the superfluous rôle that "the thing in itself" plays. On a
bright summer day under the open heavens the world together with
my ego all at once appeared to me as one coherent mass of
sensations, but in the ego more strongly coherent. Although the
actual working out of this thought did not occur until a later time,
yet this moment became decisive for my whole view.

Moreover I had still to struggle long and hard before I was able to
retain, in my own special department, the conception I had
acquired. With what is valuable in physical doctrines we necessarily
absorb a good dose of false metaphysics, which it is very difficult to
separate from that which must be preserved, especially where these
doctrines have become current and familiar. So, too, the traditional,
instinctive conceptions often arose with great power and placed
impediments in my way. Only by alternate studies in physics and the
physiology of the senses and by historico-physical investigations,
since about 1863, after having endeavored in vain to settle the
conflict by a physico-psychological monadology, did I acquire in my
views any considerable firmness. I make no pretensions to the title
of philosopher. I only wish to adopt in physics a point of view that
need not be instantly changed the moment our glance is carried into
the domain of another science; since indeed, ultimately, all must
form one whole. The molecular physics of to-day does certainly not
meet this demand. What I say I have probably not been the first to
say. I also do not wish to hold forth this exposition of mine as a
special performance. It is rather my belief that every one will
collaterally adopt the same view, who in a reflective manner holds
survey in any province of science that is not too limited.[22]

[22] I have recently (1886) propounded these views in a


pamphlet Beiträge zur Analyse der Empfindungen. Avenarius, with
whom I recently became acquainted, approaches my point of
view (Philosophie als Denken der Welt nach dem Princip des
kleinsten Kraftmasses, 1876). Hering, too, in his treatise upon
Memory (Almanach der Wiener Akademie, 1870, p. 258; also
published in Nos. 6 and 7 of The Open Court), and J. Popper in
his beautiful book, "The Right to Live and the Duty to Die"
(Leipsic 1878, p. 62), have advanced similar thoughts. Compare
also my paper Ueber die ökonomische Natur der physikalischen
Forschung (Almanach der Wiener Akademie, 1882, p. 179, note).
Finally let me also refer here to the introduction to W. Preyer's
Reine Empfindungslehre, and to Riehl's Freiburger Antrittsrede, p.
14. I should probably have to cite much additional matter that is
in some way related to my line of thought if I possessed a more
extensive bibliographical knowledge.

XIII.
Science always arises through a process of adaptation of thoughts to
a certain department of experience. The results of this process are
thought-elements, which represent the entire department. The
result, of course, is different according to the character and extent of
the province surveyed. If the province of experience in question is
extended, or if several provinces hitherto separated become united,
the traditional, familiar thought-elements no longer suffice for the
province thus extended. In the struggle of acquired habit with the
effort after adaptation, problems arise, which disappear when the
adaptation is completed, to give way to others that have sprung up
in the mean time.

To the physicist, pure and simple, the idea of a body facilitates the
acquisition of a comprehensive survey in his department, and does
not operate as a disturbance. So, also, the person that pursues
purely practical ends, is materially assisted by the concept of the I or
Ego. For, unquestionably, every form of thought that has been
voluntarily or involuntarily constructed for some especial purpose,
possesses for that particular purpose a permanent value. As soon,
however, as physics and physiology touch, the ideas held in the one
domain are discovered to be untenable in the other. From the
striving after an adaptation of the one to the other arise the various
atomic and monad theories—which are unsuccessful, however, in the
attainment of their object. If we regard sensations, taken in the
sense above defined, as world-elements or elements of the All, the
problems referred to are practically removed, and the first and most
important adaptation therefore effected. This basal notion (without
any pretension to being a philosophy for all eternity) can at present
be adhered to with respect to all provinces of experience; it is
consequently the one that accommodates itself with the least
expenditure, that is, more economically than any other, to the
present temporary state of collective science. Moreover, in the
consciousness of its purely economical office, this basal notion acts
with most perfect tolerance. It does not obtrude itself into provinces
in which the current conceptions are still adequate. It will ever be
ready, upon subsequent extensions of the domain of experience, to
give way to a better one.

The philosophical point of view of the average man—if that term


may be applied to the naïve realism of the ordinary individual—has a
claim to the highest consideration. It has arisen in the progress of
immeasurable time without the purposed assistance of man. It is a
product of nature, and is preserved and sustained by nature.
Everything that philosophy has accomplished—the biological title of
every advance, nay of every error, admitted—is, compared with it,
but an insignificant and ephemeral product of art. And in reality, we
see every thinker, every philosopher, the moment he is forced away
from his one-sided intellectual occupation by some practical
necessity, immediately fall back upon the universal point of view that
all men hold in common.

We seek by no means to discredit this point of view. The task that


we have set ourselves is simply to show why and to what purpose
for the greatest part of our life we occupy this point of view, and
why and for what purpose we are provisorily obliged to abandon it.
No point of view has an absolute permanent validity. Each has an
importance but for some one given end.

ERNST MACH.
THE ORIGIN OF MIND.

#Given facts and deduced facts.#

We must distinguish between two kinds of facts; viz., given facts


or data, and deduced facts or inferences. With regard to the facts of
soul-life we recognise that the former class, that of given facts,
necessarily consists of states of consciousness only; they are feelings
of any description, varying greatly in their nature. They are different
in the rhythmical forms of their vibrations, in their intensity, and in
their distinctness. The latter class, that of inferences, is deduced
from the former, and serves no other purpose than that of
explanation. This class is mostly representative of external facts, and
knowledge of external facts exists only in so far as external facts are
represented in deduced facts. What a thinking being would call
external facts is nothing but the contents of certain deduced facts.

Deduced facts, and among them the conception of external facts


(wherever they exist), have been produced by the effort of
accounting for given facts—viz., the elementary data of
consciousness and their relations. Deduced facts are the
interpretation of given facts. They are, so to say, conjectures
concerning their causes as well as their interconnections.
#Definition of mind.#

The organised totality of deduced facts, as it is developed in


feeling substance, is called mind. Feelings are the condition of mind.
From feelings alone mind can grow. But there is a difference
between feelings and mind. Feelings develop into mind, they grow to
be mind by being interpreted, by becoming representative.
Representative feelings are mind. Accordingly, we characterise mind
as the representativeness of feelings.

#The growth of mind.#

Although deduced facts are an interpretation of given facts, this


"interpretation" is not expressly designed. These inferences from
given facts are not invented with a premeditated purpose; they are
not constructed with foresight or intention. Deduced facts grow
naturally and spontaneously from given facts, which are the
elements of sense-activity. There is not an agent that oversees their
fabrication; there is not a devising "subject" that surmises the
existence of external facts and thus matures their conception into
deduced facts. Deduced facts are rather the natural product of a
certain group of given facts. Deduced facts issue from a co-operation
of a number of feelings. They are the result of an organisation of
certain repeated sense-impressions which produce a disposition not
only to receive sense-impressions of the same kind, but also to react
upon them in a certain way. Mind is not the factor that organised the
given facts of mere sense-impressions so that they became
representations. There was no mind as long as feelings remained
unorganised. Feelings acquire meaning; and as soon as they have
acquired meaning they are what we call "deduced facts,"
representations—especially representations of external facts.
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