1
votes

A few months ago, I built a shiny app, with a plotly graph as my main output. My data is from an excel sheet, and I have used the readxl package to pull the data into R. I recently updated the excel data, and now plotly will no longer graph the data. From the shinyapp:

ratings <- read_excel("data/excel.xlsx", sheet = "Ratings")
p <- plot_ly(ratings, x = ratings[,1], 
             y = ratings[,input$select[1]],
             name = input$select[1])

is the beginning building block for the output. When I launch the app, I see an error message

Error: Unsupported index type: NULL

where the plot used to be. I have tried to build the plot step-by-step in RStudio, but my output is a blank x,y graph without any data points. If I manually build vectors:

xVector <- c(1:5)
yVector <- c(1:5)
plot_ly(x = xVector, y = yVector)

I get a fully-functioning plotly graph.

1

1 Answers

2
votes

After researching all day, I discovered that readxl has changed since I originally built the app, such that data is stored as a tibble instead of a data frame, and plotly doesn't recognize tibbles. Using as.data.frame() resolved the issue.