The rnn R package, describing how to implement from scratch the Recurrent Neural Network algorithm) in the R language is now available on CRAN.

The rnn package can be installed simply from within R by running:


It does not have any dependencies, C++, Fortran, Java, or any other type of complexities. It is written purely in base R, so it should install without any issue on any R version.

Following installation, you can load the package using:


The package contains five HTML vignettes:

  1. Basic Recurrent Neural Network
  2. Recurrent Neural Network
  3. RNN units
  4. Sinus and Cosinus
  5. GRU units
  6. LSTM units

The suggested way to work through the vignettes in this increasing order of complexity. You can load the first vignette (after installing and loading the package as described above) using:

vignette('Basic Recurrent Neural Network')

After having worked through the vignette, you can then dive a bit deeper into the same example with Recurrent Neural Netowrk using:

vignette('Recurrent Neural Netowrk')

Wikipedia Article

You can find more information on the Wikipedia article


Development takes place on GitHub:

The development version, to be used at your peril, can be installed from GitHub using the remotes package:

if (!require('remotes')) install.packages('remotes')


You can also file any bugs reports there:

The code is based to a large extent on last week’s post: Self-rnn from Scratch in R.