2nd Edition

Learn R As a Language

By Pedro J. Aphalo Copyright 2024
    466 Pages 191 Color Illustrations
    by Chapman & Hall

    466 Pages 191 Color Illustrations
    by Chapman & Hall

    466 Pages 191 Color Illustrations
    by Chapman & Hall

    Learning a computer language like R can be either frustrating, fun or boring. Having fun requires challenges that wake up the learner’s curiosity but also provide an emotional reward for overcoming them. The book is designed so that it includes smaller and bigger challenges, in what I call playgrounds, in the hope that all readers will enjoy their path to R fluency. Fluency in the use of a language is a skill that is acquired through practice and exploration. For students and professionals in the biological sciences, humanities and many applied fields, recognizing the parallels between R and natural languages should help them feel at home with R. The approach I use is similar to that of a travel guide, encouraging exploration and describing the available alternatives and how to reach them. The intention is to guide the reader through the R landscape of 2024 and beyond.

    What is new in the second edition?

    • Text expanded by more than 25% to include additional R features and gentler and more detailed explanations
    • Contains 24 new diagrams and flowcharts, seven new tables, and revised text and code examples for clarity
    • All three indexes were expanded, and answers to 28 frequently asked questions added

    What will you find in this book?

    • Programming concepts explained as they apply to current R
    • Emphasis on the role of abstractions in programming
    • Few prescriptive rules—mostly the author’s preferences together with alternatives
    • Presentation of the R language emphasizing the “R way of doing things”
    • Tutoring for “programming in the small” using scripts for data analysis
    • Explanation of the differences between R proper and extensions for data wrangling
    • The grammar of graphics is described as a language for the construction of data visualisations
    • Examples of data exchange between R and the foreign world using common file formats
    • Coaching to become an independent R user, capable of writing original scripts and solving future challenges

    1. Using the Book to Learn R 1

    2. R: the Language and the Program

    3. Base R: “Words” and “Sentences”

    4. Base R: “Collective Nouns”

    5. Base R: “Paragraphs” and “Essays”

    6 Base R: Adding New “Words”

    7. Base R: “Verbs” and “Nouns” for Statistics

    8. R Extensions: Data Wrangling

    9. R Extensions: Grammar of Graphics

    10. Base R and Extensions: Data Sharing


    Pedro J. Aphalo is a PhD graduate from the University of Edinburgh, currently a senior lecturer at the University of Helsinki. He is a plant biologist and agriculture scientist with a passion for data, electronics, computers, and photography, in addition to plants. He has been a user of R for 28 years, who first organized an R course for MSc students 21 years ago and is the author of 14 R packages currently in CRAN.