insertRows: Inserts a matrix into another matrix.

View source: R/row.r

insertRowsR Documentation

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

Details

Originally written for the row.r package by Craig Varrichio. Included here because the rowr package was discontinued. I use these functions in my packages

Examples

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)

ccpluncw/ccpl_R_chutils documentation built on Feb. 28, 2024, 1:17 a.m.