| Title: | Journal of Statistical Software Utilities |
|---|---|
| Description: | R functions and tools for computations on the LaTeX/BibTeX source code of manuscripts for the Journal of Statistical Software (<https://www.jstatsoft.org/>). |
| Authors: | Achim Zeileis [aut, cre], Bettina GrĂ¼n [aut], R Core Team [ctb] (utils::as.person, tools::toTitleCase) |
| Maintainer: | Achim Zeileis <[email protected]> |
| License: | GPL-2 | GPL-3 |
| Version: | 0.3-0 |
| Built: | 2026-10-21 22:56:27 UTC |
| Source: | https://codeberg.org/zeileis/jss |
Generic function and method for coercion to objects
of class "bibentry".
as.bibentry(x, ...) ## S3 method for class 'jss' as.bibentry(x, keytype = c("number", "author"), doi = TRUE, url = !doi, ...)as.bibentry(x, ...) ## S3 method for class 'jss' as.bibentry(x, keytype = c("number", "author"), doi = TRUE, url = !doi, ...)
x |
an object (of class |
keytype |
character specifying which type of bib key should be generated. |
doi |
logical. Should the DOI be included in the bibentry? |
url |
logical. Should the URL be included in the bibentry? |
... |
arguments passed to methods. |
Currently only a method for objects of class "jss" is provided.
An object of class "bibentry".
Utilities for processing BibTeX files, adding DOIs etc., especially for publications in the Journal of Statistical Software.
fix_bib(x = NULL, file = x, orig = "_orig.bib", bibtool = TRUE, doi = TRUE, shortcites = TRUE, escape = TRUE) bibtool(tex = NULL, orig = "_orig.bib") shortcites(x, maxlength = 6) get_doi(x, minscore = 1.5, type = NULL) add_doi(x, file = "out.bib", minscore = 1.5) read_bib(file, ...)fix_bib(x = NULL, file = x, orig = "_orig.bib", bibtool = TRUE, doi = TRUE, shortcites = TRUE, escape = TRUE) bibtool(tex = NULL, orig = "_orig.bib") shortcites(x, maxlength = 6) get_doi(x, minscore = 1.5, type = NULL) add_doi(x, file = "out.bib", minscore = 1.5) read_bib(file, ...)
x |
character or bibentry object. If |
file |
character for output BibTeX file name. |
orig |
character with file name for copy of the original BibTeX file (if any). |
bibtool |
logical. Should |
doi |
logical. Should DOIs be added using |
shortcites |
logical. Should bibentries with a long author list be reported in a shortcites statement? |
escape |
logical or character. Should encoded text (non-ASCII, e.g., for
accent and umlaut characters) be preserved in BibTeX output ( |
tex |
character specifying the input LaTeX file. |
maxlength |
numeric. Maximum number of authors for a normal cite (that does not have to be shortened). |
minscore |
numeric. Minimum score that needs to be achieved when querying a DOI. |
type |
character. The reference type (e.g., |
... |
further arguments passed to |
The fix_bib function is a utility to automatically bring a .bib
file almost into JSS style. By default, it proceeds by reading a .bib file
using read.bib, omitting unused entries using
bibtool, modifying author names, titles, journals, etc. if necessary,
adding DOIs for articles and books using cr_works,
and writing the result again to the same .bib file.
Some steps can be switched off by setting the corresponding arguments. Standalone functions for these steps are also provided.
fix_bib and add_doi return an object of class "bibentry"
(invisibly if an output file is specified).
bibtool returns a logical, only indicating whether the file renaming worked.
shortcites and get_doi return character vectors with BibTeX keys
and DOIs, respectively.
bibfile <- system.file("bib", "example.bib", package = "jss") if(require("bibtex")) { ## read BibTeX entry as currently stored bde1 <- read.bib(bibfile) print(bde1) toBibtex(bde1) ## fix BibTeX entry ## - but do not overwrite file ## - running bibtool is not necessary (and also not possible as there is no .tex file) ## - querying the DOI is switched off (just to save processing time in this example) bde2 <- fix_bib(bibfile, file = FALSE, bibtool = FALSE, doi = FALSE) print(bde2) toBibtex(bde2) ## This has ## - a capitalized title, ## - correctly spaces the middle initials, ## - unifies the TAS journal name, ## - and the DOI could be added by setting doi = TRUE or manually queried via ## get_doi(bde2) ## cleanup file.remove("_orig.bib") }bibfile <- system.file("bib", "example.bib", package = "jss") if(require("bibtex")) { ## read BibTeX entry as currently stored bde1 <- read.bib(bibfile) print(bde1) toBibtex(bde1) ## fix BibTeX entry ## - but do not overwrite file ## - running bibtool is not necessary (and also not possible as there is no .tex file) ## - querying the DOI is switched off (just to save processing time in this example) bde2 <- fix_bib(bibfile, file = FALSE, bibtool = FALSE, doi = FALSE) print(bde2) toBibtex(bde2) ## This has ## - a capitalized title, ## - correctly spaces the middle initials, ## - unifies the TAS journal name, ## - and the DOI could be added by setting doi = TRUE or manually queried via ## get_doi(bde2) ## cleanup file.remove("_orig.bib") }
The function fix_rscript is just a simple convenience
interface to tidy_source, using certain
argument settings. The code_lines function is a small
utility for counting lines after removing comments and empty lines.
fix_rscript(file = NULL) code_lines(path = ".", comment = "#")fix_rscript(file = NULL) code_lines(path = ".", comment = "#")
file |
character. The .R script that should be fixed,
by default |
path |
character specifying a directory with .R files. |
comment |
character for beginning comments. |
Query https://orcid.org in order to obtain orcidlinks for all authors in a JSS paper.
get_orcidlink(person = NULL, rows = 1L, verbose = TRUE, ...)get_orcidlink(person = NULL, rows = 1L, verbose = TRUE, ...)
person |
character, |
rows |
integer. The number of search results for each author. |
verbose |
logical. Should results be printed to the screen
and the ORCID URL opened in the browser? If set to |
... |
further arguments passed to |
The get_orcidlink function is a utility to automatically search
possible ORCID links for each author in a JSS paper. By default it reads
the first LaTeX file in the current directory (assuming it is in JSS style),
extracts the author names, and then uses orcid to
query https://orcid.org/ for their possible ORCIDs.
All search results should be checked carefully because the chance to obtain an erroneous ORCID result is quite high if an author does not have an ORCID.
For authentication see the rorcid package.
An easy option is to run orcid_auth once
and put the resulting UUID string into your .Rprofile as
options(orcid_token = "...").
get_orcidlink returns a character matrix with the author names,
ORCID links in LaTeX format, and ORCID URLs. The matrix is returned
invisible if verbose = TRUE (the default).
## Not run: get_orcidlink("Achim Zeileis") ## End(Not run)## Not run: get_orcidlink("Achim Zeileis") ## End(Not run)
Utilities for processing the metainformation of (forthcoming) publications in the Journal of Statistical Software (JSS).
jss(dir = ".") ## S3 method for class 'jss' format(x, style = "BibTeX", ...) ## S3 method for class 'jss' as.character(x, ...)jss(dir = ".") ## S3 method for class 'jss' format(x, style = "BibTeX", ...) ## S3 method for class 'jss' as.character(x, ...)
dir |
character specifying the directory to a JSS publication along with supplementary files (if any). |
x |
an object of class |
style |
character specifying the style of string that should be generated (BibTeX, CITATION, or README). |
... |
arguments passed to other functions. |
The function jss sets up a list with information about the
publication and corresponding supplementary files. The resulting
object of class jss can then be formatted or coerced into
different formats.
jss returns an object of class "jss", i.e., a list with components as follows.
key |
character vector with two possible styles of bib keys, |
author |
character vector with LaTeX-style formatted authors, |
person |
person vector of authors, |
title |
character with simple text title, |
textitle |
character with LaTeX-formatted title (including proglang, pkg, etc.), |
plaintitle |
character with plain LaTeX-formatted title (without proglang, pkg, etc.), |
journal |
character with journal/section, |
year |
year of publication, |
month |
month of publication, |
volume |
volume, |
number |
issue, |
pages |
number of pages, |
url |
JSS URL, |
doi |
DOI, |
type |
type of publication (article, code snippet, book review, or software review), |
directory |
character with path to all files, |
package |
name of package(s) associated with the publication, |
rpackage |
logical indicating whether the publication is associated with an R package, |
readme |
character with path to |
rscript |
character with path to |
Utility functions for generating JSS's BibTeX style file (bst), LaTeX class file (cls), or a zipped archive with both files, manual, templates, logo, and further instructions.
make_jss_bst(dir = ".") make_jss_cls(dir = ".", pdf = FALSE) make_jss_style(dir = ".")make_jss_bst(dir = ".") make_jss_cls(dir = ".", pdf = FALSE) make_jss_style(dir = ".")
dir |
character specifying the output directory. |
pdf |
logical. Should the PDF documentation for the .cls file be generated as well? |
Write selected elements of the metainformation from jss
objects into text files.
make_metainfo(x = ".", ...) make_citation(x = ".", ...) make_readme(x = ".", ...) make_crossref(x = ".", ..., deposit = TRUE) make_ojs(x = ".", ...) make_ojs2(x = ".", ...) make_ojs3(x = ".", ...) make_socialmedia(x = ".", density = 300, ...)make_metainfo(x = ".", ...) make_citation(x = ".", ...) make_readme(x = ".", ...) make_crossref(x = ".", ..., deposit = TRUE) make_ojs(x = ".", ...) make_ojs2(x = ".", ...) make_ojs3(x = ".", ...) make_socialmedia(x = ".", density = 300, ...)
x |
an object of class |
... |
arguments passed to |
deposit |
logical. Should the metainformation be deposited with Crossref? |
density |
numeric. Resolution for rendering PDF to PNG. |
make_citation generates a CITATION file for inclusion in R packages.
make_readme generates a README.txt file for internal use in JSS.
make_metainfo generates both files and also tries to clean up and compact
the manuscript LaTeX files.
make_crossref generates a CROSSREF.xml file for registering DOIs
with CrossRef. If $HOME/.crossref exists and contains two lines (with login id
and password, respectively), the XML is deposited automatically via curl.
make_ojs2 and make_ojs3 generate OJS.xml files for importing a new submission
into OJS version 2 and 3, respectively. make_ojs creates an agnostic OJS.txt file.