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

Adiciona filtros para obras (nome de autor) e keywords

parent ebb3edd7
No related branches found
No related tags found
No related merge requests found
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
library(xtable) library(xtable)
library(labestData) library(labestData)
L <- ls("package:labestData") data(keywords, package = "labestData")
i <- sapply(L, function(x) { keywords$obra <- gsub(
class(eval(parse(text = x))) pattern = "^([A-Z]{1}[a-z]*)[A-Z]{1}[a-z]{1}.*$",
}) replacement = "\\1",
L <- L[i %in% c("data.frame", "numeric", "integer")] x = keywords$name)
howmanydigits <- function(x) { howmanydigits <- function(x) {
x <- na.omit(x) x <- na.omit(x)
......
...@@ -8,13 +8,62 @@ shinyServer( ...@@ -8,13 +8,62 @@ shinyServer(
vers <- as.character(packageVersion("labestData")) vers <- as.character(packageVersion("labestData"))
tagList( tagList(
h1(paste("labestData: Biblioteca de dados para", h1(paste("labestData: Biblioteca de dados para",
"Ensino de Estatística"), class = "title"), "aprendizado de Estatística"),
class = "title"),
h2(paste("PET-Estatística UFPR - Versão", vers), h2(paste("PET-Estatística UFPR - Versão", vers),
class = "title"), class = "title"),
hr() hr()
) )
}) })
## Cria listbox para seleção das obras
output$OBRAUI <- renderUI({
CHOICES <- c("Todas" = "", sort(keywords$obra))
selectInput(inputId = "OBRA",
label = "Escolha a(s) obra(s)",
choices = CHOICES, multiple = TRUE)
})
## Cria listbox para seleção das keywords
output$KEYSUI <- renderUI({
CHOICES <- c("Todas" = "", levels(keywords$keyword))
selectInput(inputId = "KEYS", label = "Keyword(s)",
choices = CHOICES, multiple = TRUE)
})
## Separa o conjunto de dados com base nos filtros
DATACHOICE <- reactive({
OBRA <- input$OBRA
KEYS <- input$KEYS
if (is.null(OBRA) & is.null(KEYS)) {
DATA <- keywords
}
if (is.null(OBRA) & !is.null(KEYS)) {
DATA <- subset(keywords, keyword %in% KEYS)
}
if (!is.null(OBRA) & is.null(KEYS)) {
DATA <- subset(keywords, obra %in% OBRA)
}
if (!is.null(OBRA) & !is.null(KEYS)) {
DATA <- subset(keywords,
obra %in% OBRA & keyword %in% KEYS)
}
return(DATA)
})
## Cria listbox para seleção dos datasets
output$DATASETUI <- renderUI({
na <- sort(DATACHOICE()$name)
if (length(na) != 0) {
CHOICES <- c("Escolha um dataset" = "", na)
} else {
CHOICES <- c("Não há datasets" = "")
}
selectInput(inputId = "DATASET",
label = "Dados disponíveis",
choices = CHOICES)
})
output$DOC <- renderPrint({ output$DOC <- renderPrint({
if (input$DATASET != "") { if (input$DATASET != "") {
tmp <- tempfile() tmp <- tempfile()
......
...@@ -8,21 +8,29 @@ shinyUI( ...@@ -8,21 +8,29 @@ shinyUI(
htmlOutput("HEADER"), htmlOutput("HEADER"),
fluidRow( fluidRow(
column(
width = 3,
uiOutput("OBRAUI")
),
column(
width = 2,
uiOutput("KEYSUI")
),
column( column(
width = 4, ## offset = 2, width = 3, ## offset = 2,
selectInput(inputId = "DATASET", uiOutput("DATASETUI")
label = "Dados disponíveis",
choices = c("Escolha um dataset" = "", L))
), ),
column( column(
width = 4, width = 2,
HTML(paste('<label class="control-label">Baixe ', HTML(paste('<label class="control-label">Baixe ',
'os dados:</label><br>', sep = "")), 'os dados:</label><br>', sep = "")),
downloadButton(outputId = "DOWNLOADDATA", downloadButton(outputId = "DOWNLOADDATA",
label = "Download tsv") label = "",
class = "btn btn-primary")
), ),
column( column(
width = 2, offset = 2, width = 2, ## offset = 2,
HTML(paste('<label class="control-label">Execução R:', HTML(paste('<label class="control-label">Execução R:',
'</label><br>', sep = "")), '</label><br>', sep = "")),
actionButton(inputId = "EXIT", actionButton(inputId = "EXIT",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment