I have created this reactive dashboard: https://lexbit.shinyapps.io/dashboard/.
I want to open the url in a new windows and download the document. You can make this manually, but when I click on the url, the url opens with the domain name of my dashboard. For example:
An I want only "servicio.indecopi.gob.pe/buscadorResoluciones/getDoc?docID=workspace://SpacesStore/75c8f179-e601-4928-a000-65e41446c048 " (this give a pdf).
How can I solve this? This is my code:
`
library(shiny)
library(DT)
#setwd("C:/Users/Abner/Desktop/Projects/GitHub/ShinyLexBit")
##### ####
data <- read.csv('data/competencia_desleal_v2.csv', sep = ",")
data <- data[, !names(data) %in% c("Sumilla", "Partes")] ## Saque columnas que son muy anchas
data$Enlace <- paste0("<a href='",data$Enlace,"' target='_blank'>",data$Enlace,"</a>")
#download
#### SHINY UI ###
ui <- fluidPage(
titlePanel("Resoluciones"),
fluidRow(
lapply(names(data)[5:length(names(data))], function(col) { ## Exclude first four columns
column(width = 3,
selectInput(paste0("filter_", col), paste(col, "Filter"), choices = c("Todos", "Si", "No")))
})
),
DTOutput("table"),
tags$head(
tags$style(HTML("
.dataTables_wrapper .dataTables_filter input {
width: 100%;
height: 40px;
font-size: 16px;
text-align: center;
margin-bottom: 10px;
}
.dataTables_wrapper .dataTables_filter label {
text-align: center;
width: 100%;
}
"))
)
)
server <- function(input, output) {
filtered_data <- reactive({
data_filtered <- data
for (col in names(data)[5:length(names(data))]) { ## Exclude first four columns
if (!is.null(input[[paste0("filter_", col)]])) {
filter_value <- input[[paste0("filter_", col)]]
if (filter_value != "Todos") { ## Change from "All" to "Todos"
data_filtered <- data_filtered[data_filtered[[col]] == filter_value, ]
}
}
}
return(data_filtered)
})
output$table <- renderDT({
datatable(filtered_data(), selection = "none",
options = list(
language = list(
search = "Buscar",
lengthMenu = "Ver _MENU_ entradas"
)
), escape = FALSE)
})
}
shinyApp(ui = ui, server = server)`
A code to solve the problem