R for Programmers

Advanced Techniques
 
 
CRC Press
  • 1. Auflage
  • |
  • erschienen am 31. März 2017
  • |
  • 434 Seiten
 
E-Book | ePUB mit Adobe-DRM | Systemvoraussetzungen
978-1-315-35254-1 (ISBN)
 
This book discusses advanced topics such as R core programing, object oriented R programing, parallel computing with R, and spatial data types. The author leads readers to merge mature and effective methdologies in traditional programing to R programing. It shows how to interface R with C, Java, and other popular programing laguages and platforms.
  • Englisch
  • Boca Raton
  • |
  • Großbritannien
Taylor & Francis Ltd
  • Für höhere Schule und Studium
  • |
  • Für Beruf und Forschung
175 schwarz-weiße Abbildungen, 91 schwarz-weiße Fotos, 84 schwarz-weiße Zeichnungen
  • 14,91 MB
978-1-315-35254-1 (9781315352541)
weitere Ausgaben werden ermittelt
  • Cover
  • Half Title
  • Title Page
  • Copyright Page
  • Dedication
  • Contents
  • Preface
  • Acknowledgments
  • About the Author
  • About the Translator
  • Translator's Words
  • SECTION I: APPLYING R IN MATHEMATIC CALCULATIONS AND ALGORITHMS
  • 1. The Knowledge System and Mathematical Functions of R
  • 1.1 Overview of the Knowledge System of R
  • 1.1.1 The Knowledge System of R
  • 1.1.1.1 Overview of the Knowledge System of R
  • 1.1.1.2 The Basic Knowledge of the R Language
  • 1.1.1.3 The Third Part Packages of R
  • 1.1.1.4 The Basic Knowledge of Mathematics
  • 1.1.1.5 Business Knowledge
  • 1.1.1.6 Comprehensive Skills across Disciplines
  • 1.1.2 Learning the R Language
  • 1.1.2.1 The Basic Knowledge of IT
  • 1.1.2.2 The Chinese Books about R
  • 1.1.2.3 The Chinese Communities about R
  • 1.1.2.4 The Chinese Blogs about R
  • 1.2 The Mathematical Calculations of R
  • 1.2.1 The Basic Calculations
  • 1.2.2 Calculations of the Trigonometric Functions
  • 1.2.2.1 The Trigonometric Functions
  • 1.2.2.2 The Inverse Trigonometric Functions
  • 1.2.2.3 The Trigonometric Formulae
  • 1.2.3 Calculations of Complex Numbers
  • 1.2.3.1 Newing a Complex
  • 1.2.3.2 The Arithmetic Operations of Complex Numbers
  • 1.2.3.3 The Square Roots of Complex Numbers
  • 1.2.4 The Equation Calculations
  • 1.2.4.1 Linear Equations with One Unknown
  • 1.2.4.2 The Quadratic Equations with One Unknown
  • 1.2.4.3 The Cubic Equations with One Unknown
  • 1.2.4.4 The Linear Equation Sets with Two Unknowns
  • 1.3 The Probability Basics and R
  • 1.3.1 Introduction to Random Variables
  • 1.3.2 The Numerical Characteristics of Random Variables
  • 1.3.2.1 Mathematical Expectation
  • 1.3.2.2 Variance
  • 1.3.2.3 Standard Deviation
  • 1.3.2.4 Quantile
  • 1.3.2.5 Covariance
  • 1.3.2.6 Correlation Coefficient
  • 1.3.2.7 Moments
  • 1.3.2.8 Covariance Matrix
  • 1.3.3 Limit Theorems
  • 1.3.3.1 Law of Large Numbers
  • 1.3.3.2 Central Limit Theorems
  • 1.4 Introduction to Frequently Used Continuous Distributions and Their R Implementations
  • 1.4.1 Uniform Distribution
  • 1.4.1.1 Probability Density Function
  • 1.4.1.2 Cumulative Distribution Function
  • 1.4.1.3 Distribution Test
  • 1.4.2 Normal Distribution
  • 1.4.2.1 Probability Density Function
  • 1.4.2.2 Cumulative Distribution Function
  • 1.4.2.3 Distribution Test
  • 1.4.3 Exponential Distribution
  • 1.4.3.1 Probability Density Function
  • 1.4.3.2 Cumulative Distribution Function
  • 1.4.3.3 Distribution Test
  • 1.4.4 Gamma Distribution
  • 1.4.4.1 Probability Density Function
  • 1.4.4.2 Cumulative Distribution Function
  • 1.4.4.3 Distribution Test
  • 1.4.5 Weibull Distribution
  • 1.4.5.1 Probability Density Function
  • 1.4.5.2 Cumulative Distribution Function
  • 1.4.5.3 Distribution Test
  • 1.4.6 ?2(Chi-Square) Distribution
  • 1.4.6.1 Probability Density Function
  • 1.4.6.2 Cumulative Distribution Function
  • 1.4.6.3 Distribution Test
  • 1.4.7 F Distribution
  • 1.4.7.1 Probability Density Function
  • 1.4.7.2 Cumulative Distribution Function
  • 1.4.7.3 Distribution Test
  • 1.4.8 t-Distribution
  • 1.4.8.1 Probability Density Function
  • 1.4.8.2 Cumulative Distribution Function
  • 1.4.8.3 Distribution Test
  • 1.4.9 Beta Distribution
  • 1.4.9.1 Probability Density Function
  • 1.4.9.2 Cumulative Distribution Function
  • 1.4.9.3 Distribution Test
  • 1.5 The Calculation of Derivatives in R
  • 1.5.1 The Calculation of Derivative
  • 1.5.2 The Derivative Formulas of Elementary Functions
  • 1.5.2.1 The Linear Function
  • 1.5.2.2 The Power Function
  • 1.5.2.3 The Exponential Function
  • 1.5.2.4 The Logarithmic Function
  • 1.5.2.5 The Sine Function
  • 1.5.2.6 The Cosine Function
  • 1.5.2.7 The Tangent Function
  • 1.5.2.8 The Cotangent Function
  • 1.5.2.9 The Arc-Sine Function
  • 1.5.2.10 The Arc-Cosine Function
  • 1.5.2.11 The Arc-Tangent Function
  • 1.5.3 The Calculation of Second Derivative
  • 1.5.4 The Calculation of Partial Derivative
  • 2. The Algorithm Implementations in R
  • 2.1 Rewriting the Collaborative Filtering Algorithm (UserCF) on Mahout with R
  • 2.1.1 The Recommendation Algorithm Model of Mahout
  • 2.1.2 The Model Implementations in R
  • 2.1.2.1 Creating the Data Model
  • 2.1.2.2 Implementing Euclidean Distance Similarity Algorithm
  • 2.1.2.3 Implementing the Nearest-Neighborhood Algorithm
  • 2.1.2.4 Implementing the Recommendation Algorithm
  • 2.1.2.5 Running the Program
  • 2.1.3 The Principle of the Algorithm Implementation
  • 2.1.4 Summary of the Algorithm
  • 2.2 The R Implementation of the PageRank Algorithm
  • 2.2.1 Introduction to the PageRank Algorithm
  • 2.2.2 The Principle of PageRank Algorithm
  • 2.2.2.1 Principle of the Algorithm
  • 2.2.2.2 The Calculation Formula
  • 2.2.2.3 Constructing an Instance with Data of Four Pages
  • 2.2.3 R Implementation of the Stand-Alone Algorithm
  • 2.2.3.1 Scenario without Consideration of the Damping Coefficient
  • 2.2.3.2 Scenario with Consideration of the Damping Coefficient
  • 2.2.3.3 Calculation Directly Using the Matrix Eigenvalue Function in R
  • 2.2.4 R Implementation of the Distributed Algorithm
  • 2.2.4.1 The Principle of PageRank's Distributed Algorithm
  • 2.2.4.2 R Program Simulation
  • 2.2.4.3 The Matrix Calculation Process
  • 2.3 Surfing the Stock Market with MA Model
  • 2.3.1 Moving Average
  • 2.3.2 MA Model
  • 2.3.3 Implementing MA Model in R
  • 2.3.3.1 Download Data from the Internet
  • 2.3.3.2 Implementing the Simple Candlestick Chart
  • 2.3.3.3 Customized MA Chart
  • 2.3.3.4 The Trading Strategy with One MA
  • 2.3.3.5 The Trading Strategy with Two MAs
  • 2.3.3.6 Compare the Profiting Scenarios in the Two Models
  • 2.3.3.7 The Optimization to Models
  • 2.4 Genetic Algorithms in R
  • 2.4.1 Introducing Genetic Algorithms
  • 2.4.2 Principle of Genetic Algorithms
  • 2.4.3 Genetic Algorithms in R
  • 2.4.3.1 Package mcga
  • 2.4.3.2 Package Genalg
  • SECTION II: R PROGRAMMING IN DEPTH
  • 3. The Kernel Programming in R
  • 3.1 The Advanced Toolkit pryr Which Levers the R Kernel
  • 3.1.1 Introducing pryr
  • 3.1.2 Installing pryr
  • 3.1.3 Using pryr
  • 3.1.3.1 Creating Anonymous Function : f()
  • 3.1.3.2 Creating Function through Arguments: make_function()
  • 3.1.3.3 Creating Anonymous Function Call: Partial()
  • 3.1.3.4 Substituting the Variable Expression: substitute_q(), subs()
  • 3.1.3.5 Object-Orientation Type Checking: otype(), ftype()
  • 3.1.3.6 Viewing the Underlying C Types of Objects: address(), refs(), typename()
  • 3.1.3.7 Checking whether an Object Is Modified: track_copy()
  • 3.1.3.8 View the Enclosure Function Variable: unenclose()
  • 3.1.3.9 Modifying Objects in Batch: modify_lang()
  • 3.1.3.10 Creating List Object Quickly: dots(), named dots()
  • 3.1.3.11 Finding the Eligible Functions: find_funs()
  • 3.1.3.12 Querying the Environments: where(), rls(), parenv()
  • 3.1.3.13 Printing the Calling Relationship: call_tree(), ast()
  • 3.1.3.14 Utilities for Promise Objects: uneval(), is_promise()
  • 3.1.3.15 Data Binding: %&a-%, %&c-%, %&d-%, rebind&&-
  • 3.2 Uncovering the Mystery of R Environments
  • 3.2.1 The Environments of R
  • 3.2.1.1 Creating an Environment
  • 3.2.1.2 The Hierarchy of Environments
  • 3.2.2 The Characteristics of Environments
  • 3.2.2.1 The Object Names in Each Environment Must Be Unique
  • 3.2.2.2 The Assignment of Environment Variables
  • 3.2.2.3 Defining the Environment with Higher Level
  • 3.2.2.4 The Child Environment Inherits the Variables in Its Parent Environment
  • 3.2.3 Accessing the Environments
  • 3.3 Revealing the Function Environments in R
  • 3.3.1 The Function Environments of R
  • 3.3.2 The Enclosing Environment
  • 3.3.3 The Binding Environment
  • 3.3.4 The Execution Environment
  • 3.3.5 The Calling Environment
  • 3.3.6 A Complete Set of Environment Operations
  • 3.4 Managing File System with R
  • 3.4.1 Introduction to File System
  • 3.4.2 Directory Manipulations
  • 3.4.2.1 Viewing a Directory
  • 3.4.2.2 Creating a Directory
  • 3.4.2.3 Checking if a Directory Exists
  • 3.4.2.4 Checking the Permission of a Directory
  • 3.4.2.5 Renaming a Directory
  • 3.4.2.6 Deleting a Directory
  • 3.4.2.7 Other Functions
  • 3.4.3 File Manipulations
  • 3.4.3.1 Viewing a File
  • 3.4.3.2 Creating a File
  • 3.4.3.3 Modifying the Permission of a File
  • 3.4.3.4 Renaming a File
  • 3.4.3.5 Hard Link and Soft Link
  • 3.4.3.6 Deleting a File
  • 3.4.4 Some Special Directories
  • 3.4.4.1 R.home() to View the Directories Related to R
  • 3.4.4.2 The Package Directories of R
  • 3.4.4.3 Viewing the Directory Where the Specific Package Is Stored
  • 3.5 New Features in R Version 3.1
  • 3.5.1 Introduction to the Versions of R 3.1
  • 3.5.2 The New Features of R 3.1.0 and Code Depict
  • 3.5.3 Introduction and Code Depict of the New Features of R 3.1.1
  • 4. Object-Oriented Programming
  • 4.1 Object-Oriented Programming in R
  • 4.1.1 What is the Object-Oriented Idea
  • 4.1.1.1 The Three Characteristics of OO: Encapsulation, Inheritance, and Polymorphism
  • 4.1.1.2 Is a and Has a
  • 4.1.2 Why Do We Need to Do Object-Oriented Programming in R?
  • 4.1.3 The OOP in R
  • 4.1.3.1 Implementing Encapsulation Using R
  • 4.1.3.2 Implementing Inheritance Using R
  • 4.1.3.3 Implementing Polymorphism Using R
  • 4.1.3.4 The Procedure-Oriented Programming in R
  • 4.2 The S3-Based OOP in R
  • 4.2.1 Introduction to the S3 Objects
  • 4.2.2 Creating S3 Objects
  • 4.2.2.1 Create S3 Objects through Variables
  • 4.2.2.2 Create an S3 Object with Multiple Types
  • 4.2.3 The Generic Function and the Method Calling
  • 4.2.4 View the Functions of S3 Objects
  • 4.2.5 The Inheriting Calling of S3 Objects
  • 4.2.6 The Disadvantages of S3 Objects
  • 4.2.7 Use of S3 Objects
  • 4.3 The S4-Based OOP in R
  • 4.3.1 Creating S4 Objects
  • 4.3.1.1 How to Create S4 Objects
  • 4.3.1.2 Creating S4 Object Instance
  • 4.3.1.3 Creating S4 Object with Inheritance
  • 4.3.1.4 The Default Values of S4 Objects
  • 4.3.1.5 The Type Checking of S4 Objects
  • 4.3.1.6 Creating Object from an Instantiated Object
  • 4.3.2 Accessing the Slots of S4 Objects
  • 4.3.3 The S4 Generic Functions
  • 4.3.4 Functions for Viewing S4 Objects
  • 4.3.5 Working with the S4 Objects
  • 4.4 The RC-Based OOP in R
  • 4.4.1 Introduction to the RC Object System
  • 4.4.2 Creating RC Classes and Objects
  • 4.4.2.1 How to Create RC Classes
  • 4.4.2.2 Creating RC Classes and Instances
  • 4.4.2.3 Creating an RC with Inheritance
  • 4.4.2.4 The Default Values of RC Objects
  • 4.4.3 Object Assignment
  • 4.4.4 Defining the Object Methods
  • 4.4.5 The Built-In Methods and Properties of RC Objects
  • 4.4.5.1 The Built-In Methods
  • 4.4.5.2 The Built-In Properties
  • 4.4.6 The Auxiliary Functions of RC Classes
  • 4.4.7 Working with the RC Object System
  • 4.5 The R6-Based OOP in R
  • 4.5.1 A First Look at R6
  • 4.5.2 Creating R6 Classes and Instantiating Objects
  • 4.5.2.1 How Do We Create R6 Classes?
  • 4.5.2.2 Creating R6 Classes and Instantiate Objects
  • 4.5.2.3 The Public and Private Members
  • 4.5.3 The Active Binding of R6 Classes
  • 4.5.4 The Inheritance of R6 Classes
  • 4.5.5 The Static Properties of R6 Objects
  • 4.5.6 The Portable Type of R6 Classes
  • 4.5.7 The Dynamic Binding of R6 Classes
  • 4.5.8 The Printing Function of R6 Classes
  • 4.5.9 The Storage of the Instantiated Objects
  • 4.5.10 A Case of R6 OO System
  • SECTION III: DEVELOPING R PACKAGE
  • 5. Developing R Packages
  • 5.1 Developing an R Package from Scratch
  • 5.1.1 Developing R Packages with Linux Command Line
  • 5.1.1.1 Creating the Project sayHello
  • 5.1.1.2 Building the sayHello Project
  • 5.1.1.3 Installing the sayHello Package Locally
  • 5.1.1.4 Using the Function in the sayHello Package
  • 5.1.1.5 Checking R Packages
  • 5.1.1.6 Uninstalling R Packages
  • 5.1.2 Developing R Packages in RStudio
  • 5.1.2.1 Developing R Packages in RStudio
  • 5.1.2.2 Editing the Project Description Files DESCRIPTION and NAMESPACE
  • 5.1.2.3 Editing the R Program Code R.sayHello.R
  • 5.1.2.4 Editing the Help Documentation man/sayHello.Rd
  • 5.1.2.5 Executing Build & Reload
  • 5.1.2.6 Executing the Check Operation
  • 5.2 Streamlining R Package Development
  • 5.2.1 Introducing the Development Flow
  • 5.2.2 Coding
  • 5.2.2.1 Installing the Packages: Devtool, roxygen2, and testthat
  • 5.2.2.2 Creating a Project chinaWeather
  • 5.2.2.3 Creating the Project Files
  • 5.2.3 Debugging Program
  • 5.2.4 Carrying Unit Tests
  • 5.2.5 Authoring Documentation
  • 5.2.6 Building the Project
  • 5.2.7 Publishing the Program
  • 5.3 Weather Visualization with R
  • 5.3.1 Project Introduction
  • 5.3.1.1 Project Introduction
  • 5.3.2 System Architecture Design
  • 5.3.3 R Program Implementation
  • 5.3.3.1 Data Crawling
  • 5.3.3.2 Locally Storing
  • 5.3.3.3 China Map Loading
  • 5.3.3.4 Data Visualization
  • 5.4 R Package Development: ChinaWeather
  • 5.4.1 Creating the Project
  • 5.4.2 The Static Data
  • 5.4.2.1 The WOEID Data File WOEID.rda
  • 5.4.2.2 The Map Data File chinaMap.rda
  • 5.4.2.3 The Visualization Data for Chinese/English Picture props.rda
  • 5.4.2.4 The Test Dataset weather20141001.rda
  • 5.4.3 Programming Functionalities
  • 5.4.3.1 The getData.R File
  • 5.4.3.2 The render.R File
  • 5.4.3.3 The chinaWeather.R File
  • 5.4.3.4 The chinaWeather-package.R File
  • 5.4.4 The Project Configuration Files
  • 5.4.4.1 Modifying the DESCRIPTION File
  • 5.4.4.2 Modifying the NAMESPACE File
  • 5.4.4.3 Creating the .Rbuildignore File
  • 5.4.5 Debugging the Program
  • 5.4.6 Building the Program
  • 5.4.6.1 Building the Program
  • 5.4.6.2 Checking Package with Check()
  • 5.4.6.3 Uploading to Github
  • 5.4.6.4 Installing the chinaWeatherDemo Project from Github
  • 6. Journey on R Game Development
  • 6.1 Keyboard and Mouse Events in R
  • 6.1.1 The Graphics Event in R
  • 6.1.2 The Graphics Event APIs
  • 6.1.3 The Keyboard Event
  • 6.1.4 The Mouse Events
  • 6.2 Getting Started with the Snake Game
  • 6.2.1 Introduction to the Snake Video Game
  • 6.2.2 Stage Design
  • 6.2.2.1 Requirement Analysis
  • 6.2.2.2 The Game Rules
  • 6.2.2.3 The Business Flow
  • 6.2.2.4 The Game Prototype
  • 6.2.3 Program Design
  • 6.2.3.1 The Game Stages
  • 6.2.3.2 The Game Objects
  • 6.2.3.3 The Game Events
  • 6.2.3.4 The Game Control
  • 6.2.4 The R Implementation
  • 6.3 R-Based Game Framework Design
  • 6.3.1 The Object-Oriented Modification to the Snake Game
  • 6.3.1.1 Defining the Snake Classes
  • 6.3.1.2 The Global Function Calling Sequence Diagram
  • 6.3.1.3 The Function Calling Sequence Diagram for stage1
  • 6.3.2 Defining the Game Framework
  • 6.3.3 Re-Implement the Snake Game under the Game Framework
  • 6.4 Developing the 2048 Game Using R
  • 6.4.1 Introduction to the 2048 Game
  • 6.4.2 Stage Design
  • 6.4.2.1 Requirement Analysis
  • 6.4.2.2 The Game Rules
  • 6.4.2.3 The Business Flow
  • 6.4.2.4 Prototype of the Game
  • 6.4.3 Program Design
  • 6.4.3.1 The Game Stages
  • 6.4.3.2 The Game Objects
  • 6.4.3.3 The Game Events
  • 6.4.3.4 The Game Control
  • 6.4.4 The R Implementation
  • 6.4.4.1 Number Moving Function Move()
  • 6.4.4.2 Other Functions
  • 6.5 Publishing the gridgame Package
  • 6.5.1 Knowledge Reserves
  • 6.5.1.1 The Basic Techniques
  • 6.5.1.2 Naming the R Package
  • 6.5.2 Developing the gridgame Package
  • 6.5.2.1 Creating the Project
  • 6.5.2.2 Authoring Code and Documents
  • 6.5.2.3 Debugging Program
  • 6.5.2.4 Unit Testing
  • 6.5.2.5 Authoring Documents
  • 6.5.2.6 Program Checking
  • 6.5.2.7 Program Building
  • 6.5.3 Publishing the gridgame
  • 6.5.3.1 Github: An Open-Source Publishing Repository for Individuals
  • 6.5.3.2 R-Forge: The R-Forge Publishing Repository
  • 6.5.3.3 RForge: The RForge Publishing Repository
  • 6.5.3.4 CRAN: R's Official Publishing Repository
  • Bibliography
  • Index
