![For Kathy of course Copyright 2015 by SAGE Publications Inc All rights - photo 1](/uploads/posts/book/90439/images/cover.jpg)
![For Kathy of course Copyright 2015 by SAGE Publications Inc All rights - photo 2](/uploads/posts/book/90439/images/halftitle.jpg)
For Kathy, of course.
![Copyright 2015 by SAGE Publications Inc All rights reserved No part of this - photo 3](/uploads/posts/book/90439/images/title.jpg)
Copyright 2015 by SAGE Publications, Inc.
All rights reserved. No part of this book may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without permission in writing from the publisher.
Printed in the United States of America
Library of Congress Cataloging-in-Publication Data
Gaubatz, Kurt Taylor, author.
A survivors guide to R : an introduction for the uninitiated and the unnerved / Kurt Taylor Gaubatz.
pages cm
Includes bibliographical references and index.
ISBN 978-1-4833-4673-1 (pbk. : acid-free paper)
ISBN 978-1-4833-4688-5 (web PDF)
1. StatisticsData processing. 2. R (Computer program language) I. Title.
QA276.45.R3G38 2015
005.262dc23 2013045399
This book is printed on acid-free paper.
14 15 16 17 18 10 9 8 7 6 5 4 3 2 1
![FOR INFORMATION SAGE Publications Inc 2455 Teller Road Thousand Oaks - photo 4](/uploads/posts/book/90439/images/sage.jpg)
FOR INFORMATION:
SAGE Publications, Inc.
2455 Teller Road
Thousand Oaks, California 91320
E-mail:
SAGE Publications Ltd.
1 Olivers Yard
55 City Road
London, EC1Y 1SP
United Kingdom
SAGE Publications India Pvt. Ltd.
B 1/I 1 Mohan Cooperative Industrial Area
Mathura Road, New Delhi 110 044
India
SAGE Publications Asia-Pacific Pte. Ltd.
3 Church Street
#10-04 Samsung Hub
Singapore 049483
Acquisitions Editor: Vicki Knight
Assistant Editor: Katie Guarino
Editorial Assistant: Yvonne McDuffee
Production Editors: Kelly DeRosa, Stephanie Palermini
Copy Editor: QuADS Prepress (P) Ltd.
Typesetter: C&M Digitals (P) Ltd.
Proofreader: Wendy Jo Dymond
Indexer: Kurt Taylor Gaubatz
Cover Designer: Anupama Krishnan
Marketing Manager: Nicole Elliott
DETAILED CONTENTS
LIST OF TABLES
LIST OF FIGURES
ABOUT THE AUTHOR
Kurt Taylor Gaubatz is an associate professor in the Department of Political Science and Geography and in the Graduate Program in International Studies at Old Dominion University (ODU). He teaches a range of courses in international relations, international law, and research methods. Before coming to ODU in 2000, he was the Visiting John G. Winant Lecturer in American Foreign Policy at Oxford University (Nuffield College) and was on the political science and international relations faculty at Stanford University. He has served as the Susan Louise Dyer Peace Fellow in the National Fellows program at the Hoover Institution and was a Pew Faculty Fellow in International Affairs with the Kennedy School of Government at Harvard University. He did his undergraduate work in economics at the University of California, Berkeley. He holds masters degrees in international law from the Fletcher School of Law and Diplomacy and in theology from Princeton Theological Seminary. He earned his PhD in political science from Stanford University. He is the author of Elections and War (Stanford University Press, 1999) as well as a number of prominent articles mostly focused on international law and on the relationship between domestic politics and international relations. More information can be found at www.sagepub.com/gaubatz .
PREFACE
A few years ago, I was at a conference chatting with one of the most distinguished and technologically capable political scientists I know. This is someone who came to political science with an undergraduate degree in math from Caltech and is the author of a major text on game theory as well as a number of prominent articles using sophisticated statistical analysis. He recounted the experience of sitting in on an advanced seminar on Bayesian statistics. The statistics were pretty straightforward, he said. The real challenge was coming to grips with R for the first time. When I mentioned that I intended to switch to R for one of my introductory statistics classes, he shuddered.
This story might come as a revelation to many in the community of advanced R users, who view R syntax as essentially second nature. Having worked with R on a daily basis for many years, they have little trouble making it sit, lie down, and roll over. They are somewhat surprised when others think that the only trick R knows is playing dead.
I did start using R for teaching, and I, and every one of the students in those classes, survived. At its core, this book is a step-by-step guide to how we did that. In fact, although R does have a steep learning curveon first encounter, it is often intimidating and unnervingit has proven to have a number of significant advantages for teaching and learning statistics.
R is powerful and inexpensive (free!). It is rapidly becoming the package of choice for advanced statistical analysis across a number of fields. Moreover, it has probably been assigned to you, so you just have to buckle down and learn it. The purpose of this book is to help you survive and even to thrive in that process. The approach I take is to focus primarily on the challenges of using R to manage, manipulate, and visualize your data, rather than the usual approach of jumping right into conducting statistical analysis with R.
I take this alternative approach for three reasons. In the first place, data management is the foundation for all statistical analysis. Getting your data into the right form for analysis is a critical skill. Yet data management issues are rarely taught in statistics classes, where appropriate and well-groomed data sets appear to float down directly from heaven. This book provides the opportunity to get a handle on some of those essential background skills. Second, once you have learned the basic structure and rules of R in this context, you will find it much easier to follow up with learning the statistical procedures, which you will most likely do in the context of a statistics class and text. Finally, separating the statistics from the teaching of R allows the book to serve both as a tutorial and as a reference in which you can quickly find the commands and procedures that otherwise are mixed in and hidden among the statistical content of traditional texts.
Moreover, while this book starts with the very basics of installing R and getting it to run simple procedures, it ultimately covers R at a significantly greater depth than you are likely to encounter in a statistics class. This book is designed to carry you beyond the classroom, giving you the opportunity to gain and maintain the kind of facility with R that can make it a functional real-world skill in your analytical toolbox.
Because this book separates the mechanics of working with R from the teaching of statistics, it will be helpful in a wide range of contexts. It is designed to help tackle data problems that arise across a wide range of fields and at different levels of statistical sophistication. Whether you are tackling R in an introductory statistics class or an advanced graduate seminar or are just transitioning to R from another statistics program, you will find this a helpful guide along the way.
For users at the introductory level, is an introduction to Rs broad variety of built-in plots.
For those beginning to work on collecting and managing their own data, confronts the real-world challenge of dealing with missing data.
Next page