## Tutorial: A crash course in R programming |

This course will cover common problems in R code, and offer techniques to make code more efficient and less prone to user error. By the end of the course, participants should be able to write *efficient *statistical software and validate existing code.

1) Overview of R | (20 minutes) | |

a) Units: Numeric, integer, character, and factor | ||

b) Data structures: Vector, matrix, array, list, and data frames | ||

c) Manipulating data structures | ||

2) Writing efficient R code | (40 minutes) | |

a) Writing (and avoiding) loops | ||

b) Vectorizing over matrices, arrays, and lists | ||

3) Writing functions | (20 minutes) | |

a) Environments | ||

b) Passing arguments and proper lexical scoping | ||

4) Making R code easy-to-use | (40 minutes) | |

a) Implementing model functions in your code | ||

b) Generic functions | ||

5) Validating statistical models | (30 minutes) | |

a) Monte Carlo simulation | ||

b) Unit tests | ||

6) Making R run fast | (30 minutes) | |

a) Profiling R code | ||

b) Calling compiled languages (C, C++, Fortran) from R |

* Disclaimer: The views expressed in this presentation are those of the presenter and must not be taken to represent policy or guidance on behalf of the Food and Drug Administration. The Food and Drug Administration does not endorse or require use of any specific software including the software mentioned in the presentation.