% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/read-crossref.R
\name{read_crossref}
\alias{read_crossref}
\title{Convert Crossref API data to bibnets format}
\usage{
read_crossref(data)
}
\arguments{
\item{data}{A data frame from \code{cr_works(...)$data}.}
}
\value{
A data frame in the standard bibnets format: \code{id}, \code{title},
\code{year}, \code{journal}, \code{doi}, \code{cited_by_count}, \code{abstract}, \code{type},
plus list-columns \code{authors}, \code{references}, and \code{keywords}.
}
\description{
Takes the output of \code{rcrossref::cr_works()} (the \verb{$data} tibble/data frame)
and converts it to the standardized bibnets format.
}
\examples{
# Construct a minimal data frame matching the structure of
# rcrossref::cr_works(...)$data. In practice, pass that data frame directly.
raw <- data.frame(
  doi = c("10.1/a", "10.2/b"),
  title = c("First paper", "Second paper"),
  issued = c("2022-01-01", "2021-06-15"),
  container.title = c("Journal A", "Journal B"),
  is.referenced.by.count = c("3", "9"),
  type = c("journal-article", "journal-article"),
  stringsAsFactors = FALSE
)
raw$author <- list(
  data.frame(given = c("Jane", "Anne"),
             family = c("Smith", "Jones"),
             stringsAsFactors = FALSE),
  data.frame(given = "Mark", family = "Davis", stringsAsFactors = FALSE)
)
data <- read_crossref(raw)
head(data[, c("id", "title", "year", "journal")])
}
