Advanced R, Second Edition: 2nd Edition (Paperback) book cover

Advanced R, Second Edition

2nd Edition

By Hadley Wickham

Chapman and Hall/CRC

604 pages

Purchasing Options:$ = USD
Paperback: 9780815384571
pub: 2019-06-26
SAVE ~$8.99
Available for pre-order
$59.95
$50.96
x
Hardback: 9780367255374
pub: 2019-06-26
SAVE ~$29.25
Available for pre-order
$195.00
$165.75
x


FREE Standard Shipping!

Description

Advanced R presents useful tools and techniques for attacking many types of R programming problems, helping you avoid mistakes and dead ends. With more than ten years of experience programming in R, the author illustrates the elegance, beauty, and flexibility at the heart of R. The book develops the necessary skills to produce quality code that can be used in a variety of circumstances. You will learn: The fundamentals of R, including standard data types and functions Functional programming as a useful framework for solving wide classes of problems The positives and negatives of metaprogramming How to write fast, memory-efficient code

Table of Contents

Introduction

Why R?

Who should read this book

What you will get out of this book

What you will not learn

Meta-techniques

Recommended reading

Getting help

Acknowledgments

Conventions

Colophon

I Foundations

Introduction

Names and values

Introduction

Binding basics

Copy-on-modify

Object size

Modify-in-place

Unbinding and the garbage collector

Answers

Vectors

Introduction

Atomic vectors

Attributes

S atomic vectors

Lists

Data frames and tibbles

NULL

Answers

Subsetting

Introduction

Selecting multiple elements

Selecting a single element

Subsetting and assignment

Applications

Answers

Control flow

Introduction

Choices

Loops

Answers

Functions

Introduction

Function fundamentals

Function composition

Lexical scoping

Lazy evaluation

(dot-dot-dot)

Exiting a function

Function forms

Quiz answers

Environments

Introduction

Environment basics

Recursing over environments

Special environments

The call stack

As data structures

Quiz answers

Conditions

Introduction

Signalling conditions

Ignoring conditions

Handling conditions

Custom conditions

Applications

Quiz answers

II Functional programming

Introduction

Functionals

Introduction

My first functional: map()

Purrr style

Map variants

Reduce

Predicate functionals

Base functionals

Function factories

Introduction

Factory fundamentals

Graphical factories

Statistical factories

Function factories + functionals

Function operators

Introduction

Existing function operators

Case study: creating your own function operators

III Object oriented programming

Introduction

Base types

Introduction

Base vs OO objects

Base types

S3

Introduction

Basics

Classes

Generics and methods

Object styles

Inheritance

Dispatch details

R6

Introduction

Classes and methods

Controlling access

Reference semantics

Why R?

S4

Introduction

Basics

Classes

Generics and methods

Method dispatch

S and S

Trade-offs

Introduction

S vs S

R vs S

IV Metaprogramming

Introduction

Big picture

Introduction

Code is data

Code is a tree

Code can generate code

Evaluation runs code

Customising evaluation with functions

Customising evaluation with data

Quosures

Expressions

Introduction

Abstract syntax trees

Expressions

Parsing and grammar

Walking the AST with recursive functions

Specialised data structures

Quasiquotation

Introduction

Motivation

Quoting

Unquoting

Non-quoting

Dot-dot-dot ()

Case studies

History

Evaluation

Introduction

Evaluation basics

Quosures

Data masks

Using tidy evaluation

Base evaluation

Translating R code

Introduction

HTML

LaTeX

V Techniques

Introduction

Debugging

Introduction

Overall approach

Locate the error

The interactive debugger

Non-interactive debugging

Non-error failures

Measuring performance

Introduction

Profiling

Microbenchmarking

Improving performance

Introduction

Code organisation

Check for existing solutions

Do as little as possible

Vectorise

Avoid copies

Case study: t-test

Other techniques

Rewriting R code in C++

Introduction

Getting started with C++

Other classes

Missing values

The STL

Case studies

Using Rcpp in a package

Learning more

Acknowledgments

About the Author

Hadley Wickham

About the Series

Chapman & Hall/CRC The R Series

Learn more…

Subject Categories

BISAC Subject Codes/Headings:
MAT029000
MATHEMATICS / Probability & Statistics / General