You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

65 lines
2.3 KiB

tableUI <- function(id) {
ns <- NS(id)
tagList(dataTableOutput(ns("errtable")),
downloadButton(ns("downloaderr"),"Download Full Data"))
}
tableServer <-
function(id,
filepath="./contacts/errors/length", country) {
moduleServer(id,
function(input, output, session) {
ns <- session$ns
manderrdf<- reactive({
manderrfilepath <-
list.files(filepath,
pattern = "*.csv",
full.names = T)
manderrfiles <- lapply(manderrfilepath, read.csv)
a <- do.call(ltodf, manderrfiles)
if( "CountryRegion" %in% colnames(a)){
a<-a |>
filter(CountryRegion %in% country)
}
if("cntr" %in% colnames(a)){
a<-a |>
filter(cntr %in% country)
}
a
})
output$errtable <- renderDataTable({
datatable(
manderrdf(),
#extensions = "Buttons",
filter = 'top',
options = list(
paging = TRUE,
scrollX = TRUE,
searching = TRUE,
ordering = TRUE,
#dom = 'Bfrtip',
#buttons = c('copy', 'csv', 'excel', 'pdf'),
pageLength = 5,
# lengthMenu = c(3, 5, 10),
filter = TRUE
)
)
})
output$downloaderr<- downloadHandler(
filename = function() {
paste(country,"_", gsub("./","_",filepath), ".csv", sep="")
},
content = function(file) {
write.csv(manderrdf(), file, row.names = FALSE)
}
)
})
}