insert_row | R Documentation |
Insert a new row into a data frame
insert_row(df, newrow, r)
df |
a data frame |
newrow |
new row to insert, must have same columns as df |
r |
row index indicating where new row will be inserted |
Returns a data frame with an extra row inserted at specified index
# example dataframe d <- as.data.frame(matrix(seq(20), nrow=5, ncol=4)) # row number that you want to insert r <- 3 # create a new row to insert newrow <- seq(4) # can be a subset of original dataframe newrow2 <- d[1, ] # insert row insert_row(d, newrow, r) insert_row(d, newrow2, r)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.