write_bibliography: Export Research form a bibliography

Description Usage Arguments Value Examples

View source: R/write_bibliography.R

Description

This function store in a file a bibliography of class bibliography-class both in RIS and BibTeX file-format.,Moreover, it includes an option to split the bibliography in multiple files accordingly to an user-defined number of records to write in each file.

Usage

1
2
3
4
5
6
7
write_bibliography(
  bib,
  file_type = c("ris", "bib"),
  out_dir = here::here(),
  base_name = "exported",
  max_each_file = length(bib)
)

Arguments

bib

an object of class bibliography-class

file_type

(character vector of length 1) Format of the exported file. Should be either "ris" (default) or "bib"

out_dir

(character vector of length 1): path for the directory in which to store the output (default is the current/project one)

base_name

(character vector of length 1): base name (w/o extension) for the output file(s)

max_each_file

Integer (>=1) number of record to store and write into each file. Default is length(bib), which means that a single file will be written including all the records in the bibliography.

Value

invisibly TRUE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
    # This save the (short) set of results in the current project
    # directory as a RIS file.
    biblio_short <- search_on_pubmed(
        "(machine learning) AND lanera[Author]"
    )
    write_bibliography(biblio_short)
    write_bibliography(biblio_short, file_type = "bib")
#'
    # Big ammount of reults here (we retain only a few).
    ml_reduced <- search_on_pubmed("machine learning",
        max_to_get = 50
    )

    # Write some RIS files, each with a limited pre-defined ammount
    # of record, and save them in a specific folder.
    write_bibliography(ml_reduced,
        out_dir = "multiple",
        max_each_file = 25
    )

    # Or save them all into a single file (default)
    write_bibliography(ml_reduced, out_dir = "single")

## End(Not run)

CorradoLanera/bibsearch documentation built on Jan. 1, 2020, 10:24 p.m.