所需积分/C币:22 2017-08-19 09:33:59 9.26MB PDF
收藏 收藏

Use r! Albert: Bayesian Computation with R Cook/Swavne: Interactive and dynamic graphics for data analysis: With r and ggobi Hahne/luber/Gentleman/Falcon Bioconductor Case Studies Paradis. Analysis of Phylogenetics and Evolution with r Pfaff: Analysis of Integrated and Cointegrated Time Series with R sarkar. lattice: multivariate data visualization with r Spector: Data Manipulation with R Deepayan Sarkar Lattice Multivariate data visualization with r Springer Deepayan sarkar Program in Computational biology Division of public health sciences Fred Hutchinson Cancer Research Center 1 100 Fairview aveN. M2-B876 Seattle wa 98109-1024 USA dsarkarafhcrc org Series editors Robert gentleman Kurt hornik Program in Computational Biology Department fur Statistik und Mathematik Division of public health sciences Wirtschalisuniversitat wien augasse 2-6 Fred hutchinson cancer Research center A-1090 Wien 1 100 Fairview Ave N. M2-B876 Ar austria eattle. Washington 98109-1024 USA Giovanni parmigiani The Sidney Kimmel Comprehensive Cancer Center at Johns Hopkins University 550 North broadway Baltimore md21205-2011 JSA ISBN9780-387-75968-5 e-ISBN9780-387-75969-2 DOI:10.1007978-0-387-75969-2 Library of Congress Control Number: 2008920682 o 2008 Springer Science+Business Media, LLC All rights reserved. This work may not be translated or copied in whole or in part without the written permission of thc publisher(Springer Scicncc+Busincss Media, LLC, 233 Spring Strcct, Ncw York, NY 10013, USA), except for brief excerpts in connection with reviews or scholarly analysis. Use in connection with any form of information storagc and retrieval, clectronic adaptation, computer softwarc, or by similar or dissimilar methodology now known or hereafter developed is forbidden The usc in this publication of tradc namcs, trademarks, service marks, and similar tcrms, cvcn if they arc not idcntificd as such, is not to be takcn as an cxprcssion of opinion as to whether or not thcy are subjcct to proprietary rights Printed on acid-free paper 987654321 springer. com TO Pinaki mitra Preface The lattice package is software that extends the R language and environment for statistical computing (R Development Core Team, 2007) by providing a coherent set of tools to produce statistical graphics with an emphasis on multivariate data. It is modeled on the Trellis suite in s and S-PlUSe.From the user's point of view, it is a self-contained system that is largely independent of other graphics facilities in R. This book is about lattice, and is primarily intended for(1)both long-tine and new R users looking for a powerful systern to produce conventional statistical graphics,(2) existing lattice users willing to learn a little bit of r programming to gain increased fexibility, and ( 3) developers who wish to implement new graphical displays building on the infrastructure already available in lattice Why lattice? Graphics can effectively complerrient statistical data, analysis in various ways Successful graphics arise from a conbination of good design and good imple mentation. In this day and age, implementation is almost exclusively driver by computers. There is no lack of software tools that allow their users to con vert data into graphics; lattice is yet another candidate in this ever-widening POO What makes lattice stand out? A good general-purpose tool should not get n the way of the user, yet it should be flexible enough to enable most tasks (without undue difficulty ), whether it be standard, slightly out of the ordinary, or entirely novel lattice tries to meet this standard by being a high-level tool that produces structured graphics, while retaining fexibility by systematicall decoupling the various elements of a display; the individual elements have well thought-out defaults, but these can be overridden for detailed control The end-product is a system that allows the creation of common statistical graphics, often with fairly complex structure, with very simple code. At the same time, it allows various degrees of customization, without requiring undue ffort V111 Preface What to expect from this book It is easy to get started with lattice, but the transition from seemingly simple to more sophisticated use can be difficult without an appreciation of how the different components and their defaults interact with each other. This appreciation can only come from experience, but it is hoped that this book can ease the transition to some extent The book started out as a manual for lattice. and was not intended to offer qualitative guidelines about the effective design of statistical graphics. This plan was abandoned quite early on; a static book is not the ideal vehicle for documenting an evolving system, and it is hard to look at and change bits and pieces of a picture without discussing its merits anld drawbacks. In the end Is DOO ok consists of some CoMments on graphical design, sone interesting (one would hope) examples, and large doses of lattice code and wisdoN. It is still a book that is primarily about software; the code in the book is at east as inportant as the pictures. No code is hidden in this book, and if there is one key message that the reader should expect to take away, it is that lattice allows the creation of conplex displays using relatively little code This econony nay not be appealing to everyone, but it is what I liked nost about the Trellis system, and what has driven much of the development, of lattice beyond the original goal of compatibility with Trellis. The other key idea, that, is difficult to corrumunicat e in function documentation and one that is addressed in this book, is that, of interrelationships between the different components of lattice, and how they can be effectively exploited What not to expect from this book This book is not an exhaustive manual for lattice. Most functions in lattice are described to some extent in this book but it does not serve as the definitive reference. There are two reasons for this. First, there are many features in attice that are obscure and of very limited use, and do not justify detailed discussion. Second, lattice is an evolving system, and any attempt to document it exhaustively is sure to get out of date quickly. All functions in lattice cone with online documentation. which should be used as the definitive reference how to read this book That depends to a large extent on the reader. Those new to lattice should start with Chapter 1 to get a feel for what lattice is all about. Chapter 2 gives a more thorough, and sometimes quite technical, overview of the lattice model. Intermediate to advanced readers should find this chapter instructive Beginners are encouraged to go through it as well, but should be prepared to encounter parts they find difficult, and skip them without getting bogged down; things should become clearer after gaining some practical experience Preface The rest of Part I describes the various high-level functions in lattice. These chapters can be read in any order. Not much is said about the design of these graphics as they are standard, and most of the focus is on the software imple mentation. The level is basic for the most part: however, a few examples do go into some detail for the sake of taking a discussion to its natural conclu- sion. Again, beginners should be prepared to skip these parts during a first reading Part Ii is more of a reference, going che nitty-gritty details of lattice. a basic understanding of all the chapters is important to get the most out of lattice, but is not essential for casual use. These chapters too can be read in any order, for the most part, and the reader should feel free to pick and choose. The final two chapters, in Part Ill, deal with extensions to lattice and are primarily intended for future developers. Of course, they can still be useful to the casual reader for the examples they provide It is important to realize that lattice is a complicated piece of software and it is unrealistic to expect full mastery of it after one reading The key to getting it'is practical experience, and the best way to gain that experience is to try out the code. All the code in this book, along with the figures they produce, is available from the supporting Web site http://lmdvr.r-forge.r-project.org/ A critical aspect of graphics that is hard to communicate in a book is its iterative nature; graphics that are presented to an audience is rarely the result of a. first attempt. This process is reflected in some of the examples in this book, but, many others have silently omitted many intermediate steps. Or can get a sense of these missing steps by asking: "What is the purpose of this particular argument? "In other words trying out variations of the code should be an integral part of the learning process The final thing to remember is that all this is the means to an end, namely producing effective visualizations of data. Software can help, but the ultimate decisions are still the responsibility of the user. For those looking for guidance on how to create effective graphs, the work of Edward R. Tufte, William S Cleveland. and of course john w. Tukey are invaluable resources Color Color can be an inportant factor in the visual impact of a graphic. Most figures in this book are black and white, but a few color plates are also included. Of these, some have the corresponding black and white versions as well, and have been chosen to highlight the impact of color. Others are solely available in color, as their black and white versions are of little or no use Color versions of all figures are available on the book,s web site Prerequisites No prior experience with lattice is required to read this book, but basic fa miliarity with R, and in particular the ability to use its online help system, is Preface assumed. The first chapter of Dalgaard(2002 )should suffice for the most part Relatively advanced concepts such as generic functions and method dispatch are relevant, but can be ignored for casual use ( these concepts are briefly introduced where relevant, but not at any deep level). No familiarity with traditional R graphics is presumed. Knowledge of the grid package can be beneficial. but is not essential Several r packages are used in this book. lattice itself should come with all recent installations of R, and it should be sufficient to type >工 ibrary(" attice") at the r prompt to start using it. Other packages used explicitly(not counting further dependencies) are grid lattice Extra, copula, ellipse, grid Base, flow Viz flow Core, hexbin, locfit, logspline, mapproj, maps, MASS. MEMss, mlm Rev and RColorBrewer. All of these may not be of interest(some are required just for one or two examples); type help("install packages") to learn how to install the packages you need from CRAN. flow Core flow Viz and hexbin are Bioconductor packages, and may be installed by typing >source("http://bioconductor.org/bioclite.r") biocLite(c("flowCore",flowViz","hexin)) a bit of history The design of s graphics has been heavily influenced by the principles of graph construction laid out in The Elements of Graphing Data(Cleveland, 1985) This influence carries over to Trellis graphics, which incorporates further ideas (notably multipanel conditioning and banking) presented in Visualizing Data (Cleveland, 1993). Trellis graphics was first implenented in the S systen, and has been available in S-Plus for several years The name Trellis refers both to the general ideas underlying the system, as well as the specific implementation in S. The lattice package is an independent implementation of Trellis graphics (in the first sense), with an API closely modeled on the one in S. Unlike the s version, which is implemented using traditional graphics, lattice uses Paul Murrells grid package, which provides more fexible low-level tools Although modeled on it, the lattice api is not identical to that of the Trellis suite in S. Some of the differences are due to the choice of grid as the underlying engine, but many are intentional. Still, where possible, effort has been made to allow trellis code written in s to run with minimal modification Consequently, writings about the original Trellis suite mostly apply to lattice as well. This includes the wealth of resources at the trellis web site at bell Labs TheCoinpreheNisiverArchiveNetwork,http://cran.r-project.org

试读 127P R语言可视化
立即下载 低至0.43元/次 身份认证VIP会员低至7折
R语言可视化 22积分/C币 立即下载

试读结束, 可继续阅读

22积分/C币 立即下载 >