% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/read-biblio.R
\name{read_biblio}
\alias{read_biblio}
\title{Read bibliometric data}
\usage{
read_biblio(path, format = "auto", id = NULL, actors = NULL, sep = ";", ...)
}
\arguments{
\item{path}{Character. Path to a file, a vector of file paths, or a
directory containing export files.}

\item{format}{Character. File format:
\describe{
\item{\code{"auto"}}{Default. Auto-detect from file content.}
\item{\code{"scopus"}}{Scopus CSV.}
\item{\code{"wos"}}{Web of Science plaintext.}
\item{\code{"wos_tab"}}{Web of Science tab-delimited.}
\item{\code{"bibtex"}}{BibTeX .bib file.}
\item{\code{"ris"}}{RIS file.}
\item{\code{"dimensions"}}{Dimensions CSV.}
\item{\code{"lens"}}{Lens.org CSV.}
\item{\code{"openalex_csv"}}{Flat OpenAlex CSV export (pipe-delimited fields).}
\item{\code{"generic"}}{Any CSV. Use \code{id} and \code{actors} to specify columns.}
}}

\item{id}{Character. Column name for document identifier. Only used
when \code{format = "generic"}. Default \code{NULL} (uses row numbers).}

\item{actors}{Character vector. Column names to split into list-columns.
Only used when \code{format = "generic"}.}

\item{sep}{Character. Delimiter for splitting actor columns. Default \code{";"}.}

\item{...}{Additional arguments passed to the format-specific reader.}
}
\value{
A data frame.
}
\description{
Universal reader that handles files, folders, format detection, and
generic CSV input. Accepts a single file, multiple files, or a directory.
}
\examples{
# Auto-detect format from file content (here: a bundled OpenAlex CSV)
f <- system.file("extdata", "openalex_works.csv", package = "bibnets")
data <- read_biblio(f)
head(data[, c("id", "title", "year", "journal")])

# Read multiple files at once; auto-detects each format
f_scopus <- system.file("extdata", "scopus_sample.csv", package = "bibnets")
f_wos    <- system.file("extdata", "wos_sample.txt",  package = "bibnets")
combined <- read_biblio(c(f_scopus, f_wos))
head(combined[, c("id", "title", "year", "journal")])

# Read every supported export in a directory (here: the bundled extdata)
folder <- system.file("extdata", package = "bibnets")
all_data <- read_biblio(folder)
nrow(all_data)

# Generic CSV: point read_biblio at any CSV and name the list-column fields
tmp <- tempfile(fileext = ".csv")
write.csv(data.frame(
  doc_id  = c("a", "b"),
  Authors = c("Smith J; Jones A", "Davis M"),
  Keywords = c("networks; bibliometrics", "analytics")
), tmp, row.names = FALSE)
generic <- read_biblio(tmp, format = "generic",
                       id = "doc_id",
                       actors = c("Authors", "Keywords"),
                       sep = ";")
head(generic)
}
