Skip to content
Snippets Groups Projects
Commit 10323acb authored by Eduardo E. R. Junior's avatar Eduardo E. R. Junior
Browse files

Exibe help estático, sem a necessidade de especificação de porta

parent 360a703b
No related branches found
No related tags found
No related merge requests found
##-------------------------------------------
## server.R
library(shiny)
library(xtable)
......@@ -12,7 +15,18 @@ howmanydigits <- function(x) {
}
}
shinyServer(function(input, output) {
static_help <- function(pkg, topic, out,
links = tools::findHTMLlinks()) {
pkgRdDB = tools:::fetchRdDB(file.path(
find.package(pkg), 'help', pkg))
force(links)
tools::Rd2HTML(pkgRdDB[[topic]], out, package = pkg,
Links = links, no_links = is.null(links))
}
shinyServer(
function(input, output, session) {
output$TABLE <- renderPrint({
da <- eval(parse(text = input$DATASET))
a <- switch(class(da),
......@@ -41,11 +55,12 @@ shinyServer(function(input, output) {
row.names = FALSE,
quote = FALSE)
})
output$LINK <- renderUI({
HTML(sprintf(paste0('<center><a href="http://127.0.0.1:%d',
'/library/labestData/html/%s.html" target="_blank">',
'Documentação</a></center>'),
input$PORTA,
input$DATASET))
})
output$DOC <- renderPrint({
tmp <- tempfile()
static_help("labestData", input$DATASET, tmp)
out <- readLines(tmp)
headfoot <- grep("body", out)
cat(out[(headfoot[1] + 1):(headfoot[2] - 2)], sep = "\n")
})
}
)
##-------------------------------------------
## ui.R
library(shiny)
library(xtable)
library(labestData, lib.loc = "/home/walmes/R/")
library(labestData, lib.loc = installed.packages()["labestData", 2])
L <- ls("package:labestData")
i <- sapply(L,
......@@ -16,6 +18,7 @@ shinyUI(fluidPage(
h3("Conjuntos de Dados para Ensino de Estatística"),
tags$em("pet.estatistica.ufpr@gmail.com"),
hr(),
sidebarLayout(
sidebarPanel(
selectInput(inputId = "DATASET",
......@@ -23,16 +26,20 @@ shinyUI(fluidPage(
choices = L,
selected = sample(1:length(L))),
hr(),
numericInput(inputId ="PORTA",
label = "Porta:",
value = options()$html.port),
uiOutput("LINK"),
hr(),
downloadButton(outputId = "DOWNLOADDATA",
label = "Download tsv")
),
mainPanel(
htmlOutput("TABLE")
) # mainPanel
) # sidebarLayout
)) # fluidPage shinyUI
tabsetPanel(
tabPanel(
title = "Tabela de dados",
htmlOutput("TABLE")),
tabPanel(
title = "Documentação",
htmlOutput("DOC")
)
)
)
)
)
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment