Inserts a matrix into another matrix.

Share:

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

1
insertRows(existing, insert, r)

Arguments

existing

table to insert into

insert

rows to insert

r

index at which to insert

Examples

1
2
3
4
5
6
7
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)