I have this problem for more than a year and still haven't found a solution. Every time I try to knit my Rmd
file into HTML/PDF/Word, it would say 'Error: could not find function "Sys.setevn"Execution halted'. I have tried to install and uninstall R, and changed the code in Rmd, but I still can't get rid of this problem. Any help would be hugely appreciated!
Have you tried resetting RStudio's state? Assuming you reproduced the error message verbatim, it would appear that some script somewhere has a typo, misspelling Sys.setenv as Sys.setevn. Resetting RStudio's state might (or might not) get rid of whatever contains the typo.