I have a tibble
(the same happened if it were a data.frame
) that has one decimal place in every cell. If I use the command View()
, it works fine:
However, when I use the commands dataTableOutput()
and renderDataTable()
, it doesn't render the last digit if it's .0
.
How can I prevent this? In R documentation there are no arguments that set this (unless I'm really quite blind) in neither part.
This is in my code:
[...]
dataTableOutput(outputId = "beans")
[...]
[...]
output$beans <- renderDataTable({beans})
[...]
Where beans
is the tibble
I defined outside anything (I'm using app.R
). It is:
structure(list(Soil = c(47.9, 47.5, 48.1, 44.4, 46.6, 45.8, 46.7,
47.4, 46.2, 45.9, 43.8, 45, 44.3, 46.4, 45.4, 48.8, 48.2, 48.3,
46.6, 45.2, 46.9, 48, 46.9, 46.6, 46.2, 46.7, 46.5, 45.1, 46.6,
47.1, 45.5, 46.2, 48.5, 46.7, 46.2, 47.2), Fertilizer = c(51,
53.5, 51, 52.5, 54, 53.2, 50.7, 49.8, 50.1, 50.2, 51.7, 51.4,
53.4, 54, 51.6, 51.4, 50.6, 50.9, 52.9, 52.7, 53.3, 52.7, 49.9,
49.3, 51, 50.7, 51.1, 53.5, 52.5, 52.1, 52.4, 51, 51.5, 53.8,
51.6, 52.4), Compost = c(52, 51.2, 51.6, 51.7, 52.4, 52.1, 50.8,
50.8, 50.3, 53.1, 52.3, 52.4, 51, 50.7, 53, 50.8, 51.6, 51, 50.9,
52.7, 49.6, 53.1, 51.8, 51.8, 49.2, 48.7, 53.9, 51.5, 50.7, 49.1,
50.3, 53.2, 53.3, 51.5, 51.3, 52.4)), class = c("spec_tbl_df",
"tbl_df", "tbl", "data.frame"), row.names = c(NA, -36L), spec = structure(list(
cols = list(Soil = structure(list(), class = c("collector_double",
"collector")), Fertilizer = structure(list(), class = c("collector_double",
"collector")), Compost = structure(list(), class = c("collector_double",
"collector"))), default = structure(list(), class = c("collector_guess",
"collector")), skip = 1), class = "col_spec"))