Black Lives Matter. Please consider donating to Black Girls Code today.

R: How to update style of lines without redrawing (local)

I am trying to locally draw dozens of lines in a shiny app. After the lines are drawn, I would like to be able to change their styles without redrawing?

In the example below, for simplicity, there are only 6 traces (lines). I would like to change the opacity of the first and third lines only, without redrawing anything :

plot_ly(mtcars, x=mpg, y=wt, group=carb)
style(p = last_plot(), opacity=0.1) #Only modifies first line & complains : You’ve referenced non-existent traces
style(p = last_plot(), opacity=0.1, traces = 3) #Does not work at all
Warning: You’ve referenced non-existent traces
Error in p$data[[max(traces)]] : subscript out of bounds

How to use style()
I searched a lot but could not find any documentation
thanks for your help