How do I apply optim() to custom function to each row and bind some of the output as well as function-calculated variables to correct row in existing df ?

See the FAQ for how to create a minimum reproducible example using reprex. That will provide a cut-and-paste way to put everyone on a common footing and also help the poster to catch different issues that can be fixed, such as missing libraries.

1 Like