Skip to contents

Aligning decimal values of string matrix. Allowed alignments are: dec_left, dec_right and decimal.

Usage

decimal_align(string_mat, align_mat)

Arguments

string_mat

character matrix. String matrix component of matrix print form object.

align_mat

character matrix. Aligns matrix component of matrix print form object. Should contain either dec_left, dec_right or decimal for values to be decimal aligned.

Value

Processed string matrix of matrix print form with decimal aligned values.

Details

Decimal alignment left and right (dec_left and dec_right) are different to center decimal alignment decimal only in the case some padding is present. This may happen if column widths are wider by setting parameters widths in toString or colwidths in paginate_* accordingly. It will be also the case (more common) of wider column names. Decimal alignment is not supported along with cell wrapping.

See also

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"