p_table2pdf: Package Information in Console and PDF Files

View source: R/p_table2pdf.R

p_table2pdfR Documentation

Package Information in Console and PDF Files

Description

p_table returns a subset of crandb for the given packages and the selected columns, by default the Package name, the Title and the Description.

p_table2 has a preset value to 2 columns: "Package", "Title" and prints the results in the console with a left alignment.

p_table5 has a preset value to 5 columns: "Package", "Title", "Description", "Author", "Maintainer".

p_table7 has a preset value to 7 columns: "Package", "Version", "Published", "Title", "Description", "Author", "Maintainer".

table_pdf prints the results of p_table, p_table5 or p_table7 in pdf file(s). Miktex or Texlive is required.

p_table2pdf, p_table3pdf, p_table5pdf, p_table7pdf combine the above functions.

Usage

p_table(..., char = NULL, columns = c("Package", "Title", "Description"),
  crandb = get("crandb", envir = .GlobalEnv))

p_table2(..., char = NULL, crandb = get("crandb", envir = .GlobalEnv))

p_table5(..., char = NULL, crandb = get("crandb", envir = .GlobalEnv))

p_table7(..., char = NULL, crandb = get("crandb", envir = .GlobalEnv))

table_pdf(x, filename = "SelectedPkgs.tex", dir = ".",
  texops = "a4paper,landscape,10pt", pdf = TRUE, cleantex = TRUE,
  openpdf = TRUE, verbose = TRUE)

p_table2pdf(..., char = NULL, filename = "Selectedpkgs", dir = ".",
  texops = "a4paper,landscape,10pt", pdf = TRUE, cleantex = TRUE,
  openpdf = TRUE, verbose = TRUE, crandb = get("crandb", envir =
  .GlobalEnv))

p_table3pdf(..., char = NULL, filename = "Selectedpkgs", dir = ".",
  texops = "a4paper,landscape,10pt", pdf = TRUE, cleantex = TRUE,
  openpdf = TRUE, verbose = TRUE, crandb = get("crandb", envir =
  .GlobalEnv))

p_table5pdf(..., char = NULL, filename = "Selectedpkgs", dir = ".",
  texops = "a4paper,landscape,10pt", pdf = TRUE, cleantex = TRUE,
  openpdf = TRUE, verbose = TRUE, crandb = get("crandb", envir =
  .GlobalEnv))

p_table7pdf(..., char = NULL, filename = "Selectedpkgs", dir = ".",
  texops = "a4paper,landscape,10pt", pdf = TRUE, cleantex = TRUE,
  openpdf = TRUE, verbose = TRUE, crandb = get("crandb", envir =
  .GlobalEnv))

Arguments

...

any format recognized by cnsc, including list. A vector or a list of packages.

char

(name to) a character vector. Use this argument if ... fails or if you call the function from another function. If used, argument ... is ignored.

columns

character vector. A sub-vector of colnames(crandb). The short form "P", "T", "D", "PT", "PD", "TD", "PTD", "A", "M", "AM" describing the Package name, Title, Description, Author, Maintainer or a combination of them is accepted.

crandb

data.frame crandb. The data.frame of CRAN packages.

x

(list of) data.frame produced by p_table (with 3 columns), p_table5 (5 columns) or p_table7 (7 columns). If x is a list, the names of the list will be appended to filename.

filename

character. The file name (with or without extension).

dir

character. The directory in which the files are read or written. Default value "." is the current directory.

texops

character vector. Options passed to instruction documentclass in *.tex file.

pdf

logical. FALSE generates the *.tex file. TRUE generates both the *.tex and *.pdf files.

cleantex

logical. Remove the .tex file(s) (only if pdf = TRUE).

openpdf

logical. Open the generated *.pdf file(s) in a pdf viewer (only if pdf = TRUE).

verbose

logical. Print the path(s) to the generated file(s).

Examples

## In real life, download crandb from CRAN or load it from your directory
## with functions crandb_down() or crandb_load().
## In this example, we use a small file.
crandb_load(system.file("data", "zcrandb.rda", package = "RWsearch"))

## Use a large console (useful for p_table2())
p_table2(pacman, pdfsearch, sos)
(lst <- s_crandb_list("thermodynamic", "chemical reaction", "distillation"))
p_table2(lst)

## Print the tables as pdf files and open them in a pdf viewer.
if (interactive()) {
dir <- file.path(tempdir(), "ptablepdf")
p_table5pdf(pacman, pdfsearch, sos, filename = "table5", dir = dir)
p_table7pdf(lst, filename = "table7", dir = dir, cleantex = FALSE)
}


RWsearch documentation built on May 29, 2024, 6:42 a.m.