Learn R Programming

SciencesPo (version 1.3.9)

insert.row: Add new row to dataframe

Description

Facilitates insertion of a new row in a data.frame.

Usage

insert.row(.data, newrow, where = 1)

Arguments

.data
The existing data.frame
newrow
The new row to be appended.
where
An integer for the position to add the row, default is at the top.

Examples

Run this code
existingDF <- as.data.frame(matrix(seq(20),nrow=5,ncol=4))
existingDF
r <- 3
newrow <- seq(4)

insert.row(existingDF, newrow, r)

Run the code above in your browser using DataLab