You are previewing R Quick Syntax Reference.
O'Reilly logo
R Quick Syntax Reference

Book Description

The R Quick Syntax Reference is a handy reference book detailing the intricacies of the R language. Not only is R a free, open-source tool, R is powerful, flexible, and has state of the art statistical techniques available. With the many details which must be correct when using any language, however, the R Quick Syntax Reference makes using R easier.

Starting with the basic structure of R, the book takes you on a journey through the terminology used in R and the syntax required to make R work. You will find looking up the correct form for an expression quick and easy. With a copy of the R Quick Syntax Reference in hand, you will find that are able to use the multitude of functions available to the R user and are even able to write your own functions to explore and analyze data.

  • Takes you through learning R, from download to statistical analysis.

  • Clears the confusion around object types and how to use and convert the types.

  • Tells you how to search for statistical techniques using the R help pages.

  • What you'll learn

  • Download R and R packages for your platform.

  • Work with R within your file structure.

  • Enter data from the keyboard and from external files.

  • Determine and assign modes, classes, and types of objects

  • Do calculations using the computational tools in R.

  • Use R functions and create new functions.

  • Who this book is for

    The R Quick Syntax Reference is for statisticians and other data analysts who are starting to use the R language. It is also for veteran R users who want a quick reference to the language. The book is an excellent choice for the busy data scientist who likes to experiment with new ways of analysis and who needs the flexibility of the data editing available in R.

    Table of Contents

    1. Title Page
    2. Dedication
    3. Contents at a Glance
    4. Contents
    5. About the Author
    6. About the Technical Reviewer
    7. Acknowledgments
    8. Introduction
    9. PART 1: R Basics
      1. CHAPTER 1: Downloading R and Setting Up a File System
        1. Downloading R
        2. Installing and Updating Packages
        3. Updating R
        4. Using R in Separate Folders
      2. CHAPTER 2: The R Prompt
        1. The Three Parts of R: Objects, Operators, and Assignments
        2. The R Prompt
        3. An Example of a Calculation
      3. CHAPTER 3: Assignments and Operators
        1. Types of Assignment
        2. Example of Three Types of Assignment
        3. The ls() and rm() Functions
        4. Operators
        5. Odds and Ends
    10. PART 2: Kinds of Objects
      1. CHAPTER 4: Modes of Objects
        1. Overview of the Modes
        2. Some Functions for Atomic Modes
        3. The Common Recursive and Language Modes
        4. The S4 Mode
      2. CHAPTER 5: Classes of Objects
        1. Some Basics on Classes
        2. Vectors
        3. Some Common Classes
        4. Names for Vectors, Matrices, Arrays, and Lists
    11. PART 3: Functions
      1. CHAPTER 6: Packaged Functions
        1. The Libraries
        2. Default Packages and Primitive Functions
        3. Using the Help Pages
      2. CHAPTER 7: User-Created Functions
        1. The Structure of a Function
        2. How to Enter a Function into R
      3. CHAPTER 8: How to Use a Function
        1. Calling a Function
        2. Arguments
        3. The Output from a Function
    12. PART 4: Inputting and Creating Data, Outputting Data and Output, and Manipulating Objects
      1. CHAPTER 9: Importing and Creating Data
        1. Reading Data into R, Including R Data Sets
        2. Probability Distributions and the Function sample()
        3. Manually Entering Data and Generating Data with Patterns
      2. CHAPTER 10: Exporting from R
        1. The Function dump()
        2. The Function sink()
        3. The Function write()
        4. The Function write.matrix()
        5. The Functions write.table() and write.csv()
        6. The Function dput()
        7. Other Exporting Functions
      3. CHAPTER 11: Descriptive Functions and Manipulating Objects
        1. Descriptive Functions
        2. Manipulating Objects
    13. PART 5: Flow Control
      1. CHAPTER 12: Flow Control
        1. Brackets “{}” and the Semicolon “;”
        2. The “if” and “if/else” Control Statements
        3. The “while” Control Statement
        4. The “for” Control Statement
        5. The “repeat” Control Statement
        6. The Statements “break” and “next”
        7. Nesting
      2. CHAPTER 13: Examples of Flow Control
        1. Nested ‘for’ Loops with an ‘if/else’ Statement
        2. A ‘while’ Loop
        3. Nested ‘for’ Loops
        4. A ‘for’ Loop, ‘if’ Statement, and ‘next’ Statement
        5. A ‘for’ Loop, a ‘repeat’ Loop, an ‘if’ Statement, and a ‘break’ Statement
      3. CHAPTER 14: The Functions ifelse() and switch()
        1. The Function ifelse()
        2. The Function switch()
    14. PART 6: Some Common Functions, Packages, and Techniques
      1. CHAPTER 15: Some Common Functions
        1. The Function options()
        2. The Functions round(), signif(), and noquote()
        3. The Function cat()
        4. The Functions format(), print(), plot(), and summary()
        5. Some Functions for Models: anova(), coef(), effects(), residuals(), fitted(), vcov(), confint(), and predict()
      2. CHAPTER 16: The Packages base, stats, and graphics
        1. The base Package
        2. The stats Package
        3. The graphics Package
      3. CHAPTER 17: Tricks of the Trade
        1. Value Substitution: NA, NaN, Inf, and -Inf
        2. If Statements and Logical Vectors
        3. Lists and the Functions list() and c()
        4. Getting Data out of Functions
        5. Recursive Functions
        6. Some Final Comments
    15. Index