Here's the information in base R:
myby <- by(df$id,df$brand,function(x)paste(x,collapse=","))
The formatting of "by" objects is weird. You can take data.frame(id=c(myby))
and the brands will become rownames:
# id
# RadioShack 2308
# Rag & Bone 4466
# Ragu 1830,4518
# Ralph Lauren 1638,2719,2720,2721,2722
Alternately, if you load the data.table
package, this will work:
dt <- data.table(df)
dt[,paste(id,collapse=","),by=brand]
# brand V1
# 1: RadioShack 2308
# 2: Rag & Bone 4466
# 3: Ragu 1830,4518
# 4: Ralph Lauren 1638,2719,2720,2721,2722