r - Horizontal scrolling in Rmarkdown -
i have wide table many columns able display neatly horizontal scroll in r-markdown. have read documentation , tried following
```{css} pre code, pre, code { overflow-x: scroll !important; } ```
as setting options(width = 1000)
in code chunk. both methods fail.
kable(mat)
) displays row names , column names stacked on top of each other, avoid x-overflow
any recommendations appreciated. here full dataset:
> dput(mat) structure(list(`jul 2016` = c(0.108624566189299, 1.76516237793691, 0.24654630490587, 0.336005341665282, 1.00201353799076, 1.36940398901225, 3.66411692441857, 0.927558916609414, 0.691046979743987, 0.450146262999624, 0.917686009737563, 0.140224124770612, 0.843074107500625, 1.05518907118113 ), `aug 2016` = c(0.495219146367162, 0.391441250685602, 1.54749462052876, 0.173654376994818, 0.633756110444665, 0.631372984033078, 0.18316258961296, 0.182683125603944, 3.05005361690094, 3.94560365916646, 1.23740167125376, 0.104842279106379, 1.19900375879825, 0.885420372667623), `sep 2016` = c(0.233641386257531, 0.0033428730592414, 0.750113554504904, 3.29350166751032, 0.321632610633969, 0.147915420588106, 0.588389918208122, 0.448350375518203, 0.11338227847591, 0.183331309817731, 0.503199412953109, 0.171937711299566, 1.95316866590622, 0.104802044216859), `oct 2016` = c(0.739911493734554, 1.11888734619589, 0.84596463195504, 1.11839738455811, 0.217166714049797, 3.77456121684468, 2.30912737349484, 0.587557188700885, 1.47151514614042, 2.22869711170409, 0.922314693177951, 0.471901882905513, 0.534924456384033, 0.0313225598150482 ), `nov 2016` = c(1.85388414180818, 2.55487188870523, 0.0862376162762327, 0.346423422452062, 1.51655351548436, 2.49406717891309, 2.30299281056283, 0.263112519867718, 0.00580294150859118, 0.185066258069128, 0.0903926742270416, 2.37662858317111, 3.73288818241513, 0.0573666100390255), `dec 2016` = c(0.313190717250109, 0.307465369347483, 0.239482162054628, 1.01155032901168, 2.39428096810792, 1.94335110663416, 1.13592004678668, 1.42108202717247, 0.710517601505195, 1.61591860465599, 0.455696674063802, 1.07137738536568, 0.621122478507459, 0.618124924134463), `jan 2017` = c(0.649377639405429, 1.83437980516794, 0.297817176467259, 0.858038477557612, 1.49970549750212, 0.308495274279267, 0.0211296189621441, 0.492535644210875, 0.161597543573384, 0.676304758060724, 1.76788817649841, 0.550365904346108, 0.995464661116612, 1.13094686947322 ), `feb 2017` = c(0.198544207034127, 0.774353488306415, 0.138672931585461, 0.420741511508822, 5.6814887264918, 1.73189786999466, 2.79930100191574, 0.340402969624847, 1.39306524879292, 0.21201393196603, 0.0833668480627239, 1.18146268087895, 0.418718740344048, 1.19787603798778), `mar 2017` = c(2.09939065147947, 2.97548833472614, 2.11208846593711, 0.485648008773732, 1.05899326592208, 5.68802214045531, 0.78282427131654, 1.79497248670998, 0.941131940139789, 0.00790881412103772, 2.83165551371601, 0.424321911297739, 1.32597267344118, 0.846728059421194), `apr 2017` = c(0.274038907606155, 0.609476356767118, 1.03544399231197, 0.152570991776884, 0.339995595626533, 0.119376386050135, 2.69392074818227, 0.813008557963085, 0.115333137568086, 2.11701883921835, 2.56948147142742, 0.689078038092703, 0.70200188826294, 1.77652035201243 ), `may 2017` = c(1.27068436700375, 0.0606693171930701, 0.223359284922481, 1.24367935671927, 0.0387959590379592, 0.080388783942908, 0.265470865182579, 0.0740235898768298, 4.56730645625964, 0.232464682413259, 2.11742714593623, 2.0478821661256, 1.24304682384701, 0.660282246768475), `jun 2017` = c(0.962065315763366, 0.927825206740443, 0.235446563770117, 1.92433465077522, 0.629580335691571, 0.343002805951983, 0.424926831386983, 0.280481974128634, 0.329299085657779, 2.41983439671075, 0.570362926460803, 1.85204407244592, 0.603411518032043, 0.924501490833573), `jul 2017` = c(1.60951108251061, 1.03197320811326, 0.98342213775487, 0.493952827528119, 0.278958274768225, 0.228817364528904, 0.287614235659573, 0.324104877188802, 0.394792452454567, 2.14486608711631, 0.206482742447406, 2.98590822501068, 0.0209106279733035, 1.14526769700916 ), `aug 2017` = c(2.55301682452176, 0.280766402836889, 1.13620263706417, 0.976574084679496, 1.12200299925627, 2.1722190325201, 0.0616904203336536, 2.1899062039933, 1.16009358405591, 1.51088082985876, 0.735464695799065, 0.0305269896052778, 3.94500710607922, 0.940294581629341)), .names = c("jul 2016", "aug 2016", "sep 2016", "oct 2016", "nov 2016", "dec 2016", "jan 2017", "feb 2017", "mar 2017", "apr 2017", "may 2017", "jun 2017", "jul 2017", "aug 2017"), row.names = c("jul 2016", "aug 2016", "sep 2016", "oct 2016", "nov 2016", "dec 2016", "jan 2017", "feb 2017", "mar 2017", "apr 2017", "may 2017", "jun 2017", "jul 2017", "aug 2017"), class = "data.frame")
have tried datatables? r data objects (matrices or data frames) can displayed tables on html pages, , datatables provides filtering, pagination, sorting, , many other features in tables.
wiki
Comments
Post a Comment