Learn R Programming

rowr (version 1.1.3)

insertRows: Inserts a matrix into another matrix.

Description

Inserts a matrix or data frame into another matrix or data frame. The new rows are placed together at the row index specified.

Usage

insertRows(existing, insert, r)

Arguments

existing
table to insert into
insert
rows to insert
r
index at which to insert

Examples

Run this code
df1<-data.frame(a=c(1,2,3),b=c(1,2,3),c=c(1,2,3))
insertRows(df1,data.frame(list('a','a','a')),5)
insertRows(df1,data.frame(list('a','a','a')),4)
insertRows(df1,data.frame(list('a','a','a')),3)
insertRows(df1,data.frame(list('a','a','a')),2)
insertRows(df1,data.frame(list('a','a','a')),1)
insertRows(df1,df1,3)

Run the code above in your browser using DataLab