add_batch_record: Add Multiple Records to a literature matrix

View source: R/batch.R

add_batch_recordR Documentation

Add Multiple Records to a literature matrix

Description

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.

Usage

add_batch_record(.data, ..., .before = NULL, .after = NULL)

Arguments

.data

A data frame to which records will be added

...

One or more records to add. Each record can be either:

  • A list with the same length as the number of columns in '.data'

  • A data frame with the same column structure as '.data'

.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.

Value

A data frame with the new records added at the specified position

Examples


# 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)


matriz documentation built on April 3, 2025, 7:22 p.m.