APPENDIX B

image

Basic Programming with R

As well being a statistical computing environment, R is also a programming language. The topic of R programming is beyond the scope of this book. However, this chapter gives a brief introduction to basic programming and writing your own functions.

When programming, use a script file so that you can edit your code easily. Remember to add plenty of comments with the hash symbol (#), so that your script can be understood by others or by yourself at a later date.

Creating New Functions

Throughout this book, you will have used many of R’s built-in functions, but it is also possible to create your own. Creating your ...

Get Using R for Statistics 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.