d <- data.frame(ID=1:10, y=runif(10))
# insert row
insert(d, idx=2)
insert(d, value=c(20,0), idx=2)
# insert column
insert(d, MARGIN=2, idx=2)
insert(d, MARGIN = 2, value = rep(0,10), idx=2, name="x")
Run the code above in your browser using DataLab