powered by
Adds a new row to a data frame at a specified position
add_record(.data, ..., .before = NULL, .after = NULL)
Modified data frame with the new record inserted
A data frame to which a record will be added
New record to be added (vector, list, or data frame)
Optional. Row number before which to insert the new record
Optional. Row number after which to insert the new record
df <- data.frame(x = 1:3, y = 4:6) add_record(df, c(4, 7)) add_record(df, c(4, 7), .before = 2)
Run the code above in your browser using DataLab