User guide · Chapter 06

Import, export, print

64 min read · 13 sections

This chapter covers everything that brings data into Variance and everything that takes a result out of it: importing text files and workbooks (with automatic updating of linked files), exporting graphs and layouts (PDF, SVG, PNG, TIFF…), exporting tables and results, checking a result in R or Python, copying to another program, sending to Word and PowerPoint, sending by e-mail, printing, and finally automation: scripts and the command-line tool variance-cli.

Menus, the ribbon and the navigator are described in the chapter "The interface"; typing and pasting in tables, in the chapter "Data tables"; layouts, results and Notes sheets, in the chapter "Layouts, results and notes sheets". Saving projects and templates is in the chapter "Getting started".

Importing data#

The ways data comes in#

Variance has five ways of bringing data into a table:

WayWhat it is for
File › Import Data… (the Import button of the ribbon's Project group, or drag and drop)read a text file (.txt, .csv, .dat, .prn…), one or more worksheets of a workbook (.xlsx, .xls, .xlsb, .ods), or selected sheets from a .prism, .prismt, .pzfx, .xml or .var file
Edit › Paste Special… (Ctrl+Shift+V)paste the clipboard text (copied from a spreadsheet, a web site, a document) with the same options for separator, titles and missing values
Sheet › Links Between Sheets…import a file and link it to the table, or update / break existing links
File › Open… or File › Add Sheets from a File…open a .var project, a .pzfx/.xml exchange file, or a .prism/.prismt file (or pick specific sheets to add to the open project; see "Opening a project" in "Getting started")
A script (commands Import, InsertData)automate the import of many files (see "Scripts" below)

For pictures, Objects › Picture… places an image file on a graph or a layout (see "Pictures" in the chapter "Graphs"); for the notes of an Notes sheet, Import Text… (see "Importing notes" in the chapter "Layouts, results and notes sheets").

Importing a text file or a workbook#

  1. If you want to insert the data into an existing table, display that table first (and, if you want to place the data at a precise spot, click the starting cell). To create a new table, any sheet will do.
  2. File › Import Data… (or the ribbon's Import button, or drag and drop the file onto Variance). The file picker opens on "All supported data and Prism files" (text, spreadsheets, .prism/.prismt, .pzfx/.xml, .var/.vart). For a multi-sheet Prism, XML or Variance file, the Import Sheets chooser lets you pick only the tables or notes sheets you want; for a text file or workbook, the Import wizard opens.
  3. The Import window opens. It recalls the file ("File: …") and offers five pages as tabs: Source, View, Filter, Placement and Notes. The pages are described one by one below.
  4. Set the options. The preview on the View page shows, live, what will be imported with the current settings.
  5. Click Import. On success, the status bar shows "Data imported" (or "Data imported and linked to the file" if you ticked the link option) and the window closes; on error, the error message appears in the status bar and the window stays open so that you can correct it.

Cancel abandons; Save these settings as the default saves the current settings as the defaults for the next imports (the status bar answers "Import choices saved as the default"). An import is a single undo operation: Ctrl+Z undoes all of it.

The "Source" page#

It says where to put the data and how to read the file.

  • If a table is displayed, two mutually exclusive choices: Insert into the data table "name" (the data is inserted into that table, at the position set on the Placement page) and Into a new table. If no table is displayed, only the second is offered.
  • When Into a new table is chosen: the Table type list gives the type of the new table (the eight types of the chapter "Data tables": XY, One factor, Two factors, Contingency, Survival, Proportions, Multivariable, Nested; the default is One factor) and the Create a graph of the new table box (ticked by default) also creates the automatic graph. Choose the type before importing: the file's columns are interpreted according to that type (for example, for an XY table, the first column becomes the X values).
  • Link to the file: import it again automatically whenever it changes: links the table to the file (see "Linked files and updating" below).
  • For a workbook, the Worksheet list gives the workbook's sheets; the first is chosen automatically. When importing into a new table from a multi-sheet workbook, tick Import multiple worksheets to select several worksheets and create one table per worksheet. For a text file, the Separator of the values list offers Detect automatically, Tab, Comma, Semicolon and Spaces.
  • Subcolumns (replicates) per data set: (from 1 to 50): the number of subcolumns (replicates) of each data set in the destination table. With 1, each column of the file becomes a data set; with 3, the file's columns are grouped by three (see "Y entry formats" in the chapter "Data tables").

A help line recalls the formats read: text files (.txt, .csv, .dat, .prn) and workbooks (.xlsx, .xls, .xlsb, .ods).

The "View" page#

It shows a preview of the import result, with the settings of the other pages already applied: column titles (in bold), the number of each row, values. The message "N row(s) will be imported, with the current Filter and Placement choices." gives the number of rows that will be imported. Two radio buttons set the extent of the preview: Show the first 500 rows (default) and Show all rows (up to 10,000). The preview shows only the first 40 columns. If the file is unreadable, the error is displayed in red in place of the preview.

This is the page to look at before every import: if all the columns are stuck together in a single one, the separator is wrong; if a title row appears as a data row, set Column titles: in Placement.

The "Filter" page#

It decides which rows and which values are read.

  • Text meaning a missing value: the words that mean a missing value, separated by commas (the field suggests "NA, N/A, ., -"; the original settings are NA, N/A, ., NaN and -). A cell containing one of them is imported empty.
  • Values followed by an asterisk (12*) are imported as excluded (ticked by default): a number followed by an asterisk is imported as a value excluded from analyses (see "Excluding values" in the chapter "Data tables"). Untick it if the asterisk has another meaning in your file.
  • Skip rows at the top of the file: number of rows to ignore at the start (instrument headers, comments).
  • Import at most (0 = all rows): limits the number of data rows read; 0 means all.
  • Keep one row out of (decimation): keeps only one row out of n (1 = all). Useful to lighten a heavily sampled recording.
  • Unstack: one data set per value of a group column: for a "long" file (one group column, one value column). When the box is ticked, two fields appear: Group column: and Value column: (column numbers of the file, starting at 1). Each distinct value of the group column gives a data set, which contains the corresponding values of the value column. This is the way to go from a "one row per individual" format (group, measurement) to the "one data set per group" format of One factor tables.

The "Placement" page#

It sets where and in what form the data arrives.

  • For a new table: Name of the new table: (the file name, without extension, by default).
  • For an insertion into the displayed table: Insert at row: (starting row, from 1; the cursor's row by default) and and column (0 = X or row labels): (starting column; 0 is the X or row-labels column, 1 the first data set or, for an XY table, the first column after the X values…). The imported values overwrite those in the targeted rectangle.
  • Column titles: Detect automatically, First row of the file (the first row contains the column titles) or None (the first row is a data row). Detection takes as titles a first row of text above a row of numbers.
  • First column: Detect automatically, X values (the first column gives the X values), Row labels (the first column gives the row labels) or Data (it is a data column like the others).
  • Transpose: rows of the file become columns: swaps rows and columns before the import, for a file where each series is written as a row.

The "Notes" page#

Many instruments and spreadsheets write constants (operator, date, batch) and notes at the top of the file. This page says what to do with them. It is meant for notes sheets (see "Notes sheets" in the chapter "Layouts, results and notes sheets").

For each of the two headings, Constants and Notes, three choices:

  • Don't import …: this section is ignored;
  • "Import from portion of file between <Info> and </Info>" (or <Notes> and </Notes> for the notes): what lies between the tags is read; this is the default;
  • From row … to row …: the indicated rows of the file are read.

The Import into list of the Notes sheet heading designates the Notes sheet that receives the constants and notes: by default "The notes sheet of the table (created if needed)", otherwise one of the existing Notes sheets. A reminder states that the <Info> and <Notes> sections must come before the data. The page also reports what it finds: "Found: N constant(s) and notes".

Importing into an existing table or a new table#

Two situations come up again and again.

One file per experiment, one table per file. Choose Into a new table, the suitable Table type, leave the graph box ticked, check the preview, click Import. The new table takes the file's name; if the preferences ask for it, it also gets its Notes sheet (see Preferences › Notes Sheet › Create a notes sheet with each new table in the chapter "The interface").

Completing a table that already exists. Display the table, click the starting cell, File › Import Data…, leave Insert into the data table "name", and if needed set Insert at row: and and column (0 = X or row labels): in Placement. The imported values replace the content of the targeted rectangle; the rest of the table is unchanged. To import several files into successive columns, run the import again, increasing the column number.

Example settings#

FileSettings
Export from a European spreadsheet: ";" separator, decimal commaSeparator of the values = Semicolon; check in View that the numbers are read as numbers (see "Common mistakes")
Instrument recording: 12 header rows, then dataSkip rows at the top of the file: = 12; Column titles: = First row of the file
Measurements in rows: one row = one sample, one column = one dateTranspose: rows of the file become columns
"Long" file: a "treatment" column, a "response" columnUnstack… with Group column: 1 and Value column: 2, table type One factor
Three replicates per condition, side by sideSubcolumns (replicates) per data set: = 3
Sensor at 1,000 points per second, of which you want 1 point in 10Keep one row out of (decimation): = 10
File containing "*" stuck to doubtful numbersleave the asterisk box ticked to exclude them, untick it otherwise

Pasting from the clipboard: Paste Special#

For data copied from a spreadsheet, a web page or a document, Edit › Paste Special… (Ctrl+Shift+V) opens the Paste Special window, which offers Separator, First row, Skip first rows, Keep one row out of, Missing values, Transpose (rows become columns) and Values followed by * are pasted as excluded, with a summary of what will be pasted and a text you can edit before pasting. All these options, and the difference from direct pasting (Ctrl+V), are described in the section "Paste Special" of the chapter "Data tables". They repeat, in a lighter form, those of the Import window: choose Paste Special for a text you have just copied, Import for a file.

Linked files and updating#

A link is a table that remembers the file its data came from, how that data was read, and the file's modification date. It is for a file that the instrument (or another program) rewrites regularly: the analysis and the graph update by themselves.

Creating a link. Tick Link to the file: import it again automatically whenever it changes on the Source page of the Import window. Two cases:

  • with Into a new table, the whole table is linked to the file ("whole table" link): at each update, it is rebuilt from the file with the same options;
  • with Insert into the data table, it is the imported rectangle that is linked ("insertion" link), at the chosen position.

Sheet › Links Between Sheets… opens the Links window, which lists, for each linked table, its name, the file path and two buttons. It also offers a way to create a link without going through the Import window.

  • Update now: reads the linked file again immediately.
  • Break link: removes the link; the data stays in the table, which is no longer updated.
  • Import and link a file into the current table…: chooses a file ("Data files" filter: csv, txt, tsv, xlsx, xls) and imports it, with the default options, into the displayed table, starting at row 1 and column 1, then links it. This button is active only if a table is displayed. To set the separator, titles or filters of a link, go through File › Import Data… and the link box.
  • Close closes the window. If no table is linked, the window says so.

When does the update take place? Variance compares the linked file's modification date with that of the last read, about every two seconds while the project is open. When the file is newer, the table is read again, the analyses that depend on it are recomputed and the graphs redrawn; the status bar shows "'name' updated from …" (or the error). The update is an undo operation ("Update linked data"). A missing or unreadable file erases nothing: the status bar shows the error.


Exporting a graph or a layout#

Which format for which use#

File › Export › This Sheet… (Ctrl+Shift+E, the ribbon's Export button, the Export… button above a graph or a layout, or Export… in the context menu) exports the displayed sheet. For a graph or a layout, the Export window opens; for a table or results, see "Exporting tables and results" below.

The window offers ten formats, five vector and five raster. A vector format describes the drawing with lines, shapes and text: it can be enlarged without loss and touched up in a drawing program. A raster format is a grid of pixels, locked at one resolution.

Label in the Format listExtensionUse
PDF - vector, for publications.pdfthe default choice; paper figures, theses, sending to a publisher, posters. Text stays text (standard Helvetica fonts, plus Symbol for Greek letters and mathematical signs): nothing to embed
SVG - vector, for the web and editing.svgweb pages, touching up in a vector drawing program
EPS - vector, PostScript.epsjournals and publishers that require encapsulated PostScript; text in standard fonts (non-ASCII characters are replaced by "?")
EMF - vector, Microsoft Office.emfinsertion into Word, PowerPoint and other Windows Office programs, where the image stays vector
WMF - vector, older Windows programs.wmfolder Windows programs; more limited format (16-bit coordinates)
PNG - raster, lossless.pngslides, web pages, documents; lossless, supports transparency
TIFF - raster, for journals.tifjournals that ask for a raster image; the only format that offers the CMYK model and the choice of compression
JPEG - raster, photos.jpgto be avoided for graphs (lossy compression, fixed quality of 92 out of 100, halos around thin lines); reserved for cases where the format is imposed
BMP - raster, Windows bitmap.bmp24-bit Windows bitmap, uncompressed, large files
PCX - raster, legacy.pcxold format, 24-bit

Step by step: exporting a figure#

  1. Display the graph or the layout (a layout assembles several graphs on a page: see the chapter "Layouts, results and notes sheets").
  2. File › Export › This Sheet… (Ctrl+Shift+E). The Export window opens, set to PDF, Color (RGB), 300 dpi.
  3. Choose the Format, then the options that appear (see below).
  4. Click Export…. A file picker opens in the export folder of the preferences (Preferences › Folders, Exports folder), with the sheet's name as the proposed file name (characters forbidden in a file name are replaced) and the format's extension.
  5. Save. The status bar shows "Exported" followed by the path and the window closes. On failure, the error message is in the status bar and the window stays open.

Cancel closes without exporting.

The options of the Export window#

Format: the list of the ten formats above. The text displayed on the closed list is the extension in capitals.

Resolution (dpi): appears only for raster formats. Five quick buttons (72, 150, 300, 600, 1200) and a numeric field (from 36 to 2,400) for any value. The default is 300.

The resolution sets the number of pixels. A sheet measures a certain number of points (1 point = 1/72 inch); the number of pixels is width in points × dpi ÷ 72, rounded up. A landscape A4 layout (842 × 595 points) gives, at 300 dpi, about 3,509 × 2,480 pixels; at 600 dpi, twice as many in each direction, that is four times as many pixels and a much heavier file. Variance limits the image to 30,000 pixels in each direction. The resolution is also written into the file (PNG, JPEG, TIFF, BMP, PCX), so that a page-layout program recovers the intended physical size.

Color model: four choices.

  • Color (RGB): the screen colors; the default.
  • Grayscale: gray levels (luminance: 0.299 R + 0.587 G + 0.114 B). Try it before sending a figure to a publisher that prints in black and white: two colors that are distinct on screen may become two almost identical grays.
  • Monochrome (black and white): black and white only, no grays. For vector formats, light fills become white and all the other elements black; for raster formats, each pixel becomes black or white according to its gray. Solid colored or gray bars, areas and symbols therefore become black: this mode only suits a graph that is already drawn in white with an outline.
  • CMYK (TIFF): the printers' four-color model. It acts only in a TIFF file; in all other formats, the figure is written in RGB color. The conversion is a simple one (full black generation), without a color profile: if the publisher allows it, let them do the conversion with their profiles. A CMYK TIFF has no transparency: the background is flattened onto white.

In vector formats, Grayscale and Monochrome convert each color of the drawing (lines, fills, text, images); in raster formats, the conversion applies to the pixels.

TIFF compression: appears for the TIFF format. None (no compression: enormous files), PackBits (simple, not very effective) and LZW (lossless, the smallest; default and usual choice).

Transparent background: appears for PNG, TIFF, SVG and PDF. When ticked, the sheet's background is not drawn: the figure is superimposed on whatever is behind it (a slide's color, a web page, the colored background of a poster). The EPS, EMF, WMF, JPEG, BMP and PCX formats do not have the box: they keep the sheet's background (white by default). The Monochrome and CMYK models always flatten the background onto white in a raster file.

Export every graph and layout of the linked sheets (one file each): when ticked, the Export… button asks for a folder (instead of a file name) and exports into that folder all the graphs and layouts of the sheet's linked sheets (see "Linked sheets" in the chapter "Layouts, results and notes sheets"), each in a file named after its sheet (if two sheets have the same name, the second gets its number), with the chosen format and options. The status bar announces "N file(s) exported to …".

Exporting all graphs or all layouts at once#

The File › Export submenu offers All Graphs… and All Layouts…: Variance asks for a folder and writes a PDF file there for each graph (or each layout) of the sheets linked to the active sheet, or of the whole project if no sheet is active. The file names are "sheet name_number.pdf" (the sheet's internal number avoids duplicates). These two commands always write PDFs at 300 dpi, in color: for another format or other options, use the Export every graph and layout of the linked sheets (one file each) box of the Export window.

Pitfalls of figure export#

  • A blurry figure. A PNG or TIFF at 72 or 96 dpi is blurry when printed. Export at 300 dpi at least, or as a PDF.
  • Fonts that change. Vector formats use the standard fonts (Helvetica, equivalent to Arial). If a journal requires other fonts to be embedded, go through a raster export.
  • An image that is too big. A layout A4 at 1,200 dpi exceeds 14,000 pixels in width: the file is heavy and many programs refuse it. 600 dpi is almost always enough.
  • A size that does not match the journal's column. The export keeps the sheet's size. Set the size of the graph (and the page size of a layout) before exporting: see "The page size" in the chapter "Layouts, results and notes sheets". Journals often ask for a width of 85 mm (one column) or 180 mm (two columns).
  • A Greek letter replaced by "?". In an EPS, non-ASCII characters are replaced; use PDF or SVG.
  • EMF in Word. The EMF produced is a standard EMF (without EMF+ records); transparencies are blended with white and images become 24-bit bitmaps. If the rendering disappoints you, insert a PNG at 300 dpi.

Exporting tables and results#

Exporting a data table or results#

On a data table or a results sheet, File › Export › This Sheet… (Ctrl+Shift+E, or the Export… button of the results sheet) does not go through the Export window: a file picker opens directly. It offers four filters: CSV, Tab-delimited text (.txt), XML and HTML (results), with the name "export.csv" by default. The format is determined by the extension you give the file (type it in the name).

ExtensionData tableResults
.csvcomma-separated textall the tabs, comma-separated
.txt (or any other extension)tab-separated textall the tabs, tab-separated
.xmlXML exchange file containing this tablesimple XML: one element per tab and per row, with the displayed values
.html or .htmHTML page with the table (values as in the tabbed export)HTML page

Data table as CSV or text. The file contains:

  • a title row: the title of the X column, "title error" for an X error column, the title of each data set; when a data set has several subcolumns (replicates), the columns are named "set:subcolumn" (for example "Control:1", "Control:2", or the subcolumn's title if it exists); the row-labels column has an empty title;
  • one line per used row of the table;
  • numbers written with their full precision (and not with the displayed number of decimals), with the point as decimal separator;
  • empty cells left empty;
  • excluded values followed by an asterisk ("12.5*"), which allows them to be imported again as excluded (the Values followed by an asterisk (12*) are imported as excluded box of the Import window);
  • texts in quotes when they contain the separator, a quote or a line break.

When Preferences › Saving and Printing › Decimal separator (copy and export) resolves to a decimal comma (automatically on comma-decimal systems, or when forced to Comma), the numbers of a table or of results are written with the decimal comma, and the CSV file then uses the semicolon as separator (the convention of European spreadsheets); the text file stays tab-separated.

Results as CSV or text. Each results tab is written one after the other: a line with the tab's name, a line of column titles (first cell empty), the tab's rows with their label in the first column, then an empty line. The numbers are those displayed, with the number of digits and the P style set in the sheet (see "Number format" in the chapter "Layouts, results and notes sheets").

Results as HTML. A standalone HTML document (UTF-8, plain style): a title with the sheet's name, then, for each tab, a subtitle and a table with borders. Section header rows are in bold. Open it in a browser or drag it into Word, where the table stays editable. It is the best way to take away the results of an analysis in a laid-out form.

Exporting a table as an XML exchange file#

The extension .xml on a data table writes an XML exchange file that contains that table (with its linked notes sheet, if any); Variance reads .pzfx files but does not write them. To export all the tables of the project to XML, use a script: ExportTable file.xml All (see "Scripts"). Analyses, graphs, layouts, sticky notes, attached files, custom equations and links are not kept in this format: Tools › Check the XML Export… lists them for the open project ("Everything in this project can be exported to the XML exchange format." if nothing is lost).

Exporting an Notes sheet#

On a notes sheet, File › Export › This Sheet… opens a picker with three filters: text with <Info> and <Notes> sections (.txt, readable again by Import Text… and by the Notes page of the Import window), PDF and Word document (.docx). See "Importing notes" in the chapter "Layouts, results and notes sheets".

Getting a PDF of a table or of results#

The interface does not export a data table or results as a PDF with Export…: to get a laid-out PDF version, use File › Print to PDF… (see "Printing and creating a PDF"), or the variance-cli export command (see "The command-line tool: variance-cli"), which accepts all sheets.


Checking a result in R#

A reviewer, a co-author or you yourself may want to confirm a result with another program. The Check in R… button of the results sheet exports everything needed to redo the analysis in R, the free statistics software: the data analysed and a commented script that redoes the computation with the same options, then puts each result of R next to Variance's. You do not need to know R: the script runs as it is and each step is explained in it.

Exporting the script and the data#

  1. Open the results sheet to check.
  2. Click Check in R…, in the title bar of the sheet, to the right of Export….
  3. In the dialog, Script language controls the comments (English by default; Variance remembers your choice). Three actions are available: Run in R now (detects your local R installation, executes the script in the background, and displays the comparison table inside Variance), Open in R / RStudio (writes the files to a temporary folder and opens the .R script in your default R editor), or Save script & data… (exports the .R script and companion .csv data to a folder of your choice).

Variance writes the script (.R) and the data file with the same name and the .csv extension. Results labels match the interface. After printing the comparison, the script uses sessionInfo() to record the R version and the versions of packages loaded during the run. If you run the script from Variance, you can find this information in the R output tab.

If the results sheet is locked or uses an option that cannot be exported, Variance displays a clear explanation before any file is written.

The data file#

The file holds the values as the analysis used them:

  • only the data sets analysed (for a two-group comparison, the two columns A and B compared);
  • excluded values are left out (empty cells);
  • numbers written with their full precision, so that R computes on exactly the same values;
  • UTF-8 encoding with a byte order mark, so that spreadsheets show accented letters correctly; when Preferences › Saving and Printing › Decimal separator (copy and export) resolves to a decimal comma, numbers use a decimal comma and a semicolon as separator (the script then reads the file with read.csv2).

Its layout depends on the type of table:

Table analysedContent of the file
One factor (descriptive statistics, two groups, one sample, one-way ANOVA, correlation matrix)one column per data set, one line per row of the table; the subjects of a paired design stay on the same line
XY (correlation, linear regression)the X column, then the Ys of each data set, one column per replicate ("Title [1]", "Title [2]"…)
Two factors (two-way ANOVA)one line per value: Row (level of the row factor), Column (data set), Value
Contingencythe table of counts, with the names of the rows in the first column
Survivalone line per subject: Time, Event (1 event, 0 censored), Group

What the script does#

The script starts with a header: analysis, results sheet, data file, instructions, packages needed and the chapter of this guide that describes the methods. Numbered sections follow:

  1. Reading the data. The file is looked for in the folder of the script, then in R's working directory.
  2. Preparation: the groups compared, the pairs of a paired design, the logarithms of an analysis on logarithms, the points of each data set…
  3. The computations, with R's own functions and the options that match the choices made in Variance: t.test, wilcox.test, ks.test, aov, oneway.test, kruskal.test, friedman.test, lm and drop1 (type III sums of squares), cor.test, fisher.test, chisq.test, prop.trend.test, survfit and survdiff… Each step prints R's usual output.
  4. The comparison with Variance (see below).

When Variance applies a method that R does not provide, or that R computes differently by default, the script writes the formula documented in this guide, with R's base functions, and a comment explains it. This is the case of the Hodges-Lehmann interval from order statistics, of the Kolmogorov-Smirnov P value with Stephens' correction, of the P value of the F test of variances, of Spearman's P value from Student's approximation, of the median survival at the start of a plateau at 50%, of the Gehan-Breslow-Wilcoxon test, of the comparisons after a two-way ANOVA (raw means of the cells), of the distributions of Dunnett and Dunnett T3 (integrated numerically), and of the Holm-Šídák and Benjamini, Krieger and Yekutieli corrections.

R alone is enough (version 4.2 or later), with two exceptions mentioned in the header: the survival package, which comes with R, for survival analysis, and the lme4 package for the mixed-effects model of a repeated measures ANOVA (used when values are missing, or when this method is chosen; install it once with install.packages("lme4")).

Running the script#

  1. Keep the script and the data file in the same folder.
  2. In RStudio: open the script and click Source. In R's console: source("path/to/the/script.R"). From a command line: Rscript "script.R".
  3. Read the output: the results of R step by step, then the table "Comparison with Variance".

Reading the comparison with Variance#

The values Variance showed when the script was exported are copied into the script. The function check() puts each of them next to the value R computed, in a table with four columns: Quantity (the label of Variance's results row), Variance, R** and **Agreement ("yes" or "NO"). The last line of the output concludes: "R and Variance agree on every value compared (n values).", or gives the number of values that differ.

Two values agree when:

  • their relative difference is below one millionth;
  • for a P value, the absolute difference is below 1e-14 (Variance does not show the digits of such small P values);
  • an empty cell in Variance (value not computable) corresponds to NA, NaN or an infinite value in R.

A few results have a wider tolerance, stated in the script, because R's function is less precise than Variance's computation: ptukey() and qtukey(), which R documents as accurate to about 4 decimal places (Tukey, Newman-Keuls and Games-Howell tests: 1e-4 on the P values, a ten-thousandth of the half-width on the limits of the intervals); the mixed-effects model, whose likelihood lme4 optimizes numerically (relative difference of 1e-4); Dunnett's distributions integrated numerically (1e-5).

What is covered#

The export covers all 49 analyses in Variance with their options:

  • Describe & explore: descriptive statistics, row statistics, correlation (Pearson/Spearman), frequency distribution, normality tests, observed vs. expected, smoothing, derivative & integral, area under curve, PCA, multiple P values (FDR);
  • Compare groups: two-group comparisons, one-sample tests, one-, two-, and three-way ANOVA (ordinary, Welch/Brown-Forsythe, repeated measures, REML mixed-effects models including random slopes and AR(1)/diagonal/unstructured covariance structures, Kruskal-Wallis, Friedman, and multiple comparisons), row-by-row multiple t tests, nested t test & nested ANOVA, contingency tables, McNemar, Bland-Altman, ROC curves;
  • Curves & regression: simple & multiple linear regression, nonlinear regression (all 104 built-in equations and custom equations), standard-curve interpolation, simple & multiple logistic regression, Poisson regression, Deming regression, Cox proportional hazards, smoothing splines & LOWESS, function plotting;
  • Survival, clustering, processing & simulation: Kaplan-Meier survival curves, hierarchical clustering, k-means, all data processing transforms/reshaping, and all random/Monte Carlo simulations.

Optional R packages are requested only when required by the chosen model (survival / MASS for survival and Cox models, lme4 for mixed-effects models and random slopes, nlme for AR(1)/diagonal/unstructured REML covariance structures). Locked results sheets must be unlocked before checking in R because their stored results may no longer match the data.

Variance's automated tests export hundreds of generated analyses across all 49 analyses with their options, run the scripts in R and require every value compared to agree, in French and in English, with a decimal point or a decimal comma.


Checking a result in Python#

If you or a collaborator prefer Python over R, the Check in Python… button on supported results sheets exports the analyzed data (.csv) and a standalone, commented Python script (.py) using NumPy and SciPy that reruns the analysis with the exact same options and compares every value side by side against Variance.

Running or exporting the script#

  1. Open a supported results sheet and click Check in Python… in its title bar (next to Check in R…).
  2. Choose Script language (English or French) for the comments in the generated .py script.
  3. Choose one of three workflows:
    • Run in Python now: detects your local Python 3 interpreter (VARIANCE_PYTHON, PATH, or standard system folders), runs the script in the background, and displays the side-by-side Comparison table, raw Python output, and agreement verdict directly inside Variance;
    • Open in editor: writes the .py script and companion .csv data to a temporary folder and opens the script in your default editor;
    • Save script & data…: saves both files to a folder of your choice for archiving or publication supplementary materials.

Running the script requires Python 3 with NumPy and SciPy 1.9 or later installed (pip install numpy scipy); with an older SciPy, the script stops at once and says so. At the end of the run, the script prints the Python, NumPy, and SciPy versions alongside the comparison table.

What is covered#

Check in Python… covers all 49 analyses in Variance:

  • Describe and explore: Descriptive Statistics, Normality Tests, Per-Row Summary, Frequency Distribution, Observed vs. Expected Frequencies, Curve Smoothing / Derivative / Integral, Outlier Detection (ROUT & Grubbs), Area Under Curve, Principal Component Analysis (PCA), Hierarchical Clustering, k-Means Clustering;
  • Compare groups: Two-Group Comparisons (t, Welch, Mann-Whitney, paired t, Wilcoxon), One-Sample Tests, One-Way ANOVA (ordinary, Welch/Brown-Forsythe, Kruskal-Wallis, repeated measures, Friedman, and post-hoc multiple comparisons), Two-Way ANOVA (ordinary with multiple comparisons), Three-Way ANOVA (ordinary and matched REML mixed model), Row-by-Row t Tests, Multiple P Values (FDR), Nested t Test, Nested One-Way ANOVA, Contingency Table Tests, McNemar's Test, Bland-Altman Agreement, ROC Curve;
  • Curves, regression and survival: Correlation (Pearson / Spearman), Simple Linear Regression, Multiple Linear Regression (OLS and Poisson), Deming Regression, Simple & Multiple Logistic Regression, Cox Proportional Hazards Regression (Efron/Breslow ties, Harrell's C, Schoenfeld residuals), Nonlinear Regression and Standard Curve Interpolation (built-in and custom explicit, implicit, or differential equations, asymptotic and profile-likelihood confidence intervals), Spline / LOWESS curves, Plot a Function, Survival Curves (Kaplan-Meier, log-rank, Gehan-Breslow-Wilcoxon, hazard ratios);
  • Process and simulate: Transform (standard, pharmacological, and custom expressions), Rescale X (Concentrations), Normalize, Baseline Subtraction and Column Arithmetic, Share of Total, Thin Out Rows, Transpose Table, Reshape Table, Filter Rows and Compute Variables, Random XY Data, Random Groups, Random 2×2 Table, and Monte Carlo Simulation.

Like Check in R…, Variance's automated integration tests generate thousands of randomized cases across all 49 analyses (in English and French, with decimal point or decimal comma), execute them in Python (NumPy/SciPy), and require every compared value to match Variance.


Copying to another program: the Copy button#

The Output group of the ribbon ends with three small buttons: Export to PowerPoint, Export to Word and Copy. The Copy button copies the whole sheet displayed to the clipboard, whatever the selection:

  • graph or layout: on Windows, both a lossless vector Enhanced Metafile (EMF) (preferred by Word, PowerPoint, and vector editors) and a 300 dpi PNG/bitmap (used by browsers and raster editors) are placed on the clipboard simultaneously; on macOS and Linux, a 300 dpi picture is copied;
  • data table: the text of the whole table, tab-separated, with the title row (like the text export, excluded values followed by an asterisk); paste it into a spreadsheet or a document;
  • results: the displayed tab (results page or output table), tab-separated;
  • Notes sheet: the constants (name, tab, value) then the notes.

For text, the status bar confirms "Sheet copied to the clipboard: paste it in a spreadsheet or a document". The decimal separator follows Preferences › Saving and Printing › Decimal separator (copy and export) (system regional setting by default). An empty sheet answers "Nothing to copy on this sheet".

This button is different from Edit › Copy (Ctrl+C), which copies the selection: the selected cells of a table (see "Copy, cut and paste" in the chapter "Data tables"), the tab of a results sheet, or, on a graph or a layout, the selected objects (texts, shapes, pictures…) to paste them into another graph or layout. A graph selected on a layout is copied as a picture, and so is a graph or a layout with no object selected.


Sending to Word or PowerPoint#

File › Export › To Word (Ctrl+Shift+W) and File › Export › To PowerPoint (Ctrl+Shift+P), or the buttons of the ribbon's Output group, open the Export to Word (.docx) / Export to PowerPoint (.pptx) options dialog. You can choose which sheets to include (current sheet, linked family, selected sheets, all graphs and layouts, or entire project), the figure format (PNG at 150/300/600 dpi with optional transparency, or Vector EMF for Microsoft Office), and layout options (A4/Letter, portrait/landscape, figure width, page breaks, titles for Word; 16:9/4:3 slide ratio, titles, table rows per slide for PowerPoint).

  1. Choose File › Export › To Word (Ctrl+Shift+W) or To PowerPoint (Ctrl+Shift+P).
  2. Adjust the sheet scope, figure format, and page/slide layout options.
  3. Click Create & Open to generate a temporary document and launch it immediately, or Save As… to write the .docx or .pptx file directly to a folder of your choice.

What the document contains.

SheetIn Word (.docx)In PowerPoint (.pptx)
Graph, layouta caption (the sheet's name) and the picture at 300 dpi; a picture wider than the text column is reducedone slide per picture
Data tablea caption and the whole table (titles included) as an editable Word tablethe table, spread over as many slides as needed
Resultsone table per results tab, preceded by "name - tab"same, over several slides
Notes sheetthe table of constants, then the notes with their formatting (bold, italic, links…)same

The documents are standard Office Open XML packages, readable by Microsoft Office, LibreOffice and Google Docs. They are not linked to the project: they are copies.


Sending by e-mail#

File › Email offers Project, Linked Sheets and Sheet; the ribbon's Output group has an e-mail button with Send the Sheet (PDF) by E-mail… and Send the Project by E-mail…; the Linked sheets menu has Email.

  • Sheet: the active sheet (graph, layout, table, results, Notes sheet), as a PDF (laid out as for printing: see "Printing and creating a PDF");
  • Linked sheets: a project reduced to the sheets linked to the active sheet, in .var format;
  • Project: a copy of the entire project, in .var format.

Variance writes the file in the temporary folder ("Variance" subfolder), opens a new message in the default mail program (subject = the file's name, text "Please find attached …") and shows the file in the file explorer, ready to be dragged into the message. The status bar says "New message started: attach" followed by the path.


Printing and creating a PDF#

The Print window#

File › Print… (Ctrl+P, or the print button of the ribbon's Output group) opens the Print window. File › Print to PDF… opens the same window with A PDF file already chosen, and Sheet › Linked Sheets › Print sets it to the linked sheets.

Print: (what to print):

  • The current sheet: the displayed sheet;
  • The sheet and its linked sheets: the sheet and all those linked to it (see "Linked sheets" in the chapter "Layouts, results and notes sheets");
  • The N sheets selected in the navigator: visible when several sheets are selected in the navigator (see "Selecting several sheets" in the chapter "The interface"); this is the choice proposed automatically in that case;
  • Every graph and layout;
  • The whole project.

Below the choices, a grayed line gives "N sheet(s)": the number of sheets that will be printed. If there is no active sheet, the first two choices are grayed and The whole project is proposed automatically.

To: (where to print):

  • The printer: the action button is called Print;
  • A PDF file: the button is called Save PDF…; it asks for a file name (export folder of the preferences; proposed name: the sheet's name if a single sheet is printed, otherwise "Variance.pdf"). The status bar shows "PDF saved:" followed by the path.

The Printer… button of the window (like File › Printer… and the page setup button of the ribbon's Output group) opens the system's printer settings (under Windows, the printers window). Cancel closes.

What is printed#

All the chosen sheets are laid out and assembled into a single PDF document; this PDF is what is sent to the printer or saved.

  • Graph: on an A4 page (portrait, or landscape if the graph is clearly wider than tall), with the sheet's name at the top and a page number. The graph is reduced to fit the page with its margins, never enlarged.
  • Layout: one page, at the layout's size and in its orientation (see "The page size" in the chapter "Layouts, results and notes sheets"), with no added header. This is the right choice for a composite figure.
  • Data table, results: a table paginated on A4, with a title, the title row repeated at the top of each page, alternate rows in light gray and a page number. Each results tab becomes a table.
  • Notes sheet: the table of constants, then the notes with their formatting.

Printing on paper: how it works#

Variance writes the PDF in the temporary folder, then hands it to the program associated with PDF files in the system with the "Print" command (under Windows), or to the lp command (macOS, Linux). There is no printer dialog in Variance: printing goes to the system's default printer. The status bar announces "Sent to the printer" followed by the path of the temporary PDF.


Scripts#

What scripts are for#

A script is a small program, written as text, that chains commands you would otherwise do by hand: go to a sheet, import a file, recompute, read a value in the results, export a graph. It is used to repeat the same operation on fifty files, to rerun a simulation a hundred times noting a result each time (the Monte Carlo method), to produce all the figures of a project in several formats, or to update a project when it opens.

Scripts are .vrs files (the .txt extension is also accepted when opening), which can also be stored in the project and run automatically when the project opens or closes. The language is deliberately simple: one command per line, with no variables or tests.

The language: general rules#

  • One command per line, with its arguments separated by commas and/or spaces: Import donnees.csv, 1, 1 is equivalent to Import donnees.csv 1 1. Put quotes around an argument that contains spaces or commas: SetPath "C:\mes données".
  • Command names are not case-sensitive: GoTo, goto and GOTO are identical.
  • Comments: // to the end of the line, /* … */ on one or several lines. A // between quotes is text, not a comment.
  • Loops: ForEach n … Next repeats the block n times; ForEach pattern … Next repeats the block for each file of the working folder whose name matches the pattern (*.csv, essai_??.txt; * stands for a run of characters, ? for one character, case-insensitive; files are taken in alphabetical order); ForEachSheet … Next repeats the block for each sheet of the current section (that of the last GoTo, D** at the start). Loops can be **nested (a loop inside a loop).
  • Substitutions: in the arguments, %N (or %n) is the iteration number (starting at 1); %F the file name of the iteration, without folder or extension (ForEach pattern loop); %X its extension, without the dot; %S the name of the active sheet. These codes are replaced everywhere, including between quotes: write "50%" with care ("%S" or "%N" stuck after a percent sign would be replaced).
  • Paths: a relative path starts from the working folder, which is: the folder changed by SetPath; otherwise, if the script is launched from the Script window, the folder of the script file (or, failing that, that of the open project, or the system's temporary folder); for a script stored in a project and launched automatically, the project's folder; for variance-cli run, the folder of the script file.
  • Sheets: a sheet is designated by its section (D = data, I = information, R = results, G = graphs, L = layouts) and its number (in navigator order, starting at 1) or its name.
  • Errors: the script stops at the first error, with a message "line N: …" (line number). What has already been done stays in the project (nothing is saved automatically). An unknown command gives "unknown command 'xxx'".

The Script window#

Tools › Scripts › Script Editor… opens the Script window (empty). Tools › Scripts › Run a Script File… first chooses a .vrs or .txt file (scripts folder of the preferences, Preferences › Folders, Scripts folder) and opens it in the same window.

The buttons of the top bar:

  • ▶ Run: runs the editor's text. The Log (at the bottom) shows the script's messages ("Printed …", "Document created: …"), then "Done: N command(s)"; on error, "Error: line N: …".
  • Open…: loads a script file into the editor.
  • Save…: saves the editor's text to a .vrs file ("script.vrs" proposed).
  • Store in Project: saves the editor's text among the project's scripts; for a script loaded from the project, the button becomes Update in Project (updates that script) and Store as New creates a new one (see below).
  • Project scripts: menu of the scripts stored in the project; clicking a name loads the script into the editor (with its automatic-run boxes); the ✖ button next to it removes it from the project.
  • Examples: two examples to adapt, Monte Carlo simulation and Repeatedly import files.

Below the buttons, the line "When stored in the project, run automatically:" offers the boxes when the project opens and when it closes, then the monospaced text editor.

Scripts stored in the project#

Store in Project copies the editor's text into the project, under the name "Script 1", "Script 2"… (the first free number), with the state of the two boxes at the time of the click. Scripts travel with the .var file. To modify a stored script: Project scripts menu, click its name (it loads into the editor, with its boxes), modify it, then click Update in Project: the script is replaced under the same name. Store as New instead saves it as a new script; ✖ removes a script from the project; a script cannot be renamed. Then save the project (Ctrl+S).

Automatic execution. When opening a project that contains scripts marked when the project opens or when it closes, Variance first asks for permission (Project scripts window: "This project contains scripts that run automatically when it is opened or closed. A script can modify the project and write files. Allow these scripts to run?").

  • Yes: the "on open" scripts run right away, in the order in which they were stored, from the project's folder; a script that fails does not prevent the following ones; the status bar shows "Project scripts:" followed by the last line of the log. The "on close" scripts will run when you close the project (or quit Variance).
  • Cancel: the project opens without running any script, neither on open nor on close.

The commands#

Arguments in square brackets are optional.

Folder, project.

CommandEffect
SetPath folderchanges the working folder (relative paths, ForEach pattern)
SetProjectName namedefault name for the next Save without an argument: "nom.var" in the working folder
Save [file]saves the project: as file if given, otherwise under the name from SetProjectName, otherwise at the project's current path ("choose a file name" error if the project has none)
Open fileopens a project or imports supported tables from a .prism file. Replaces the current project without asking
Closecloses the project: an empty project replaces it, without saving

Navigation.

CommandEffect
GoTo section [sheet]activates a sheet: section D, I, R, G or L (one letter); sheet = number (1 by default) or name. Remembers the section for ForEachSheet
GoTo +activates the next sheet of the current section (error if there is none)

Data.

CommandEffect
Import [file] [row] [column]imports a text file or a workbook into the active data table, at the given row and column (1 and 1 by default; column 0 is the X or row-labels column). Without a file name, uses the file of the ForEach pattern loop. Uses the program's default import options (separator, titles and first column detected, missing values NA, N/A, ., NaN and -, asterisks = excluded), not those you saved with Save these settings as the default. The targeted cells are overwritten
InsertData [row] [column] followed by a <data> … </data> blockinserts the rows of the block (values separated by tabs or commas) into the active table
ClearTable [row, column, subcolumn]with no argument, clears the whole table (values and row labels); with arguments, clears a single cell (column = data set number, subcolumn = replicate number)
SetYReplicates nsets the number of subcolumns (replicates) of the active table
DeleteAllDataSetsdeletes all the data sets of the active table
DuplicateDataTable [Clear]duplicates the active table; with Clear, the copy is emptied of its values
DuplicateFamily prefix [Clear]duplicates the linked sheets of the active sheet (table, graphs, analyses…), with the given prefix for the names; Clear empties the copied table
Regenerateredoes the simulation of the active results sheet (new random numbers), like Run Simulation Again
RecalcAllrecomputes all the analyses of the project

ImportLink imports like Import, then links the table to the file ("insertion" link, see "Linked files and updating"): the table is reimported each time the file changes. InsertDataLink does the same as InsertData: the data is in the script itself, there is no file to link.

Graphs and sheets.

CommandEffect
SetAxisLimits axis, min, max [, intervalle]sets the limits of the X, Y or Y2 axis of the active graph (and the interval of the major ticks for a linear scale)
SetAxisTitle [axis,] titletitle of an axis of the active graph; without an axis, it is the Y axis
SetGraphTitle titletitle of the active graph
ApplyColorScheme nameapplies a palette to the active graph (an unknown name stops the script with an error)
CreateLayout rows, columns, landscape, first, countcreates a layout from the graphs: grid (1 by 1 by default), landscape = 1 for a landscape page (0, portrait, by default), first = number of the first graph to place (1), count = number of graphs (rows × columns by default)
SetSheetTitle namerenames the active sheet
SetInfo value [, key]writes a constant into the first Notes sheet of the project (created if needed): key is the name of the constant (created if it does not exist) or its row number; without a key, it is row 1. Mind the order: the value first, then the key

Exports and sends.

CommandEffect
ExportPDF file, ExportSVG, ExportEPS, ExportPNG, ExportTIF, ExportJPG, ExportBMPexports the active graph or layout. ExportPNG file [, dpi] (same for ExportTIF, ExportJPG, ExportBMP): resolution in dpi, 300 by default; ignored for vector formats. If the name has no extension, the format's extension is added; for ExportSVG, the extension is always .svg
ExportEMF, ExportWMFexport the active graph as EMF or WMF, like the Export window
ExportAllPDF fileexports each graph (not the layouts) as PDF, into the folder of file, under the names "name_01.pdf", "name_02.pdf"… where name is the name of file without extension
ExportTable file [All]exports the active data table or results; the format depends on the extension (csv, txt or xml for a table; csv, txt or html for results), as for File › Export › This Sheet…; with All, writes all the tables of the project to an XML exchange file
Printprints the active sheet (default printer, see "Printing and creating a PDF")
SendToWord, SendToPPcreates and opens a Word or PowerPoint document with the active sheet

Exports by script always use the default settings: RGB color, non-transparent background, LZW-compressed TIFF. The color model and transparency cannot be set by script. The format is determined by the command's name, not by the extension: ExportPNG figure.jpg writes PNG into a file named .jpg.

Script result tables. A script that loops over files or simulations generally wants to note one result per iteration. For this it fills an output table.

CommandEffect
Table type [option]starts an output table. Table Text [separator] (tab by default), Table CSV [separator] (comma) and Table HTML write into the file opened by OpenOutput; Table XML [file] writes an XML file ("output.xml" by default); any other word, for example Table Variance [n], creates in the project a data table of the One factor type named "Script output", with one data set per column (or, if n is given, replaces the n-th data table of the project). Table SQL is not available
WTable title, valuewrites value (a text or a number) into the column title of the current row; the column is created on first use
WTable title, row, column [, subcolumn]writes into the column title the value of a cell of the active sheet: for results, the row and column of the first tab (starting at 1); for a data table, the row, the data set and the replicate; for an Notes sheet, the constant at the given row
NextRowmoves to a new row of the output table
EndTableends the output table and writes it

A new row is also started at the end of each iteration of a loop, and when you write into a column already filled on the current row. At the end of the script, the table in progress is written.

Text output file.

CommandEffect
OpenOutput fileopens a text output file (written on closing or at the end of the script; a file already open is written first)
CloseOutputwrites and closes the output file
WText text [&]writes a text; & as the last argument suppresses the final line break
WTitle [&]writes the name of the active sheet
WDate [&]writes today's date (YYYY-MM-DD, in universal time)
WVersion [&]writes "Variance" and the version number
WCell row, column [, subcolumn] [&]writes the value of a cell of the active sheet (same numbers as WTable)
WRow n, WCol column [, first row, last row], WSheet, WBlock row, column [, last row, last column]writes row n, a column, the whole sheet or a block, one output line per line of the selection (cells separated by tabs; WCol writes its column on a single line). Rows count from 1; column 0 holds the row labels (or the labels of the results), column 1 is the first column of values; without an end, the selection goes to the end of the sheet. The old form WCol name, column is still accepted; the variants WTRow, WTCol, WTSheet, WTBlock write the same thing transposed

The Write… commands only act if a file is open through OpenOutput (otherwise "no output file: use OpenOutput first"). Table Text, Table CSV and Table HTML also require a prior OpenOutput.

Miscellaneous.

CommandEffect
Exitstops the script (cleanly, without error)
Beepwrites "Beep" in the log
Copy, Pastedo nothing: write a message in the log (the clipboard is not used by scripts: use an export or SendToWord)
CloseScriptDialog, SetScriptDialogTitle, CreateLogaccepted for compatibility, with no effect

Example 1: importing all the files of a folder#

Each .csv file of the folder is imported into the first table, and a row of results is added to the file "resultats.txt" with the file's name and a value read from the results sheet of an analysis already set up on that table.

// Importer chaque fichier .csv, relever un résultat
SetPath "C:\donnees\experience"
OpenOutput resultats.txt
Table Text
ForEach *.csv
  GoTo D 1
  ClearTable
  Import
  WTable "File", %F
  GoTo R 1
  WTable "P", 5, 2
Next
EndTable

Step by step: SetPath sets the folder; OpenOutput prepares the output file; Table Text announces a tab-separated table; the ForEach *.csv loop runs once per file, %F being the file's name without extension; at each turn, the first table is emptied and receives the file; WTable "File", %F writes the name; GoTo R 1 activates the first results sheet (recomputed automatically after the import); WTable "P", 5, 2 reads there the cell at row 5, column 2 of the first tab, to be adapted to your analysis; EndTable writes the table. The file "resultats.txt" contains a title row (Fichier, P) then one row per file.

Example 2: Monte Carlo simulation#

// Refaire la simulation de la première feuille de résultats 100 fois
// et noter une valeur d'une autre feuille de résultats
Table Variance
ForEach 100
  GoTo R 1
  Regenerate
  GoTo R 2
  WTable "Value", 3, 1
Next

Here Table Variance (any word that is not Text, CSV, HTML or XML) creates a data table in the project: after the run, the "Script output" sheet contains the 100 values, which you can describe or compare like any table (see the chapter "Simulate").

Example 3: producing all the figures#

// Un PDF et un PNG à 600 dpi pour chaque graphe
SetPath "C:\figures"
GoTo G 1
ForEachSheet
  ExportPDF %S.pdf
  ExportPNG %S.png, 600
Next

GoTo G 1 sets the section to graphs; ForEachSheet goes through all the graphs; %S is the sheet's name (if the name contains characters forbidden in a file name, rename the sheet first).

Example 4: a script stored in the project#

For a project to export its main figure automatically when it closes, open Tools › Scripts › Script Editor…, type:

GoTo L 1
ExportPDF Figure1.pdf

tick when it closes, click Store in Project, then save the project. The next time you open it, accept the scripts; on closing, "Figure1.pdf" is written into the project's folder.

Script tips and pitfalls#

  • Test on a copy. Save the project (Ctrl+S) before running a script that modifies tables, or work on a copy (File › Save Other › Copy of the Project…).
  • Start small. Run a loop of 3 iterations before the one of 300, and read the Log.
  • Sheet numbers change. GoTo D 1 designates the first table in navigator order; if you have added, deleted or moved sheets, the script acts on another one. Prefer the sheet's name when it is stable: GoTo R "Table 1 – Two-Group Comparisons" (quotes if the name contains spaces).
  • **Import overwrites.** Put ClearTable before Import when the files do not all have the same number of rows, otherwise the surplus values of the previous file remain.
  • No tests, no variables. The language can neither do an "if" nor compute. If you need calculations, tabulate the values then do the calculation in an analysis.
  • An automatic script is code that runs. Never allow the automatic execution of scripts from an unknown project.

The command-line tool: variance-cli#

variance-cli (variance-cli.exe under Windows) runs batch operations on projects in a terminal, with no window: useful to recompute and export all the figures of a series of projects, for scheduled tasks, or to automate a processing chain. It uses the same engine as the application: a project exported by variance-cli is identical to one exported from the interface (with the default settings).

General syntax: variance-cli command arguments. File and sheet names containing spaces go between quotes. On success the program returns code 0; on error, it writes "error: …" on the error output and returns a non-zero code.

CommandEffect
info projectlists the project's sheets, by section (name, table type and dimensions, analysis and any error, graph type)
recalc project [--save]recomputes all the analyses; warns on the error output for each failed analysis; with --save, saves the project under the same name (it is overwritten)
run script.vrs [--project project] [--save output.var]runs a script; without --project, starts from an empty project; with --save, saves the resulting project (the script can also call Save). Shows the script's log, then "N command(s) executed"
export project sheet output [--format fmt] [--dpi n]exports a graph or a layout (by its name, case-insensitive); with all in place of the sheet, exports all the graphs then all the layouts into the folder output (created if needed), under the names "name_number.ext"
table project sheet outputexports a data table or results; format determined by the extension (csv, txt, xml, html), like File › Export › This Sheet…
convert input output.varconverts a .pzfx / .xml exchange file, supported data tables from a .prism file, or another project into a .var project
demo folder [--format fmt] [--dpi n]creates the demonstration project ("demo.var") and exports its graphs (PNG at 150 dpi by default)
analyseslists the available analyses (by family, with their identifier)
equationslists the equation library
help, --help, -hreminder of usage; --version (or -V) shows the version number

For export, the format is that of --format if given, otherwise that of the output file's extension, otherwise PDF. The recognized format names are pdf, svg, eps, emf, wmf, png, tif (or tiff), jpg (or jpeg), bmp and pcx. Without --dpi, the resolution is 300. Applied to a table or to results, export produces the sheet's paginated PDF (or, for a raster format, the first page).

Examples:

variance-cli info Etude.var
variance-cli recalc Etude.var --save
variance-cli export Etude.var "Figure 1" figure1.pdf
variance-cli export Etude.var all figures --format png --dpi 600
variance-cli table Etude.var "Table 1 – Two-Group Comparisons" resultats.html
variance-cli run traitement.vrs --project Etude.var --save Etude_maj.var
variance-cli convert donnees.pzfx Etude.var

To process all the projects of a folder, under PowerShell:

Get-ChildItem *.var | ForEach-Object { variance-cli export $_.Name all "figures_$($_.BaseName)" --format pdf }

Common mistakes#

  • Importing with the wrong separator. All the columns arrive stuck together in the first one. Look at the preview (View page) and choose Semicolon or Tab.
  • Numbers imported as text. A French file writes "12,5": with the "comma" separator, the decimal comma splits the column. Choose Semicolon if the file uses one, or replace the decimal commas in the file before importing.
  • Column titles taken for data. Set Column titles: to First row of the file on the Placement page.
  • Importing in the wrong place. In an existing table, check Insert at row: and and column (0 = X or row labels):.
  • A linked file that overwrites values typed by hand. See "Linked files and updating": break the link before modifying by hand.
  • A link that no longer finds the file. The path is stored in the project: restore it or break the link.
  • A figure that is blurry when printed. Export as PDF, or as PNG/TIFF at 300 dpi at least.
  • A transparent background that turns black. The destination program does not handle transparency: untick Transparent background.
  • A black-and-white figure that is unreadable. First look at the Grayscale rendering: if two series merge, change their colors or patterns in Variance.
  • A message without an attachment. Variance does not attach the file: drag it from the file explorer.
  • A Word document that cannot be found. Export to Word creates the file in the temporary folder: save it elsewhere from Word.
  • Nothing is printed. Create a PDF then print it from your PDF reader.
  • A script that stops with "line N". Read the line number and the command; check the section name (D, I, R, G, L) and that the sheet exists.
  • Missing results from a loop. EndTable before CloseOutput.
  • EMF and WMF files requested in a script. They are not available by script (an SVG is written instead): export them from the Export window.

Going further#

  • Chapter "Getting started": saving the project, templates, autosave; the complete walkthrough "two groups, from the table to the PDF" (steps 6 to 8).
  • Chapter "The interface": the File menu, the Sheet › Linked Sheets submenu, the ribbon's Output group, the Saving and Printing and Folders preferences.
  • Chapter "Data tables": direct pasting, Paste Special, excluding values, the table types that the import fills.
  • Chapter "Graphs": setting the size, fonts and colors of a graph before exporting it.
  • Chapter "Layouts, results and notes sheets": assembling figures, the page size, exporting notes, linked sheets.
  • Chapter "Simulate": what the simulation that Regenerate repeats by script does.