InsertRow {DataCombine} | R Documentation |
Inserts a new row into a data frame
Description
Inserts a new row into a data frame
Usage
InsertRow(data, NewRow, RowNum = NULL)
Arguments
data |
a data frame to insert the new row into. |
NewRow |
a vector whose length is the same as the number of columns in
|
RowNum |
numeric indicating which row to insert the new row as. If not
specified then the new row is added to the end using a vanilla
|
Source
The function largely implements: http://stackoverflow.com/a/11562428
Examples
# Create dummy data
A <- B <- C <- D <- sample(1:20, size = 20, replace = TRUE)
Data <- data.frame(A, B, C, D)
# Create new row
New <- rep(1000, 4)
# Insert into 4th row
Data <- InsertRow(Data, NewRow = New, RowNum = 4)
[Package DataCombine version 0.2.21 Index]