Finding errors in R

*Portuguese version of this same post here! On a daily basis, I come across people on Facebook groups, Telegram or Twitter having troubles with some tasks in R. These problems have two main origins: difficulties in constructing the algorithm to reach the desired result. difficulties in understanding the behavior of some function. The focus of this post is to give some notion about how to solve the second one: problems using functions.