Plot works on R but not when exported with api_create

Hi, my code works perfectly in R and generates the desired scatter plot, but fails when exporting it with api_create

I get the following error:
No trace type specified:
Based on info supplied, a ‘histogram’ trace seems appropriate.
Read more about this trace type -> https://plot.ly/r/reference/#histogram

Why? How can I fix the api_create?

Hi - I’m having the same problem and wondering if you have found a solution. Thank you