Tyrion Lannister
Tyrion Lannister

Reputation: 270

subset data and plot this subsetted data with Shiny

If I have the following data frame:

Hours<-c(2,3,4,2,1,1,3)
Project<-c("a","b","b","a","a","b","a")
cd=data.frame(Project,Hours)

What is wrong with the following Shiny code: Why do I get the error:Error in tag("form", list(...)) : argument is missing, with no default

Server.R

##server.R
library(shiny)
library(ggplot2)
library(lattice)

# Define shiny server
shinyServer(function(input, output) {

 #Simple test plot
output$testPlot = renderPlot( {
pdata=subset(cd, Project==input$proj)
densityplot(pdata$Hours,lwd=3)

 })
})

ui.R

 library(shiny)
 ulist=levels(cd$Project)
 names(ulist) = ulist
  # Sidebar with a slider input for the number of bins
  shinyUI(pageWithSidebar(

  # Application title
headerPanel("Project Data"),

sidebarPanel(
  #Which table do you want to view, based on the list of institution names?
  selectInput("proj", "Project:",ulist),
),

# Show a plot of the generated distribution
mainPanel(
  plotOutput("testPlot"),
)

) )


The error again is: Error in tag("form", list(...)) : argument is missing, with no default This seems so simple but I don't know what's wrong. Any advice would be most appreciated.

Upvotes: 2

Views: 2178

Answers (2)

Marat Talipov
Marat Talipov

Reputation: 13314

I think you have a couple of extra commas in the ui.R, namely after the selectInput and plotOutput commands

Upvotes: 0

jdharrison
jdharrison

Reputation: 30465

You have superfluous comma's in your ui.R:

shinyUI(pageWithSidebar(
  headerPanel("Project Data"),
  sidebarPanel(
    selectInput("proj", "Project:",ulist) # remove comma here
  ),
  mainPanel(
    plotOutput("testPlot") # remove comma here
  )
) )

Upvotes: 1

Related Questions