Open SalvadorW2 opened 4 years ago
Hm... if object input
isn't found, there could be a few reasons for that. Are you using input
inside a reactive expression, i.e. render.*({ ... })
? Have your preceded your code with both library(shiny)
and library(dplyr)
?
Yes, I've done all of those things.
I checked with the library() function and shiny and dplyr are both installed.
I made sure to call them from the library before attempting to run the code.
And they're explicitly in the beginning of your shiny script? The calls to library()
?
I'm having the same problem. My code is
team.name <- input$my_team
dat.one.team <- filter(Teams,
name == input$my_team)
When I run either line, it says "Error: object 'input' not found."
I've also tried
dat.one.team <- filter(Teams,
name == input$my_team)
because I thought that after running my inital code, team.name and input$my_team would be the same, but that code returns "object team.name not found"
I have all the packages loaded, and these are above my renderPlot.
@BriannaSmithR that would likely be the culprit:
I have all the packages loaded, and these are above my renderPlot.
input$
is used in reactive expressions and therefore needs to be in a reactive function like renderPlot()
. Try putting it at the very beginning, before your plotting functions, while plotting functions with dat.one.team
should be at the very end of renderPlot()
.
The { }
signals to R that something dynamic and responsive to user inputs is occurring within the curly brackets.
I moved
team.name <- input$my_team
into the renderPlot(), but I'm still getting the "Error: object input no found." I also moved my other code and it isn't working either :(
@BriannaSmithR would you kindly email me your .Rmd file and I can have a look?
I've tried what you've said and am having the same problem as Brianna.
Could I do the same?
@SalvadorW2 absolutely!
@SalvadorW2 so the .Rmd
script runs perfectly fine and I'm not able to reproduce this error. Couple of notes though:
data(Teams)
once, at the beginning - by calling it again after several preprocessing tasks, you restore the Teams
dataset to its original staterenderPlot()
call:points( x=dat.one.team$yearID,
y=dat.one.team$ave.so,
pch=20,
cex=1.2,
col="goldenrod1",
type="b" )
It should be the final layer of paint on your visualization, since it's the reactive portion!
Last note is a biggie and so I'm putting it in bold so others will see it:
Running the individual code chunks will throw an error - you need to knit the document in its entirety, since the chunks must communicate with each other simultaneously - running an individual chunk is like seeing if a car will budge when you've taken off half the wheels!
Let me know if this helps!
Okay, thank you!
This is helpful.
Sure thing, @SalvadorW2!
Thank you,
I have the reactive element working now for the interactive graph.
Sean Waggoner
Great! :fire:
Hello everyone,
I'm trying to get the following chunk of code to work:
dat.one.team <- filter( .data = Teams, name == input$my_team )
points( x=dat.one.team$yearID, y=dat.one.team$ave.so, pch=20, cex=1.2, col="goldenrod1", type="b" )
team.name <- input$my_team
However, I keep getting the following error message:
Error: Problem with
filter()
input..1
. x object 'input' not found i Input..1
isname == input$my_team
.I've installed Shiny and believe I have configured selectInput correctly:
selectInput(
inputId = "my_team", label = "Select a team:", choices = c("New York Yankees", "Boston Red Sox", "Oakland Athletics", "Atlanta Braves", "Toronto Blue Jays", "Los Angeles Dodgers", "Houston Astros", "Chicago Cubs", "New York Mets", "Arizona Diamonbacks"), selected = "Atlanta Braves"
Does anyone know what the problem could be?