Problem function

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

In the spirit of the above guide, why not begin with imagining you have a simpler problem, like data that has smaller dimensions, something tangible like 3 cols by 3 rows. (as opposed to 500 x 751)