create_label: Create custom machine- and human-readable rectangular plot...

View source: R/all_new_functions.R

create_labelR Documentation

Create custom machine- and human-readable rectangular plot labels

Description

Create print-ready customized plot labels affixed with QR codes given the page setup, label dimensions, the number of rows and columns of labels to print per page.

Usage

create_label(
  wdt = 2,
  hgt = 1,
  page_wdt = 8.5,
  page_hgt = 11,
  top_mar = 0.625,
  bot_mar = 0.625,
  left_mar = 0.625,
  right_mar = 0.625,
  numrow = 8L,
  numcol = 3L,
  filename = "PlotLabel",
  font_sz = 8,
  Treetag = FALSE,
  family = "sans",
  rounded = TRUE,
  print_across = TRUE,
  rect = TRUE,
  top_left_1 = NULL,
  top_left_2 = NULL,
  top_right_1 = NULL,
  top_right_2 = NULL,
  center_right_1 = NULL,
  center_right_2 = NULL,
  center_right_3 = NULL,
  bottom_left_1 = NULL,
  bottom_left_2 = NULL,
  unique_id = NULL,
  ec_level = 3,
  ...
)

Arguments

wdt

The label width in inches.

hgt

The label height in inches.

page_wdt

The page width in inches.

page_hgt

The page height in inches.

top_mar

The page top margin in inches.

bot_mar

The page bottom margin in inches.

left_mar

The page left margin in inches.

right_mar

The page right margin in inches.

numrow

The number of label rows per page. It should be an integer.

numcol

The number of label columns per page. It should be an integer.

filename

A character prefix or path for the pdf file to be created. Default path is working directory.

font_sz

The font size to use.

Treetag

Set to TRUE if creating a treetag label.

family

The font style to use to print labels.

rounded

Set to TRUE if label has round corners; set to false if label has square corners.

print_across

Set to TRUE to print labels across rows, left to right; else set to FALSE to print labels down columns, top to bottom. Default is TRUE.

rect

Set to TRUE to draw rectangles around labels, else set to FALSE. Default is TRUE.

top_left_1

String for top-left row 1 position on a rectangular label.

top_left_2

String for top-left row 2 position on a rectangular label.

top_right_1

String for top-right row 1 position on a rectangular label.

top_right_2

String for top-right row 2 position on a rectangular label.

center_right_1

String for center-right row 1 position on a rectangular label.

center_right_2

String for center-right row 2 position on a rectangular label.

center_right_3

String for center-right row 3 position on a rectangular label.

bottom_left_1

String for bottom-left row 1 position on a rectangular label.

bottom_left_2

String for bottom-left row 2 position on a rectangular label.

unique_id

A vector containing unique identifiers or strings to generate QR codes.

ec_level

The error correction level ('0' - '3', lowest to highest) for QR codes.

...

Additional optional arguments to be supplied.

Value

A PDF file containing experimental plot labels affixed with QR codes, saved to the default or working directory.

See Also

field_label and gp_label

Examples

library(qrlabelr)
file <- tempfile()

if(file.exists(file)) 
# Create rectangular plot labels based on the Avery 94220 template-- the default template
create_label(
font_sz = 10,
filename = file, 
print_across = TRUE,
rect = TRUE,
top_left_1 = paste("Plot:", 101:105), 
top_left_2 = paste("Row:", c(rep(1, 3), rep(2, 2))), 
top_right_1 = paste("Rep:", rep(1, 5)), 
top_right_2 = paste("Col:", c(1:3, 1:2)), 
center_right_1 = paste("iBLOCK:", c(rep(1, 3), rep(2, 2))), 
center_right_2 = paste("Seed:", rep("OFF_NUR", 5)), 
center_right_3 = rep("AWk", 5), 
bottom_left_1 = paste("Loc:", rep("BAMBEY", 5)), 
bottom_left_2 = paste0("G-", 1:5),
unique_id = paste("KUMASI2023_PYT", c(101:105), 
                  c(rep(1, 3), rep(2, 2)), c(1:3, 1:2),
                  sep = "_"), 
ec_level = 1)





qrlabelr documentation built on May 29, 2024, 10:16 a.m.