Error in rle(toplevel) : 'x' must be a vector of an atomic type

Dear Community,

I'm trying to do my first shiny app and when I try to publish I have the following error: "Error in rle(toplevel) : 'x' must be a vector of an atomic type".
It seems to be that the reactive Event in the server is not returning a vector and instead is returning a list. Does any of you know how can I fix it?
The code is:


function(input, output) {
    auto_parts <- read_excel("./Auto-parts-bien2.xlsx", col_types = c("text", "text", "text",  "numeric", "numeric", "numeric", "numeric", "numeric",  "numeric", "numeric", "numeric", "numeric", "numeric", "numeric", "numeric", "numeric", "numeric", "numeric", "numeric"))

    re <- eventReactive(input$update,{
        data <- data.frame(auto_parts)
        data <- data[(data$Market.Value..EUR. >= input$marketcap[[1]])&(data$Market.Value..EUR. <= input$marketcap[[2]]),]
        data <- data[(data$ >= input$per[[1]])&(data$ <= input$per[[2]]),]
        data <- data[(data$ >= input$pb[[1]])&(data$ <= input$pb[[2]]),]
        data <- data[(data$Price.Index.48.m >= input$growth[[1]])&(data$Price.Index.48.m <= input$growth[[2]]),]
        data <- data[(data$ROIC.5.yr.avg >= input$roic[[1]])&(data$ROIC.5.yr.avg <= input$roic[[2]]),]
        if(input$ebitda == "Positive"){
            data <- data[data$X5yr.Growth.EBITDA >= 0,]
        }else {
            data <- data[data$X5yr.Growth.EBITDA <= 0,]
        if(input$country != "All"){
            data <- data[data$Country == input$country,]
        drop <- c("Piotroski.F.Score","Price.Index.12.m","Price.Index.48.m","X5yr.Growth.EBITDA"
        data_2 <- data[,!(names(data) %in% drop)]
    # Filter data based on selections
    output$table <- DT::renderDataTable(DT::datatable({


After 5 days getting crazy with this. I've solved the issue. It was not related with the code, the path where the app was, had strange characters. Hope it helps for all of you

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.