InsectLabelR is an R package designed to streamline the creation of high-quality labels for insect pinning. By taking a dataset as input, InsectLabelR generates printable labels in PDF format, helping researchers and entomologists maintain accurate and standardized specimen records.
For enhanced accessibility, the package includes a user-friendly Shiny application, which provides a graphical interface for generating labels without requiring programming expertise and detailed user guides in both English and French .
- Create insect pinning labels from dataset inputs.
- Output labels as PDF files, ready for printing.
- Flexible label formatting options.
- User-friendly GUI via the Shiny app InsectLabelR.
To install the InsectLabelR package, use the following command in R:
# Install from GitHub
devtools::install_github("Nmoiroux/InsectLabelR")The Shiny app provides an intuitive interface for generating insect pinning labels. You can access it online at InsectLabelR or run it locally:
InsectLabelR_App()
Steps to Use the Shiny App:
- Upload Data: Upload a
.csv,.xlsx, or.odsfile containing your insect data.- If using
.xlsxor.ods, select the appropriate sheet containing the dataset. - Example datasets are available in the InsectLabelR repository.
- If using
- Configure Printing Parameters: Use a pre-configured table or manually fill out a printing parameters table, specifying:
- Which fields to print
- Number of labels per individual
- Printing order
- Text formatting (e.g., italics for genus/species).
- Customize Labels: Adjust label width, height, font size, and more.
- Generate PDF: Download the formatted labels as a PDF file.
Your dataset must include:
- Data Table: A table with one row per insect and columns describing attributes (e.g., species, collection date).
- Supported formats:
.csv(tab-delimited),.xlsx,.ods. - Column names are flexible.
- Supported formats:
- Printing Parameters Table: Specifies how data fields appear on labels.
- Formats: as a sheet in the
.xlsxor.odsfile containing the Data table, or as a.csvfile (tab-delimited). - Includes the following columns:
field_name,print,label_no,order_lab, and more. - Can be configured offline or within the app.
- Formats: as a sheet in the
Example data and parameter tables are provided in the InsectLabelR repository.
- Download the example dataset: liste_ind_coll_ex.ods.
- Upload the file and select the sheet "Table_data".
- Set printing parameters by selecting "Print_parameters_ex1" sheet or configure them manually.
- Adjust label size, font, and layout as needed.
- Generate and download the PDF labels.
InsectLabelR provides programmatic access to its core functionality. Below is an example using the create_pdf() function with a dataset embedded in the package.
# Example dataset path (included in the package)
data_path <- system.file("extdata", "liste_ind_coll_ex.ods", package = "InsectLabelR")
# Load data table
data_table <- readODS::read_ods(data_path, sheet = "Table_data")
# Load print parameter data
par_table <- readODS::read_ods(data_path, sheet = "Print_parameters_ex1")
# Define output file path for the PDF
output_pdf <- "example_labels.pdf"
# Generate labels
InsectLabelR::create_pdf(
file_out = output_pdf, # Name of pdf file
ind_list = data_table , # Table of data
print_info = par_table, # Table of printing parameters
font_size = 5, # Font size
lab_width = 15, # Width of the labels in mm
lab_height =12, # Height of the labels in mm
n_col = 8, # Number of label columns per row
hl_col = "orange" # Color for highlighted text
) This script:
- Loads an example
.odsdataset included in the package. - Configures the data and parameter sheets.
- Defines label size, font, and layout.
- Outputs the generated labels as a PDF file.
The generated example_labels.pdf file will contain insect pinning labels formatted according to the specified parameters.
- R version >= 4.0.0
- Required packages:
dplyr,purrr,stringr,magrittr,shiny
- Ensure your dataset and parameters follow the specified structure.
- Avoid special characters in field names to prevent LaTeX rendering issues.
- Ensure you have a compatible installation of
pdflatexsee https://www.latex-project.org/get/. For Debian or Debian-based (Ubuntu...) Linux distributions, the following commands should ensure a compatiblepdflatexinstall:
sudo apt-get install texlive-latex-base
sudo apt-get install texlive-latex-extra