My code was just meant to be a simple example. Your code will look different, I'm sure.
Just treat the R Markdown document as a self-contained script, like a normal .R script. In other words, the R Markdown should be able to run from start to end in a clean R session.
One way to manually debug your document to figure out which objects aren't properly created, open up your R Markdown file in a new R/RStudio session and try to run each code chunk one-at-a-time starting from the first code chunk and working your way down the document. Each time a code chunk fails because an object wasn't found, you will need to make sure you create that object somewhere in the document before the failed code chunk.
For example, it looks like you are using the dataset named RisposteQuestionaro_excel. You need to load this data, probably right at the beginning of the R Markdown document, so that any subsequent code chunk is able to use the data.