I'm trying to write interactive piecharts using Shiny but keep getting this error
Error in chart$html : $ operator is invalid for atomic vectors
I have 3 data sets, one has the whole data set, one is how many things were passed and the other is how many failed. I've the following code:
server.R
library(shiny)
library(googleVis)
y1<-read.csv("y1.csv")
y2<-read.csv("y2.csv")
y3<-read.csv("y3.csv")
shinyServer(function(input, output) {
datasetInput <- reactive({
switch(input$dataset,
"full content" = y1,
"passed content" = y2,
"failed content" = y3, select = "full content")
})
output$view <- renderGvis({
dok <-gvisPieChart(datasetInput(), options=list(width=500, height=500))
plot(dok)
})
})
ui.R
# ui.R
shinyUI(pageWithSidebar(
headerPanel("Degree of knowledge distribution for content"),
sidebarPanel(
selectInput("dataset", "Choose:",
choices = c("full content", "passed content", "failed content"))
),
mainPanel(
htmlOutput("view")
)
))
My y csv files are 5 observations of two variables, the name of the content and the number of them