make_pdf: Write a printable PDF file.

View source: R/make_pdf.R

make_pdfR Documentation

Write a printable PDF file.

Description

A utility to generate a PDF file ready for printing labels.

Usage

make_pdf(
  ids,
  layout,
  byRow = TRUE,
  sublabel = NULL,
  printing = NULL,
  file = "Labels.pdf",
  ...
)

Arguments

ids

A character vector of IDs as generated by make_ids.

layout

A list object describing the layout of labels on the sheet to be printed. See Details to learn how to customise this.

byRow

By default (byRow = TRUE), IDs are repeated for all labels in a row. If byRow = FALSE, then IDs are repeated for all labels in a column. It is also possible to set byRow = NULL, which will print each ID on one label only.

sublabel

An optional character vector that will be printed under the ID. This allows the replicate label (for the same ID) to be distinguished (to label, for example, different samples, tissues, replicate numbers, collection sites or dates). When byRow is TRUE, then this vector should be the same length as the number of columns in the label layout; or the length of the number of rows if byRow is FALSE. If byRow is NULL, then specify only one sublabel (if a vector is supplied, only the first element will be used).

printing

An optional character to identify multiple copies of the same label sheet. Default is to ignore this feature.

file

The name of the file to be written to. The default is "Labels.pdf" in the current working directory.

...

Additional parameters passed to pdf.

Details

This function generates a PDF document that can be printed directly to sheets of labels/stickers for the easy and clear identification of experimental samples. The default behaviour is to print the same ID across all labels in a row, with a different ID for each row.

See Also

make_ids. Also see pdf for detail on additional PDF printing parameters.

Examples

require(idLabelR)
example_spreadsheet = system.file("extdata", "Example.txt", package = "idLabelR")
ids = make_ids(file = example_spreadsheet)
layout = get_layout("cryobabies_LCRY_1700_A4")
make_pdf(ids, layout)

# Additionally prints a timestamp and identifier
# to distinguish repeated printings of the same page.
make_pdf(ids, layout, printing = "a")

# 17 rows of 5 labels for each ID.
make_pdf(ids, layout, byRow = TRUE, file = "Labels_by_row.pdf")
# 5 columns of 17 labels for each ID.
make_pdf(ids, layout, byRow = FALSE, file = "Labels_by_col.pdf")


rupertoverall/idLabelR documentation built on Aug. 27, 2023, 12:39 p.m.