add_batch_record | R Documentation |
Adds one or more records to a literature matrix at a specified position. Records can be provided as lists or data frames, and can be inserted before or after specific rows.
add_batch_record(.data, ..., .before = NULL, .after = NULL)
.data |
A data frame to which records will be added |
... |
One or more records to add. Each record can be either:
|
.before |
Row number before which to insert the new records. If NULL (default), and '.after' is also NULL, records are appended to the end. |
.after |
Row number after which to insert the new records. If NULL (default), and '.before' is also NULL, records are appended to the end. |
A data frame with the new records added at the specified position
# Create sample data frame
df <- data.frame(
name = c("John", "Jane"),
age = c(25, 30)
)
# Add a single record as a list
df <- add_batch_record(df, list(name = "Bob", age = 35))
# Add multiple records as data frames
new_records <- data.frame(
name = c("Alice", "Charlie"),
age = c(28, 40)
)
df <- add_batch_record(df, new_records, .before = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.