Chapter 1. Functions in R

This chapter covers the following topics:

  • Creating R functions
  • Matching arguments
  • Understanding environments
  • Working with lexical scope
  • Understanding closure
  • Performing lazy evaluation
  • Creating infix operators
  • Using the replacement function
  • Handling errors in a function
  • The debugging function

Introduction

R is the mainstream programming language of choice for data scientists. According to polls conducted by KDnuggets, a leading data analysis website, R ranked as the most popular language for analytics, data mining, and data science in the three most recent surveys (2012 to 2014). For many data scientists, R is more than just a programming language because the software also provides an interactive environment that can perform all ...

Get R for Data Science Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.