Sys.setenv(PATH=paste(Sys.getenv("PATH"),"/Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin",sep=":")). That fixed the problem and now the build function can turn the .Rnw files into PDF documents in Studio but after closing RStudio I have to change this path again. Maybe anyone knows how to change this path permanently?
I will be very grateful for any help.
Best, Joanna
ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin /Library/TeX/texbin