Create Many Traces: Translating Python Loop to R

I am trying to figure out how to create many separate traces at once in R Plotly like I can do in Python.

Here is a working Python example which works well in many situations:

import pandas as pd
import plotly
import plotly.graph_objs as go

mtcars = pd.read_csv('')

container = []
for i, j in mtcars.groupby('model'):
trace = (go.Scatter(x=j.carb, y=j.mpg, showlegend=True, 
                    name = i))

fig = dict(data=container)
plotly.offline.plot(fig, validate=False) # offline plotting

My attempt in R is not producing the same results;

mtcars = read.csv('')

p <- plot_ly(type = 'scatter', mode = 'markers')
for(i in unique(mtcars$model)) {
    p <- add_trace(p, x = ~mtcars$carb, y = ~mtcars$mpg, name = ~mtcars$model)

TLDR: Looking to generate many independent traces akin to Python in R