Error in optim() (list) object cannot be coerced to type 'double'

https://stackoverflow.com/questions/58260818/error-in-optim-list-object-cannot-be-coerced-to-type-double