Aligning decimal values of string matrix. Allowed alignments are: dec_left
, dec_right
,
and decimal
.
Details
Left and right decimal alignment (dec_left
and dec_right
) differ from center decimal
alignment (decimal
) only when there is padding present. This may occur if column widths are
set wider via parameters widths
in toString
or colwidths
in paginate_*
. More commonly,
it also occurs when column names are wider. Cell wrapping is not supported when decimal
alignment is used.
Examples
dfmf <- basic_matrix_form(mtcars[1:5, ])
aligns <- mf_aligns(dfmf)
aligns[, -c(1)] <- "dec_left"
decimal_align(mf_strings(dfmf), aligns)
#> rnms mpg cyl disp hp drat wt qsec vs
#> [1,] "" "mpg" "cyl" "disp" "hp" "drat" "wt" "qsec" "vs"
#> [2,] "Mazda RX4" "21 " "6" "160" "110" "3.9 " "2.62 " "16.46" "0"
#> [3,] "Mazda RX4 Wag" "21 " "6" "160" "110" "3.9 " "2.875" "17.02" "0"
#> [4,] "Datsun 710" "22.8" "4" "108" " 93" "3.85" "2.32 " "18.61" "1"
#> [5,] "Hornet 4 Drive" "21.4" "6" "258" "110" "3.08" "3.215" "19.44" "1"
#> [6,] "Hornet Sportabout" "18.7" "8" "360" "175" "3.15" "3.44 " "17.02" "0"
#> am gear carb
#> [1,] "am" "gear" "carb"
#> [2,] "1" "4" "4"
#> [3,] "1" "4" "4"
#> [4,] "1" "4" "1"
#> [5,] "0" "3" "1"
#> [6,] "0" "3" "2"