Skip to content

About

An operator to export a crosstab projection into a CSV file.

Resources

Stars

0 stars

Watchers

3 watching

Forks

Repository files navigation

Export Table

Description

This operator exports a crosstab projection as a CSV, TSV or XLSX file, laid out like the crosstab.

Usage
Input projection .
y-axis Output table measurement values (one value per crosstab cell)
row Output table rows
column Output table columns
Input parameters .
format Output file format: CSV (default), TSV or XLSX.
collapse_cols If true, write one header row with column factors joined by _. If false (default), write a multi-row crosstab header (one row per column factor plus a Y-axis row).
collapse_rows If true, join all row factors into a single column with values separated by _. If false (default), keep each row factor as its own column.
filename_prefix File name prefix (default Exported_Table). The workflow, group (if any) and data step names and a timestamp are appended: <prefix>_<workflow>_<group>_<step>_<YYYY-MM-DD-HHMMSS>.<ext>.
export_to_project If true, also save a copy of the file in the project (default false). Works with every combination of the other settings.
export_subfolder_name Folder for the project copy, created next to the workflow if missing. Default: Exported Data.
export_subfolder_id ID of an existing folder for the project copy. Takes precedence over export_subfolder_name.
na_encoding Text written for missing values (default empty).
decimal_character Decimal symbol (default .).
data_separator Field separator for CSV (default ,). Ignored for TSV (tabs) and XLSX.
Output relations .
Table A relation named CSV Export / TSV Export / XLSX Export holding the file (filename, mimetype, .content).
Where the file goes

With the default export_to_project = false, the file only exists in the step's output relation; it does not appear in the project's files. Set export_to_project = true to get a downloadable copy in the project: by default in an Exported Data folder in the same project folder as the workflow. Every run writes a new file (the timestamp differs), so earlier exports are kept.

Output layout

The file is wide, shaped like the crosstab: one line per crosstab row, with the row factor columns first, then one column per crosstab column holding the y-axis values. Empty crosstab cells are written as na_encoding.

Example with rows = ID, columns = patient, sample, y-axis = value, collapse_cols = false (default). The header lines carry the column factor names in the last row-factor column (with several row factors, the columns before it are left empty), so the row factor names themselves are not written:

patient,P01,P01,P02
sample,S1,S2,S1
Y-axis,value,value,value
PEP_A,1.23,0.98,1.40

With collapse_cols = true (recommended for loading into R, Python or Excel):

ID,P01_S1,P01_S2,P02_S1
PEP_A,1.23,0.98,1.40

With no column factor, the single value column is named after the y-axis variable. A crosstab cell holding more than one value is an error ("Multiple values found in at least a cell").

About

An operator to export a crosstab projection into a CSV file.

Resources

Stars

0 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages