Vincent - Thanks so much for pointing out the place to limit the input on the select2.
Zak- The input just uses the select2 library as described by Vincent in one of the other forum messages. Generating the plots is super easy using ggplot2. Basically you just subset a dataframe using the input that comes back from select2 and then you do a facet based on whatever variable you want to view the different plots by. Here's my code, which I apologize for ahead of time (let me know if something isn't clear):
plyrs <- reactive(function() {
#this function just takes the input back from the select2 box PID and it returns a dataframe with two columns which are identical.
#it contains a try function because otherwise it will throw an error message briefly
plyrs <- data.frame(cbind(input$PID,input$PID))
try(colnames(plyrs)[1] <- "PID",silent=TRUE)
plyrs
})
output$mstd <- reactivePlot(function() {
#this function just takes the dataframe containing the players that the input had returned and it subsets the main dataframe sumTbl
#so we subset the dataframe sumTbl by merging it with the plyrs dataframe and it throws out all of the non-matches
#then we just do a ggplot bar graph with a facet. I also have a custom annotation that includes the watermark.
plyrs <- plyrs()
if(nrow(plyrs)>0){
sumTbl <- merge(sumTbl,plyrs,by.y="PID",by.x="TID")
print(ggplot(sumTbl,aes(YR)) + annotation_custom(rvLogo) + geom_bar(aes(y=msTD),stat="identity",alpha=.8) + facet_wrap(~TRGNAME,nrow=1) + xlab("Year") + scale_y_continuous(labels = percent) + ylab("Market Share") + theme_bw())
}
})