R Quick Syntax Reference, 2nd Edition.pdf

所需积分/C币:10 2019-06-21 20:19:30 2.42MB PDF
8
收藏 收藏
举报

书籍描述: 这本方便的参考书详细描述了R的复杂性,通过添加R版本3.4和3.5的特性更新了流行的第一版。从R的基本结构开始,本书将带您经历R中使用的术语和使R工作所需的语法。你会发现快速简单地查找正确的表达形式。一些新材料包括有关rstudio、s4语法、使用字符串以及使用TwitterAPI的示例的信息。 有了R Quick Syntax Reference的副本,您将发现您能够使用R中提供的大量函数,甚至能够编写自己的函数来探索和分析数据。
R Quick Syntax Reference: A Pocket Guide to the language, APIs and Library Margot Tollefson Stratford, IA, USA ISBN-13(pbk):978-1-4842-4404-3 ISBN-13( electronic):978-1-48424405-0 https://doi.org/10.1007/978-1-4842-4405-0 Copyright o 2019 by Margot Tollefson This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the mate fal is concerned, specifically the rights of translation, reprinting, reuse of illustrations, re itati n, broadcasting, reproduction on microfilms or in any other physical way and transmis ormation storage and retrieval, electronic adaptation, computer software, or by similar or d / mir methodology now known or hereafter developed Trademarked names, or nd images may appear in this book. Rather than use a trademark symbol with every occure trademarked name, logo, or image we use the names, logos, and images only in an edit lal fashion and to the benefit of the trademark owner, with no intention of infringement of the t.demark The use in this publication of trade na ade marks, service marks, and similar terms, even if they are not identified as such, is not b be al in as an expression of opinion as to whether or not they are subject to proprietary rights While the advice and information in this bo. believ a to be true and accurate at the date of publication, neither the authors nor the editor no/ publisher can accept any legal responsibility for any errors or omissions that may e aaae. The publisher makes no warranty, express or implied, with respect to the material contai he en in Managing Director, Apress Media LLC: Welmoed Sp Acquisitions Editor: Steve anglin Development Editor: Matthew Moodie Coordinating editor: Mark Powers Cover designed by eStudio calamar CoverimagedesignedbyFreepik(www.freepik.com) Distributed to the book trade worldwide by springer Science+Business Media new y, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax(201)34-4505, e-mail orders-ny@springer-sbm.com,orvisitwww.springeronline.comApressMedia,Llcisa California LLC and the sole member (owner) is Springer Science Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation Forinformationontranslations,pleasee-maileditorial@apress.com;forreprint,paperback,or audiorightspleaseemailbookpermissions@springernature.com press titles may be purchased in bulk for academic, corporate, or promotional use e Book andeboOkBulkSaleswebpageathttp://www.apress.com/bulk-salesationreferenceourPrint versions and licenses are also available for most titles. For more inform Any source code or other supplementary material referenced by the author in this book is available toreadersonGithubviathebooksproductpagelocatedatwww.apress.com/9781484244043 Formoredetailedinformationpleasevisithttp://www.apress.com/source-code Printed on acid-free paper www.1ebuKes.com Table of contents About the author Acknowledgments ma manxiifi Introduction mXv Part a r basics ■■■■■■■■■■■■■口■■■■■■■■■■■■■■■■■■■■■■口■■■■■■■口■■■■■■■■■■■■■■口■■■■■■■口■■■■■■■ Chapter 1: Downloading R and setting Up a File system ammaamm3 Downloading r and r studio Windows ■重 Mac osx Linux… 重■重DD重日重重D Installing and Updating Packages 345567 Windows ■Da Mac0SX…8 Updating r…..,.,,,,, Windows. mmm.. Mac os x Using R in Separate Folders ■Dm Windows…10 Mac os x 11 Linux. mmm. 11 Projects in R Studio Il www.1ebuKes.com TABLE OF CONTENTS Chapter 2: The R Prompt and the R studio Windows. ■■■■■■■口■■口■■■■■国■■国■■■■■ 13 The three parts of r: Objects, Operators, and Assignments……………13 The R Prompt…,...,,,…14 An Example of a Calculation 15 The four r studio windows 16 The first sub-window 16 The second sub-window The third sub-window The fourth sub-window Chapter 3: Assignments and Operators ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■a■■ 21 Types of Assignment Example of Three Types of Assignment.,,,.,,,,…,……23 Listing and Removing Objects in R and R Studio Operators 26 Logⅰ cal Operators and Functions…..,,,,,,,…26 Arithmetic Operators Matrix Operators and Functions 30 Relational Operators 32 Subscripting Operators 33 Odds and ends Part l Kinds of objects ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■口■■■■■■■■■■ Chapter 4: Modes and Types of objects. ■■■ Overview of the Modes and Types Commonly Used modes..memmmemaaemaaaamema 334 Atomic, Recursive, and Language Modes www.1ebuKes.com TABLE OF CONTENTS Some Functions for Atomic modes( types)…,.,.,…,….…,245 The null mode The logical Mode. The Numeric Mode and the Integer or Double Types The complex Mode 51 The raw mode 54 The character m0de…………57 The Common Recursive and language modes 61 The list mode The Function Mode and the closure, special, and built-In types ea. 63 The call mode 64 The Expression Mode ..mmemmmnaemnmnnnmmanmnmnnamnnnmnnonn 66 The environment mode 68 TheS4M0de…………171 Chapter 5: classes of objects amaa u73 Some basics on c| asses…,…, 73 Vectors n74 Some common s 3 classes The matrix class: matrixg77 The array class: array 83 The time series classes: ts and mts 84 The factor classes: factor and ordered87 The data frame class:data.rame.……90 The date and time classes The formula class: formula 98 TheS4Cass……103 Names for Vectors, Matrices, Arrays, and lists .mmmmmm 106 TABLE OF CONTENTS Part Functions ■■■■■■■D■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 111 Chapter 6: Packaged Functions mmmm 113 The libraries 113 Default Packages and primitive Functions .mmmmmmm115 Using the Help Pages identifier 116 Title Description .mmmmmamammmmmamnmanmnmanmammnmmamnmmn 116 sage. ,117 Arguments 117 Details ,118 Value 118 Some other Optional Sections.mmamaaamnnmmemmnmmmnnmn 119 References…19 See als0……119 EXamples 120 Chapter 7: User-Created Functions, Scripts, and S4 Methods ummmm 121 Scripts The structure of a function How to enter a function into r ,125 Using an editor aaaeaaaaaan. 126 Inline Entry…129 An Outside Editor: dget( and Copying and Pasting .m....n 130 In r studio mm131 Chapter 8: How to Use a Script or Function. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 139 Calling a Function… 139 Arguments TABLE OF CONTENTS The output from a Function……43 Example of a Script: Mining Twitter. mmemeannmnnnmnnamenn 146 Part IV: /0 and Manipulating Objects mm aemmmeaEas 151 Chapter 9: Importing and Creating Data ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■国■■■■■■■■口 153 Reading Data into R and R Studio, Including R Datasets menem... 154 The function scan()…,,,,…,……155 The Functions read, table( and read. cSv (.mm.....n 158 The Functions load(, attach(, and data ()............. 163 The function readrds()…,,,,,…166 Other Read Functions to Import Files. m..mmmm.167 Reading Data Using R Studio. R Datasets…170 Probability Distributions and the Function sample()…,.,,………171 Probability Distributions…,,.,,………17 The Function sample()……,,,,,…174 Manually Entering Data and Generating Data with Patterns.mmmm..175 The Function cO 176 The Functions seg( and rep(0)…,.,,,,,…,……,179 Combinatorics and grid Expansion. The function Chapter10: Exporting from R,,,,…,,,,,…,,…,187 The Function dump 188 The Function sink( 189 The function write()…,.,.,.,.,.,.,,…,…,……,191 The function write. matrix()…,,.,…,…,,……192 The functions write, table() and write.CsV)…,,……194 The function save()…… 199 TABLE OF CONTENTS The function saverS()…….,,,,,…………202 Matching Importing and Exporting Functions.n 202 Other Exporting Functions 203 Chapter 11: Descriptive Functions and Manipulating Objects.m mm 205 Descriptive Functions . The Function dimo 206 The Functions nrow (, ncol(, NRoWO, and NolO ...........( The Function length mmemmmmnmmnnmmnn 208 The functions nchar( and nuchal()……,…,……………212 Manipulating Objects …215 The Functions cbindo and rbindo .....mmmmmmmmmmmnn 215 The apply Functions….,..,.,,,,,……217 The Function eapply o . The sweep( and scale Functions ■D■■■ 26 The Functions aggregate(, table(, tabulate(, and ftableo 230 Some Character String Functions.am..memmnannanememnmniamtmemnn 240 Part va flow control n251 Chapter 12: Flow Control mannan 253 Brackets“t” and the semicolon“;” n253 The“if”and“if/else” Control statements…… 重DD重■ 254 The“ while” Control statement 255 The“for” Control statement.…………………256 The“ repeat” Control statement..,,,,,…257 The statements“ break”and"“next”…,258 Nesting,,,,,,,258 TABLE OF CONTENTS Chapter 13: Examples of Flow control. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■口■ 259 Nested for Loops with an if/else Statement 259 Using Indices. A'while’Loo 261 Using Indices . Nested“for’ Loops….,,,,,,,,,, 263 Using Indices…,, n264 A for Loop if Statement, and next'Statement 266 Using Indices..,.,.,.,.,.,,.,,.,,,267 A" Loop a repeat'Loop, an ifStatement, and a 'break' statement an 268 Using Indices…272 Chapter 14: The Functions ifelseo and switch.m 277 The Function ifelse(.mmmmemmammmmmmmmmmann 277 The Function switch( 282 Part V Some Common Functions, Packages and Techniques. ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■■■■■■■■■■■■■■■■■ 285 Chapter 15: Some Common Functions. 287 The Function options()…, 重■重DD重日重重■ 287 The Functions roundo), signif(), and noquote( 291 The Function round()…,,,,,,,,,,,,,,,,,……,291 The Function signif( 292 The Function noquote()……..,,,…,……………292 The Function cat()…,,,,,,,,,,,………293 The Functions format(, print(, plot(, and summary ■D面重DD重DD重 295 The Function format()…… 296 The Function print ■重■重■DD■重■重■B■重■重■B■重■重■B■重■重■ 297

