cssearcy / AYS-R-Coding-SPR-2020

Coding in R for Policy Analytics
https://cssearcy.github.io/AYS-R-Coding-SPR-2020/
3 stars 3 forks source link

Lab 4 - Issues with selectInput #15

Open kpearce6 opened 4 years ago

kpearce6 commented 4 years ago

Hi @jamisoncrawford. I was hoping you could help me with an issue I am having with Lab 4. Whenever I try to run my code, it always stops at the first selectInput and produces an error that says "could not find function "selectInput". I have tried many different inputIDs as well as looking at the code and not sure if I am just missing something. I have this included as a chunk before renderPlot. Here is currently what I have for the selectInput function:

selectInput(inputId='Teams',  
             label='Choose a Team',   
             choices=c("Cincinnati Reds","Pittsburg Pirates","Philadelphia Phillies","St. Louis Cardinals","Chicago White Sox","Detroit Tigers","Chicago Cubs","Boston Red Sox","New York Yankees","Cleveland Indians"),  
             selected="Cincinnati Reds"   
           )

Thanks! Katie

jamisoncrawford commented 4 years ago

Hi @kpearce6, this code looks perfectly fine! Have you loaded Shiny with library(shiny) at the very beginning of your .R script?

If your error message says that it cannot recognize an object, and that object is a function, it typically means that R hasn't been told to load the package that contains that function. Let me know if that helps and sorry for the delay!

kpearce6 commented 4 years ago

Hi @jamisoncrawford. Thanks for getting back to me. I tried my code on another computer and it worked so not sure what happened. It should be all good now. I appreciate it!

jamisoncrawford commented 4 years ago

@kpearce6 well that's interesting! Figure out why it worked and you'll learn 1% of R 😄

Glad you got it working!

lecy commented 4 years ago

When all else fails, take a nap and try again! Works for the computer too.