Package 'jss'

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

Help Index


Coercion to Bibentry Objects

Description

Generic function and method for coercion to objects of class "bibentry".

Usage

as.bibentry(x, ...)

## S3 method for class 'jss'
as.bibentry(x, keytype = c("number", "author"), doi = TRUE, url = !doi, ...)

Arguments

x

an object (of class "jss").

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.

Details

Currently only a method for objects of class "jss" is provided.

Value

An object of class "bibentry".

See Also

jss, bibentry


Fix BibTeX Files According to JSS Style Guidelines

Description

Utilities for processing BibTeX files, adding DOIs etc., especially for publications in the Journal of Statistical Software.

Usage

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, ...)

Arguments

x

character or bibentry object. If NULL the first BibTeX file in the current working directory is used. If a character is supplied it is read into a bibentry object using read.bib.

file

character for output BibTeX file name.

orig

character with file name for copy of the original BibTeX file (if any).

bibtool

logical. Should bibtool be run first (usually to remove bibentries that are not cited)?

doi

logical. Should DOIs be added using get_doi (based on cr_works)?

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 (FALSE) or escaped by their LaTeX representations (TRUE, default)? Instead of TRUE it is also possible to indicate the encoding of the text (e.g., escape = "UTF-8") explicitly.

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., "journal-article" or "book") that needs to be matched.

...

further arguments passed to read.bib.

Details

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.

Value

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.

See Also

jss

Examples

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")
}

Fix R Scripts to use JSS's Preferred Formatting

Description

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.

Usage

fix_rscript(file = NULL)

code_lines(path = ".", comment = "#")

Arguments

file

character. The .R script that should be fixed, by default Sys.glob("*.R") is used.

path

character specifying a directory with .R files.

comment

character for beginning comments.

See Also

tidy_source


Metainformation Processing for JSS Publications

Description

Utilities for processing the metainformation of (forthcoming) publications in the Journal of Statistical Software (JSS).

Usage

jss(dir = ".")

## S3 method for class 'jss'
format(x, style = "BibTeX", ...)
## S3 method for class 'jss'
as.character(x, ...)

Arguments

dir

character specifying the directory to a JSS publication along with supplementary files (if any).

x

an object of class jss.

style

character specifying the style of string that should be generated (BibTeX, CITATION, or README).

...

arguments passed to other functions.

Details

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.

Value

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 readme.txt file (if any),

rscript

character with path to .R script (if any).

See Also

bibentry, person


Generate JSS LaTeX Style Files

Description

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.

Usage

make_jss_bst(dir = ".")
make_jss_cls(dir = ".", pdf = FALSE)
make_jss_style(dir = ".")

Arguments

dir

character specifying the output directory.

pdf

logical. Should the PDF documentation for the .cls file be generated as well?


Generate Files with Metainformation for JSS Publications

Description

Write selected elements of the metainformation from jss objects into text files.

Usage

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, ...)

Arguments

x

an object of class jss or a character specifying the dir to be passed to jss.

...

arguments passed to format.jss.

deposit

logical. Should the metainformation be deposited with Crossref?

density

numeric. Resolution for rendering PDF to PNG.

Details

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.

See Also

jss