tryCatch(obistools::plot_map(params$data, zoom = TRUE), error = function(e) e)
maxrows <- 25 qc <- obistools::report_summary(qc, maxrows = maxrows) deps <- c() firstOutliers <- TRUE for (field in names(qc)) { if(startsWith(field, 'Outliers') & firstOutliers) { cat("\n\n") cat('<button style="margin:20px 0px 20px 0px" class="btn btn-primary" data-toggle="collapse" data-target="#outliers"> Show/Hide Outliers </button>') cat("\n\n## Outliers\n\n") #cat('<div id="outliers-div" class="collapse">') firstOutliers <- FALSE } cat("\n\n###", field, "\n\n") errors <- qc[[field]] if(nrow(errors) == maxrows) { cat(paste0("\n\nMore than **", maxrows, "** errors and warnings related to this field were found, the first **", maxrows, "** are printed below and shown on a map whenever possible.\n")) } print(knitr::kable(errors[errors$level != 'debug', c('field', 'row', 'level', 'message')], row.names = FALSE)) mapdata <- data[stats::na.omit(errors$row),, drop=FALSE] if(NROW(mapdata) > 0) { mapplot <- NULL if(startsWith(field, 'Outliers ')) { outliers_info <- errors[errors$level == 'debug',]$extra[[1]] boxplots <- obistools:::plot_outliers_environmental(outliers_info) if(!is.null(boxplots)) { cat("\n\n") print(boxplots) cat("\n\n") } mapplot <- obistools:::plot_outliers_spatial(outliers_info) if(!is.null(mapplot)) { cat("\n\n") cat(htmltools::renderTags(mapplot)$html) deps <- c(deps, htmltools::renderTags(mapplot)$dependencies) cat("\n\n") } } else { try(mapplot <- obistools::plot_map(mapdata, zoom = TRUE)) if(!is.null(mapplot)) { #print(paste0("plot_map ", field)) cat("\n\n") print(mapplot) cat("\n\n") } } } }
# attach the Dependencies # since they do not get included with renderTags(...)$html htmltools::attachDependencies( htmltools::tagList(), deps #unlist(deps,recursive=FALSE) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.