There are many online resources for creating efficient R code, as well as our How to Learn R article, so we will just list the key concepts:

- Avoid using
`for`

or lots of `if`

statements in your R code.
- Exploit R's vectorized calculations.
- Use
`apply`

, `sapply`

, `lapply`

, `vapply`

, `apply`

, and `aggregate`

.
- Avoid using Hadleyverse functions for general data manipulation unless you have no other option. E.g., avoid
`dplyr`

. (Much of the Hadleverse is designed for making code "easy" to read, not for making code fast.)

## Next

How to Use R in Displayr

How to Perform Mathematical Calculations Using R