Programming a computer is an activity that can be very beneficial to undergraduate students in terms of improving their mental capabilities, collaborative attitudes and levels of engagement in learning. Despite the initial difficulties that typically arise when learning to program, there are several well-known strategies to overcome them, providing a very high benefit-cost ratio to most of the students. Moreover, the use of a programming language usually raises the interest of students to learn any specific concept, which has caused that many teachers around the world employ a programming language as a learning environment to treat almost every possible topic. Particularly, mathematics can be taught and learnt while using a suitable programming language. The R programming language is endowed with a wide range of capabilities that allow its use to learn different kind of concepts while programming. Therefore, complex subjects such as mathematics could be learnt with the help of this powerful programming language. In addition, since the R language provides numerous graphical functions, it could be very useful to acquire simultaneously basic plane geometry and programming knowledge at the undergraduate level. This paper describes the LearnGeom R package, a novel pedagogical tool, which contains multiple functions to learn geometry in R at different levels of difficulty, from the most basic geometric objects to high-complexity geometric constructions, while developing numerous programming skills. ‡ § © Briz-Redón Á, Serrano-Aroca Á. This is an open access article distributed under the terms of the Creative Commons Attribution License (CC BY 4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.