Convenience wrapper: maps a corpus to CSL JSON with corpus_to_csljson()
(in a temporary directory, removed afterwards) and imports it into the
library selected in Zotero with csljson_to_zotero(). See there for
re-exports (existing), tags, collections and the import speed.
Arguments
- project_dir
Optional path to the project directory, used for the default of
corpus.- corpus
Path to parquet dataset, Arrow Dataset/Table or data.frame/tibble of works. Default
file.path(project_dir, "parquet").- existing
"skip"(default),"update"or"overwrite": what to do with works already in the Zotero library. Seecsljson_to_zotero().Tags to write, by OpenAlex ID (see "Tags" in
csljson_to_zotero()): a data.frame, a parquet path, orNULLfor none. Default:<project_dir>/zotero_tags.parquet(written byzotero_tags()) if it exists, elseNULL.- collection
Path of the Zotero collection to export into. Default:
c(<name of project_dir>, <name of corpus>), leaving out what has no name (a corpus given as a data.frame);.parquetis dropped from the corpus name.NULLputs the works only into what is selected in Zotero.- chunk_size
Works per file sent to Zotero. Default
1000, which gives progress per 1000 works and stays well withintimeout.- ...
Further arguments to
csljson_to_zotero()(method,url,api_key,timeout).
Value
Invisibly, the data.frame returned by csljson_to_zotero(), one
row per chunk.
Details
By default the works go into their own nested collection, named after the
project directory and the corpus (<project> > <corpus>), so an
accidental export is easy to find and delete. Select the library itself in
Zotero (not a collection) before exporting.
Examples
if (FALSE) { # \dontrun{
# In Zotero, select the target library or collection first.
res <- corpus_to_zotero("my_project")
subset(res, !ok)
} # }