...展开详情
试读 127P R Quick Syntax Reference, 2nd Edition.pdf
立即下载
限时抽奖 低至0.43元/次
身份认证后 购VIP低至7折
一个资源只可评论一次,评论内容不能少于5个字
您会向同学/朋友/同事推荐我们的CSDN下载吗?
谢谢参与!您的真实评价是我们改进的动力~
关注 私信
上传资源赚钱or赚积分
最新推荐
R Quick Syntax Reference, 2nd Edition.pdf 10积分/C币 立即下载
1/127
R Quick Syntax Reference, 2nd Edition.pdf第1页
R Quick Syntax Reference, 2nd Edition.pdf第2页
R Quick Syntax Reference, 2nd Edition.pdf第3页
R Quick Syntax Reference, 2nd Edition.pdf第4页
R Quick Syntax Reference, 2nd Edition.pdf第5页
R Quick Syntax Reference, 2nd Edition.pdf第6页
R Quick Syntax Reference, 2nd Edition.pdf第7页
R Quick Syntax Reference, 2nd Edition.pdf第8页
R Quick Syntax Reference, 2nd Edition.pdf第9页
R Quick Syntax Reference, 2nd Edition.pdf第10页
R Quick Syntax Reference, 2nd Edition.pdf第11页
R Quick Syntax Reference, 2nd Edition.pdf第12页
R Quick Syntax Reference, 2nd Edition.pdf第13页
R Quick Syntax Reference, 2nd Edition.pdf第14页
R Quick Syntax Reference, 2nd Edition.pdf第15页
R Quick Syntax Reference, 2nd Edition.pdf第16页
R Quick Syntax Reference, 2nd Edition.pdf第17页
R Quick Syntax Reference, 2nd Edition.pdf第18页
R Quick Syntax Reference, 2nd Edition.pdf第19页
R Quick Syntax Reference, 2nd Edition.pdf第20页

试读结束, 可继续阅读

10积分/C币 立即下载