Hi every one, until yesterday I was using the package Xlconect. But since 00:00 I had this problem - Error in library(Xlconect) : there is no package called ‘Xlconect’
Please can someone help me?
ui.R
shinyUI(fluidPage(
titlePanel("DEA - Análise Envoltória de Dados"),
br(),
sidebarLayout(
sidebarPanel(radioButtons("model", "Escolha do Modelo:",
list("CRS" = "crs",
"VRS" = "vrs")),
br(),
br(),
fileInput(inputId = "iFile", label = "Escolha um Arquivo:", accept="application/vnd.ms-excel"),
uiOutput(outputId = "ui"),
uiOutput(outputId = "columns"),
uiOutput(outputId = "colum"),
submitButton("Upload!"),
br(),
br(),
br(),
img(src = "www.png", height = 300, width = 450, align = "center")
),
mainPanel(tabsetPanel(
tabPanel("Tabela",tableOutput(outputId = "contents")),
tabPanel("Resultados", verbatimTextOutput("summary")))
)
)))
server.R
library(Xlconect)
shinyServer(function(input, output) {
Jer <- reactiveValues()
observe({
if (!is.null(input$iFile)) {
inFile <- input$iFile
wb <- loadWorkbook(inFile$datapath)
sheets <- getSheets(wb)
Jer$wb <- wb
Jer$sheets <- sheets
}
})
observe({
if (!is.null(Jer$wb)) {
if (!is.null(input$sheet)){
Jer <- readWorksheet(Jer$wb, input$sheet)
print(names(Jer))
output$columns <- renderUI({
checkboxGroupInput("columns", span(strong("Escolher imputs"), style = "color:blue"),
choices = names(Jer))
})
}
}
})
Jer <- reactiveValues()
observe({
if (!is.null(input$iFile)) {
inFile <- input$iFile
wb <- loadWorkbook(inFile$datapath)
sheets <- getSheets(wb)
Jer$wb <- wb
Jer$sheets <- sheets
}
})
observe({
if (!is.null(Jer$wb)) {
if (!is.null(input$sheet)){
Jer <- readWorksheet(Jer$wb, input$sheet)
print(names(Jer))
output$colum <- renderUI({
checkboxGroupInput("columns", span(strong("Escolher outputs"), style = "color:green"),
choices = names(Jer))
})
}
}
})
chooseFile <- reactive({
inFile <- input$iFile
if (!is.null(inFile)) {
# Determine document format;
ptn <- "\\.[[:alnum:]]{1,5}$"
suf <- tolower(regmatches(inFile$name, regexpr(ptn, inFile$name)))
# Options for Excel documents;
if (suf %in% c('.xls', '.xlsx')) {
wb <- loadWorkbook(inFile$datapath)
sheets <- getSheets(wb)
output$ui <- renderUI({
list(
selectInput(inputId = "sheet", label = "Select a sheet:", choices = sheets)
)
})
return(list(path = inFile$datapath, suf = suf))
}
# Options for txt documents;
if (suf %in% c('.txt', '.csv')) {
output$ui <- renderUI({
list(
checkboxInput(inputId = 'header', label = 'First line as header', value = TRUE),
textInput(inputId = 'sep', label = 'Separator', value = " "),
textInput(inputId = 'quote', label = 'Quote', value = '\"'),
textInput(inputId = 'arg', label = 'Additional Arguments:', value = ' '),
)
})
return(list(path = inFile$datapath, suf = suf))
}
} else {return(NULL)}
})
output$contents <- renderTable({
objFile <- chooseFile()
if (!is.null(objFile)) {
suf <- objFile$suf
# For Excel documents;
if (suf %in% c('.xls', '.xlsx')) {
Sheet <- input$sheet
wb <- loadWorkbook(objFile$path)
dat <- readWorksheet(wb, Sheet)
return(dat)
}