user2876812
user2876812

Reputation: 336

Plotting interactive arulesViz plots in shiny R

i need to display interactive association rules plot in shiny. For that i am using arulesViz package. But when i am trying to display interactive scatter plot using the below:

shinyServer(function(input, output) {
output$plot1<-renderPlot({
rules <- apriori(transaction_all[[as.numeric(input$level)]],parameter=list(support=input$support,confidence=input$confidence))
plot(rules, measure=c("support", "lift"), shading="confidence",interactive = TRUE)
})

Its throwing an error:

Error in convertUnit(x, unitTo, "x", "location", "x", "location", valueOnly = valueOnly) : 
 'x' argument must be a unit object

How could this be done? Thanks

ui.R looks like this

shinyUI(pageWithSidebar(

#  Application title
headerPanel("Sliders"),

# Sidebar with sliders that demonstrate various available options
sidebarPanel(
# Simple integer interval
      selectInput("level", label = h3("select level to mine"), 
            choices = list("Level-1" = 1, "Level-2" = 2, "Level-3" = 3,"Level-4" = 4), 
            selected = 1),
sliderInput("support", "Support:", 
            min=0, max=1, value=0.5),
sliderInput("confidence", "Confidence:", 
            min=0, max=1, value=0.5),
width=3 
),

 mainPanel(
plotOutput("plot1")
 )
))

Server.R looks like this

library(shiny)

shinyServer(function(input, output) {
output$plot1<-renderPlot({
rules <- apriori(transaction_all[[as.numeric(input$level)]],parameter=list(support=input$support,confidence=input$confidence))
plot(rules, measure=c("support", "lift"), shading="confidence",interactive = TRUE)
})
})

Upvotes: 0

Views: 1261

Answers (0)

Related Questions