DATES / Reshape User Guide

Reshape Data User Guide (Wide ↔ Long)

The Reshape module converts scientific datasets between Wide matrix format (repeated replicate columns per row) and Long tidy format (normalized rows with explicit replicate labels and measurement columns).

1. INTRODUCTION

The Reshape module transforms structured agricultural and experimental datasets between matrix-like Wide format and relational Long (tidy) format.

In experimental designs (such as field trials or laboratory assays), measurements are frequently recorded in wide spreadsheets with replicate columns side-by-side (e.g., Rep1, Rep2, Rep3). Most downstream statistical models and ANOVA tools require tidy long datasets where each row represents a single observational unit. Conversely, wide tables are often needed for compact tabular summaries or cross-tabulation.

When to use this module:

2. AVAILABLE OPTIONS & SETTINGS

The sidebar control panel provides controls for file ingestion, mode toggling, and column mapping:

Control / Option What it does Why it is used When to use / select
Upload Data Uploads a .csv, .xlsx, or .xls data spreadsheet into memory. Loads raw data and triggers auto-detection of column types and patterns. At the start of every reshape workflow.
Sheet Selector Selects the active worksheet from multi-sheet Excel workbooks. Ensures analysis runs on the correct data sheet. When uploading multi-sheet Excel workbooks.
Preview Spreadsheet Launches a full-screen interactive preview table of the uploaded spreadsheet. Inspects column names, row counts, and sample values before transforming. To verify header labels and check data integrity.
Direction Toggle Switches mode between Wide → Long (melting) and Long → Wide (unmelting/pivoting). Determines the underlying structural matrix transformation logic. Select Wide → Long to unroll replicate columns, or Long → Wide to reconstruct wide matrices.
Categorical Metadata Selects categorical columns (e.g., Group, Site, Condition) to preserve as metadata. Keeps experimental grouping variables attached to every transformed row. Select all grouping factor columns that identify your experimental units.
Numeric Metadata Selects non-replicate numeric metadata columns (e.g., Sample_Size, Year) to preserve as-is. Prevents numeric metadata from being mistakenly unrolled as replicate measurements. Select numeric columns that represent sample descriptors rather than repeated measurement values.
Replicate Columns / Groups In Wide → Long, selects header columns to melt (e.g., R1, R2, R3). In Long → Wide, filters specific replicate group values. Identifies which columns contain repeated measurements or filters specific replicates. Select all replicate measurement columns in Wide → Long mode.
Variable Column In Wide → Long, optionally picks a metadata column to pivot across columns. In Long → Wide, selects the measurement/variable column(s) to unroll into rows. Controls variable pivoting or defines which measurement variables to restructure. Select when doing variable pivoting or defining target measurements in Long → Wide mode.
Replicate Identifier In Long → Wide, designates the column holding replicate names/labels (e.g., Replicate). Provides column headers for the newly generated wide matrix. Required when executing Long → Wide transformation.

3. INPUT DATA FORMAT

The module accepts tabular datasets with the following structural rules:

Sample Input 1: Wide Format (For Wide → Long Transformation)

In Wide format spreadsheets, metadata columns appear on the left and replicate measurements are arranged side-by-side in separate columns:

Sample_Wide_Input.xlsx Sheet: Trial_2026
Group Site R1 R2 R3
Group-01Site-0145.2046.8044.90
Group-01Site-0238.5039.1037.80
Group-02Site-0152.1050.9051.40
Group-02Site-0241.0042.3040.70

Sample Input 2: Long Format (For Long → Wide Transformation)

In Long format datasets, each observation is a separate row, with explicit columns for replicate identifiers and numerical measurements:

Sample_Long_Input.xlsx Sheet: Raw_Observations
Group Site Replicate Response
Group-01Site-01R145.20
Group-01Site-01R246.80
Group-01Site-01R344.90
Group-02Site-01R152.10
Group-02Site-01R250.90
Group-02Site-01R351.40

4. METHODS / MODES

The Reshape module provides two primary operational modes depending on your data restructuring goal:

1. Wide → Long Mode (Standard Melt)

When to use: Use when your spreadsheet has multiple replicate measurement columns side-by-side (e.g., R1, R2, R3) and you need a single Replicate factor column and a single Value numeric column.

Optional Variable Pivot Sub-mode: If a Variable Column (e.g., Measurement) is selected from metadata, the module groups by remaining metadata, creates new columns for each unique value of that variable, and unrolls replicate measurements under each unique value column.

2. Long → Wide Mode (Pivot Matrix)

When to use: Use when your input dataset is in tall format with a column identifying replicates (e.g., Replicate) and one or more measurement columns (e.g., Response, Outcome), and you want to expand replicates horizontally into separate columns.

Condition: Requires selecting a valid Replicate Identifier column and at least one Variable Column.

5. RESULTS

Upon clicking Reshape, the module generates restructured output datasets in Excel spreadsheet layout.

Sample Result 1: Wide → Long Output Table

Transforming the sample Wide input into Long format produces this normalized dataset:

Output_Sheet_Long.xlsx Transformed Result
Group Site Replicate Value
Group-01Site-01R145.20
Group-01Site-01R246.80
Group-01Site-01R344.90
Group-01Site-02R138.50
Group-01Site-02R239.10
Group-01Site-02R337.80
Group-02Site-01R152.10
Group-02Site-01R250.90
Group-02Site-01R351.40
Group-02Site-02R141.00
Group-02Site-02R242.30
Group-02Site-02R340.70

Sample Result 2: Long → Wide Output Table

Transforming the sample Long input into Wide format expands replicates across matrix headers:

Output_Sheet_Wide.xlsx Transformed Result
Group Site Variable Column R1 R2 R3
Group-01Site-01Response45.2046.8044.90
Group-02Site-01Response52.1050.9051.40

6. QUICK WORKFLOW

  1. Upload Data: Click Upload Data in the left sidebar and select your .csv or .xlsx dataset.
  2. Select Worksheet: If using a multi-sheet Excel file, select the target sheet from the dropdown.
  3. Verify Auto-Detection: Review auto-detected column selections. Click Preview Spreadsheet if needed.
  4. Choose Direction: Toggle between Wide → Long or Long → Wide.
  5. Map Columns: Ensure metadata factors and replicate columns/identifiers are accurately mapped.
  6. Run Transformation: Click the Reshape button.
  7. Export Results: Click XLSX or DOCX at the top of the transformed table to download your output file.

7. IMPORTANT NOTES

Duplicate Combination Prevention

When running Long → Wide transformation or Variable Pivot Mode, every combination of metadata factors and replicate IDs must be unique. If duplicates exist, an error will alert you to clean your data first.

Cite DATES in Research Papers

If you use the DATES platform for data preparation or statistical analysis in published scientific work, please cite it as follows:

@software{dates_app_2026, author = {DATES Development Team}, title = {DATES: Data Analysis and Trial Evaluation System}, year = {2026}, url = {https://dates-app.org}, note = {Data Preparation & Analysis Modules} }