Different predictions with forecast::auto.arima()
This is definitely a statistics question still so not on topic here... as
changing the data is exactly the kind of thing that can have this effect. I'm sorry. I disagree. This is a question about reproducible code. So, I don't see why it should be considered off topic.
The function returned a (2,1,0) model with drift. However when I used the same function it returns a (1,1,0) model. There were no obvious
differences
in the code. The only thing passed to it was the data. How might this happen?
Either a different version of R, a difference in the forecast package, a difference in one of it's imports (which there are many), or different input. If you're sure the input is the same, then it must be one of the other reasons. I suggest reading the documentation for the relevant forecast package functions. The auto.arima() function alone has many arguments. Changing their values may produce a more desirable model.