assignment of an object of class “numeric” is not valid for @‘Dim’ in an object of class “dgTMatrix”; is(value, "integer") is not TRUE

``Please what could be the possible cause, I've been debugging this code for more than 5hrs now, I need help.`

output$network_plot2 <- renderPlot({
progress <- shiny::Progress$new()
progress$set(message = "Correlation Plot", value = 0.2)
on.exit(progress$close())
progress$set(message = "Creating Pairwise words", value = 0.4)

x <- data.frame(text = sapply(docs(), as.character), stringsAsFactors = FALSE)
x$tweet_nbr <- 1:nrow(x)
tweet_word <- x %>% unnest_tokens(word, text)

tweet_word_cors <- tweet_word %>% group_by(word) %>% filter(n() >= 50) %>% 
pairwise_cor(word, tweet_nbr, sort = TRUE, upper = FALSE)

progress$set(detail = "Plotting..", value = 0.8)
set.seed(1234)
tweet_word_cors %>%
  filter(correlation > .6) %>%
  graph_from_data_frame() %>%
  ggraph(layout = "fr") +
  geom_edge_link(aes(edge_alpha = correlation, edge_width = correlation), edge_colour = "royalblue") +
  geom_node_point(size = 5) +
  geom_node_text(aes(label = name), repel = TRUE,
                 point.padding = unit(0.2, "lines")) +
  theme_void()

})

Hi,

Issues with Shiny code can stem from both the reactive Shiny code itself or the regular R code used in the functions. In order for us to help you with your question, please provide us a minimal reproducible example (Reprex) where you provide a minimal (dummy) dataset and code that can recreate the issue. One we have that, we can go from there.

I suggest you first try to figure out if the issue is with the R or Shiny. Try and run the R code with some sample data line by line and see if it produces the error (replacing any Shiny variables by regular ones). If not, it might be Shiny related.

For help on creating a Reprex, see this guide:

Good luck!
PJ

Thanks. problem has been solved.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.