DNB DDC Sachgruppen

Dateiformat: ePUB
Kopierschutz: Adobe-DRM (Digital Rights Management)

Systemvoraussetzungen:

Computer (Windows; MacOS X; Linux): Installieren Sie bereits vor dem Download die kostenlose Software Adobe Digital Editions (siehe E-Book Hilfe).

Tablet/Smartphone (Android; iOS): Installieren Sie bereits vor dem Download die kostenlose App Adobe Digital Editions (siehe E-Book Hilfe).

E-Book-Reader: Bookeen, Kobo, Pocketbook, Sony, Tolino u.v.a.m. (nicht Kindle)

Das Dateiformat ePUB ist sehr gut für Romane und Sachbücher geeignet - also für "fließenden" Text ohne komplexes Layout. Bei E-Readern oder Smartphones passt sich der Zeilen- und Seitenumbruch automatisch den kleinen Displays an. Mit Adobe-DRM wird hier ein "harter" Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.

Bitte beachten Sie bei der Verwendung der Lese-Software Adobe Digital Editions: wir empfehlen Ihnen unbedingt nach Installation der Lese-Software diese mit Ihrer persönlichen Adobe-ID zu autorisieren!

Weitere Informationen finden Sie in unserer E-Book Hilfe.


Download (sofort verfügbar)

67,49 €
inkl. 7% MwSt.
Download / Einzel-Lizenz
ePUB mit Adobe-DRM
siehe Systemvoraussetzungen
E-Book bestellen