-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for digits param for each column #190
Conversation
@RomanTsegelskyi are you sure you did not mix up |
@daroczig, I am sorry, got confused with original request in #146 where > mt
drat wt qsec vs
Mazda RX4 3.90 2.620 16.46 0
Mazda RX4 Wag 3.90 2.875 17.02 0
Datsun 710 3.85 2.320 18.61 1
Hornet 4 Drive 3.08 3.215 19.44 1
> pander(mt, digits = 3)
--------------------------------------------
drat wt qsec vs
-------------------- ------ ---- ------ ----
**Mazda RX4** 3.9 2.62 16.5 0
**Mazda RX4 Wag** 3.9 2.88 17 0
**Datsun 710** 3.85 2.32 18.6 1
**Hornet 4 Drive** 3.08 3.21 19.4 1
--------------------------------------------
> xtable(mt, digits = 3)
% latex table generated in R 3.1.3 by xtable 1.7-4 package
% Tue Jun 30 21:57:31 2015
\begin{table}[ht]
\centering
\begin{tabular}{rrrrr}
\hline
& drat & wt & qsec & vs \\
\hline
Mazda RX4 & 3.900 & 2.620 & 16.460 & 0.000 \\
Mazda RX4 Wag & 3.900 & 2.875 & 17.020 & 0.000 \\
Datsun 710 & 3.850 & 2.320 & 18.610 & 1.000 \\
Hornet 4 Drive & 3.080 & 3.215 & 19.440 & 1.000 \\
\hline
\end{tabular}
\end{table} By looking online seems that former is harder to achieve (SO), but IMHO makes a bit more sense than the latter. I was almost successful getting similar same behaviour as we currently have just with vector for > pander(mt, digits = c(1,4,2,0))
---------------------------------------------
drat wt qsec vs
-------------------- ------ ----- ------ ----
**Mazda RX4** 4 2.62 16 0
**Mazda RX4 Wag** 4 2.875 17 0
**Datsun 710** 4 2.32 19 1
**Hornet 4 Drive** 3 3.215 19 1
--------------------------------------------- However, I started wondering if we should keep the current approach or switch to one like in |
I'd stick with the separate I'd go with an approach where both |
I think that is a reasonable suggestion. I fixed the implementation accordingly. It came out a bit more complicated that I expected, due to need to handle matrixes separately because matrix columns can't be formated separately (as soon as first column is formatted all others are formatted too). |
Before only empty 2D objects were converted to |
Looks good, thanks. |
Added support for round/digits param for each column
As requested in #146, added support to format using separate
digits
param for each column.