Inconsistent decimal formatting in numeric table columns despite identical definitions

Everything related to the development of modules in jamovi
Post Reply
GmA
Posts: 13
Joined: Wed Mar 19, 2025 3:23 pm

Inconsistent decimal formatting in numeric table columns despite identical definitions

Post by GmA »

I'm developing a jamovi module (tested on 2.6.26 and 2.7) and experiencing inconsistent decimal place rendering across multiple tables that have identical column definitions and populate code.

Column Definition (YAML):
yaml- name: value
title: 'Value'
type: number

R Code (identical across all tables):
rtable$addRow(rowKey = i, values = list(
category1 = item$cat1,
category2 = item$cat2,
metric = item$metric,
value = round(item$value, 3)
))

Problem:
Despite identical YAML and R code, different tables render the numeric value column with different decimal precision:

Table A: 2 decimal places (2.00, 3.33, 3.00, 2.23)
Table B: 2–3 decimal places (appears to work correctly)
Table C: 5 decimal places (-0.57800, -0.00100, 0.57700, -1.50000)

All three tables use the same column definition and the same round(value, 3) approach. The inconsistency seems to correlate with value magnitude—smaller/negative values get more decimal places.

Question:
Is there a reliable way to enforce consistent decimal precision (exactly 3 places) across all numeric table columns in jamovi? Or is this magnitude-dependent rendering a known platform behaviour?

If it's a limitation, is there a recommended workaround that maintains both right-alignment and consistent precision?
Any guidance appreciated—thanks in advance!

Gm
User avatar
jonathon
Posts: 2910
Joined: Fri Jan 27, 2017 10:04 am

Re: Inconsistent decimal formatting in numeric table columns despite identical definitions

Post by jonathon »

jamovi formats according to the user's preferences. i think you've probably got jamovi set to display numbers to 3 significant figures (see the screenshot below) (https://en.wikipedia.org/wiki/Significa ... nt_figures). jamovi first calculates the number of decimal places such that all values represented in a column -- at a minimum -- are formatted to the requisite number of significant figures.

in the case of

(-0.57800, -0.00100, 0.57700, -1.50000)

you can see that displaying the value .001 to three significant figures requires 5 decimal places to display, which is then applied to all values in the column.

you can change the setting in jamovi to display 3 decimal places if you prefer.


Screenshot 2025-11-16 at 07.42.34.png
Screenshot 2025-11-16 at 07.42.34.png (115.09 KiB) Viewed 1306 times
Post Reply