Thanks for the answers: I have tried all suggestions: Random Number seeds, setting up completely new environment, making sure libraries are load in the same order. But I still get different results in some calculations, others are the same.
I have for example stored the .Rmd program, load R anew, setup new project, changing working directory. Loaded the Rmd program and run it copying the code chunks to the console. This way I ensure that it is also a new environment in the console. But event then I get different results. It mostly happens with the train( function from the caret package. Is there a bug somewhere? Or maybe I have to make sure that I have installed R studio and R in the correct versions and sequence. Maybe it has to do with my Mac OS version too. I use MacOS High Sierra.
By the way I do not know what you mean with something "trivial" eg. Profile.
Sorry, I made a mistake. I meant the data set .Rprofile .
If you open a project the R statements in that data set (when present) are executed.
When you start RStudio without an open project the default (*) folder is set as working directory and if that contains an .Rprofile data set the R statements it contains are executed.
With 'trivial' I only meant that is so easy to forget that you placed some initialisation code there . That could have an impact of course.
(*) the default folder is the one set with Tools | Global Options... | General | Default working directory (when not in a project)