bubble chart - bubbles won't adjust

Dear all,
I am struggling with the bubble chart. I wanted to use a third variable (total_allegations) to impact the size of the bubble.
My code is the following:

p <- plot_ly(sample, x = ~year, y = ~MktCap, type = 'scatter', mode = 'markers',
marker = list(size = ~total_allegations))%>%
layout(title = 'Total number of allegations',
xaxis = list(showgrid = FALSE),
yaxis = list(showgrid = FALSE),
showlegend = FALSE)
print(p)

Hi,

Please provide us with some sample data and all code needed to generate the plot as it is now. This way we can take a much more in depth look at the issue.

Grtz