I've been trying to run several hydrological models for my dissertation. Previously I had completed one model to an acceptable standard. Once I had finished that model I saved the code and shut R down for the night. The next morning I opened R and the ran the exact same code with the exact same input data and got a completely different result.
Does anyone know what has gone wrong here? I've been working on this code for weeks now but I haven't been getting the results I need... and I believe this problem is why. Any input would be appreciated.
One possibility springs to mind: if you have any code which uses random numbers, e.g. sample(), then you will get a different set of numbers each time the model is run unless you use set.seed().
Thanks for the reply. I don't use any random numbers in my code. Each time I run the code I get the same result. In fact, sometimes I try to change my input data and still get the same result as I did with the previous data. At this stage I don't know what to think. I am certain that I'm using the right files as well.
This could happen for a lot of reasons, most likely related with keeping old data in your environment while doing EDA and modeling. It's hard to know for sure without a reproducible example.
Could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.