You can also do something like this
do.call(rbind,lapply(9:10, function(x,d) data.frame(d, c=x), d=df))) # or using rbindlist as a fast alternative to do.call(rbind,list) library(data.table) rbindlist(lapply(9:10, function(x,d) data.frame(d, c=x), d=df)))
or
rbindlist(Map(data.frame, c = 9:10, MoreArgs = list(a= 1:3,b=5:7)))
source share