Let’s define a data frame that contains two columns of values (one small and one large). After creating a simple gt table from small_large_tbl we’ll call fmt_scientific() on both columns.
The default method of styling the notation uses the ‘m x 10^n’ construction but this can be changed to a ‘mEn’ style via the exp_style argument. We can supply any single letter here and optionally affix a "1" to indicate there should not be any zero-padding of the n value. Two calls of fmt_scientific() are used here to show different options for styling in scientific notation.
Taking a portion of the reactions dataset, we can create a gt table that contains reaction rate constants that should be expressed in scientific notation. All of the numeric values in the filtered table require that type of formatting so fmt_scientific() can be called without requiring any specification of column names in the columns argument. By default, the number of decimal places is fixed to 2, which is fine for this table.
The constants table contains a plethora of data on the fundamental physical constants and values range from very small to very large, warranting the use of figures in scientific notation. Because the values differ in the degree of measurement precision, the dataset has columns (sf_value and sf_uncert) that include the number of significant figures for each measurement value and for the associated uncertainty. We can use the n_sigfig argument of fmt_scientific() in conjunction with the from_column() helper to format each value and its uncertainty to the proper number of significant digits.