This is the only advanced programming book on R, the enormously successful open-source system based on the S language. It is written by John Chambers, the author of the S language from which R evolved. R's international support and the thousands of packages and other contributions have made it the standard for statistical computing in research and teaching. This book guides the reader through programming with R, beginning with simple interactive use and progressing by gradual stages, starting with simple functions. More advanced programming techniques can be added as needed, allowing users to grow into software contributors, benefiting their careers and the community. R packages provide a powerful mechanism for contributions to be organized and communicated.