I'm developing a R Studio Shiny app, the logic consist in load two excel files into dataframes and using fuzzyjoin package to make a inner join between these dataframes, below is the code of my shiny.r and server,r, loading of excel files are correctly but when I get into Conciliacion tab I'm receiving the error
Error in : Column
col
must be a 1d atomic vector or a list:
ui.R:
library(shiny)
shinyUI(
fluidPage(
titlePanel("Conciliación de reportes"),
fixedRow(
column(12,
sidebarPanel(
h4("Seleccione el primer reporte:"),
fileInput('reporte1', 'Seleccione un archivo Excel',
accept=c('.xlsx')),
width = 6
),
sidebarPanel(
h4("Seleccione el segundo reporte:"),
fileInput('reporte2', 'Seleccione un archivo Excel',
accept=c('.xlsx')),
width = 6
),
mainPanel(
tabsetPanel(
tabPanel("Reporte BCD", tableOutput("reportebcd")),
tabPanel("Reporte E.CTA", tableOutput("reporteecta")),
tabPanel("Conciliacion", tableOutput("conciliacion")),
type = "tabs"
),
width = 12
)
)
)
)
)
server.R
library(shiny)
library(readxl)
library(dplyr)
library(fuzzyjoin)
shinyServer(function(input, output) {
data1 <- reactive({
inFile <- input$reporte1
if(is.null(inFile))
return(NULL)
file.rename(inFile$datapath,
paste(inFile$datapath, ".xlsx", sep=""))
read_excel(paste(inFile$datapath, ".xlsx", sep=""), 1)
})
data2 <- reactive({
inFile <- input$reporte2
if(is.null(inFile))
return(NULL)
file.rename(inFile$datapath,
paste(inFile$datapath, ".xlsx", sep=""))
read_excel(paste(inFile$datapath, ".xlsx", sep=""), 1)
})
output$reportebcd <- renderTable({
data1()
}, striped = TRUE, hover = TRUE, rownames = TRUE)
output$reporteecta <- renderTable({
data2()
}, striped = TRUE, hover = TRUE, rownames = TRUE)
selectedData <- reactive({
r_bcd <- data1()
r_ecta <- data2()
regex_inner_join(r_bcd, r_ecta, by = c(Orden.de.Servicio = "NUM_DE_ORDEN_DE_SERVICIO", Tarifa.Total = "CANTIDAD"))
})
output$conciliacion <- renderTable({
selectedData()
}, striped = TRUE, hover = TRUE, rownames = TRUE)
})
Any help would be greatly appreciated. Thanks.