Plotting interactive arulesViz plots in shiny R

為{幸葍}努か 提交于 2020-07-11 04:43:58

问题


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)
})
})

来源:https://stackoverflow.com/questions/32881345/plotting-interactive-arulesviz-plots-in-shiny-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!