Artificial hydrocarbon networks (AHN) is a novel supervised learning method inspired on the structure and the inner chemical mechanisms of organic compounds. As any other cutting-edge algorithm, there are two challenges to be faced: time-consuming for encoding and complications to connect with other technologies. Large and open source platforms have proved to be an alternative solution to the latter challenges. In that sense, this paper aims to introduce the ahnr package for R that implements AHN. It provides several functions to create, train, test and visualize AHN. It also includes conventional functions to easily interact with the trained models. For illustration purposes, it presents several examples about the applications of AHN in engineering, as well as, the way to use it. This package is intended to be very useful for scientists and applied researchers interested in machine learning and data modeling. Package availability is in the Comprehensive R Archive Network.