-
Notifications
You must be signed in to change notification settings - Fork 1
/
buzz.table.R
21 lines (16 loc) · 906 Bytes
/
buzz.table.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'buzz.table' <- function(dataset, prefix, title) {
# Display raw data table for Buzzard's Bay app
# Arguments:
# dataset selected rows of dataset for sensor or grab sample data
# prefix prefix to sample variable names ('' for sensor, 'Grab_' for grab samples)
# title table title
# B. Compton, 28 Aug 2024
row.names(dataset) <- 1:dim(dataset)[1]
datatable(dataset[, c('Date_Time', paste0(prefix, c('DO', 'DO_Pct_Sat', 'Temp_CondLog')))],
colnames = c('Date and time', 'DO (mg/L)', 'Temperature (C)'),
caption = htmltools::tags$caption(style = 'caption-side: top', HTML(paste0('<h5><b>', title, '</b></h5>'))),
options = list(dom = 'ltipr')) |>
formatDate('Date_Time', 'toLocaleString') |>
formatRound(paste0(prefix, 'DO'), 2) |>
formatRound(paste0(prefix, 'Temp_CondLog'), 1)
}