MendeleyExportToolR6: R6 Class For A Mendeley Exporter Tool

Description Usage Format Value Fields Public Methods Private Methods Examples

Description

Rmarkdown documents use BibTeX files to include literature references. BibTeX files are ordinary text files conaining the literature reference records in a pre-defined format. BibTeX files can either be created manually, but for larger documents the manual creation and maintenance of BibTeX files becomes untractable. This can be remedied by using a reference manager such as Mendeley. Literature references can be exported automatically from Mendeley into BibTeX files. The exported BibTeX records go either to a given directory or to a specified file. The main purpose of this tool is to read the exported BibTeX file from Mendeley and collect them into a local BibTeX file.

Usage

1

Format

An object of class R6ClassGenerator of length 24.

Value

Object of R6Class to bridge the exported BibTeX references exported by Mendeley to be used in a RMarkdown document

Fields

s_men_export_dir

directory where mendeley exports its BibTeX records

s_local_bib_file

name of local BibTeX file

s_this_rmd_file

full path to current Rmarkdown source document

Public Methods

new(ps_men_export_dir, ps_local_bib_dir)

Instantiation-Constructor method

add(ps_new_ref, pb_is_rstudio_available)

Add a new reference with the key ps_new_ref

set_mendeley_export_dir(ps_men_export_dir)

Setter for s_men_export_dir

get_mendeley_export_dir()

Getter for s_men_export_dir

set_local_bib_file(ps_local_bib_file)

Setter for s_local_bib_file

get_local_bib_file()

Getter for s_local_bib_file

set_this_rmd_file(ps_this_rmd_file)

Setter for s_this_rmd_file

get_this_rmd_file()

Getter for s_this_rmd_file

Private Methods

get_bib_from_mendeley_export(ps_new_ref)

Get BibTeX record based on citation key ps_new_ref

write_local_bib(pvec_bib_new_ref)

Adding pvec_bib_new_ref BibTeX record to the local bibliography file

convert_add_to_ref(ps_new_ref)

Convert the add() statement to the Rmarkdown reference

get_rmd_ref(ps_new_ref)

Get Rmarkdown reference from citation key ps_new_ref

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# instantiate a new MendeleyExportTool object
met <- rmddochelper::MendeleyExportToolR6$new()
# setting the current rmd-file
mrmt$set_this_rmd_file(ps_this_rmd_file = ifelse(rstudioapi::isAvailable(),
                              rstudioapi::getActiveDocumentContext()$path,
                              rprojroot::thisfile()))
# check whether mendeley export dir exists
met.exists_mendeley_export_dir()
# add a new reference to the local BibTeX file
met$add("Phocas1998")

## End(Not run)

charlotte-ngs/rmddochelper documentation built on June 27, 2019, 1:22 a.m.