
Last chance! 50% off unlimited learning
Sale ends in
This is method for rendering results of tables/fre/cro in Shiny. For detailed description of function and its arguments see datatable.
datatable(data, ...)# S3 method for etable
datatable(data, repeat_row_labels = FALSE,
show_row_numbers = FALSE, digits = getOption("expss.digits"), ...)
further parameters for datatable
logical Should we repeat duplicated row labels in the every row? Default is FALSE.
logical Default is FALSE.
integer By default, all numeric columns are rounded to one digit after
decimal separator. Also you can set this argument by option 'expss.digits'
- for example, option(expss.digits = 2)
. If it is NA than all
numeric columns remain unrounded.
Object of class datatable
htmlTable for knitting
# NOT RUN {
data(mtcars)
mtcars = apply_labels(mtcars,
mpg = "Miles/(US) gallon",
cyl = "Number of cylinders",
disp = "Displacement (cu.in.)",
hp = "Gross horsepower",
drat = "Rear axle ratio",
wt = "Weight (1000 lbs)",
qsec = "1/4 mile time",
vs = "Engine",
vs = c("V-engine" = 0,
"Straight engine" = 1),
am = "Transmission",
am = c("Automatic" = 0,
"Manual"=1),
gear = "Number of forward gears",
carb = "Number of carburetors"
)
mtcars_table = mtcars %>%
tab_cols(total(), am %nest% vs) %>%
tab_cells(mpg, hp) %>%
tab_stat_mean() %>%
tab_cells(cyl) %>%
tab_stat_cpct() %>%
tab_pivot()
library(shiny)
shinyApp(
ui = fluidPage(fluidRow(column(12, DT::dataTableOutput('tbl')))),
server = function(input, output) {
output$tbl = DT::renderDataTable(
datatable(mtcars_table)
)
}
)
# }
Run the code above in your browser using DataLab