Watts-College / paf-513-template

https://watts-college.github.io/paf-513-template/
MIT License
0 stars 0 forks source link

lab 4 error code #15

Open bbenall4 opened 6 months ago

bbenall4 commented 6 months ago

@JasonSills hello, why does this error message keep coming up Error in renderPlot({ : could not find function "renderPlot"

JasonSills commented 6 months ago

@bbenall4 - you likely need to install both shiny and flexdashboard packages.

bbenall4 commented 6 months ago

@JasonSills i have them both installed but its still giving me that message

bbenall4 commented 6 months ago

This is what im putting in for the 3rd code chunk @JasonSills

renderPlot({ team.name <- input$teamName # only place it appears dat.one.team <- filter( Teams, name == team.name )

plot.new() plot.window( xlim=c(1900,2025), ylim=c( ave.so.min, ave.so.max ) ) points( year, ave.so, col=adjustcolor("lightgray",alpha=0.75 ), pch=20, cex=1) points( league.year, league.ave, type="o",lwd=3, col=adjustcolor("dodgerblue4", alpha=0.67), cex=.5,pch=19 ) points( 1924, 2.7, col=adjustcolor("black",alpha=0.75 ), pch=21, cex=1.5) points( 2012, 7.5, col=adjustcolor("black",alpha=0.75 ), pch=21, cex=1.5)

Axis

axis( 1,seq(1900,2025,10), hadj = 0 ) axis( 4,seq(0,9,1),las=2, tick = FALSE, col.axis="gray") abline( h=c(1,2,3,4,5,6,7,8,9), lty=2, col="gray" )

Title area

title( main = "Strikeouts on the Rise", cex.main=2, side=3, adj=0, line=1) title( main = "There were more strikeouts in 2012 than at any other time in major league history.", cex.main=0.8, line=-0.4, col.main="gray30", adj=0 ) title(main = "Strikeouts per game per team (by batters)", cex.main=0.7, line=-3, adj=0)

Legend

legend( 1895, 8.9, legend=c("League average", "Choose a Team"), col=c("dodgerblue4","orange"), pch = c(20,20), lty=1:1,cex=.8, box.lty=0, text.col = ("dodgerblue4") )

Text

text( 1917, 3.48, labels=(text="U.S. enters\nWorld War I."), cex=.75, offset=8, pos=1, col="gray") segments( 1917, 3.40, 1917, 1, col = "gray", lwd = 1, lty = 1) text( 1924, 2.7, labels=(text="2.7"), cex=1.5, offset=.75, pos=1,col="Dodgerblue4", font=2 ) text( 1924, 2.7, labels=(text="League average\n1924"), offset=2, pos=1,col="black", font=2) text( 1946, 3.88, labels=(text="Players return\nfrom World War II."), cex=.75, offset=7, pos=1,col="gray") segments( 1946, 3.48, 1946, 1.8, col = "gray", lwd = 1, lty = 1) text( 1963, 5.8, labels=(text="Strike zone enlarged\nfrom 1963-68."), cex=.75, offset=10, pos=1,col="gray") segments( 1963, 5.40, 1963, 2.8, col = "gray", lwd = 1, lty = 1) text( 1969, 5.83, labels=(text="Pitching had become so dominant\nin the 1960s that the mound\nwas lowered in 1969."), cex=.75, offset=7.5, pos=3,col="gray") segments( 1969, 6.23, 1969, 8.0, col = "gray", lwd = 1, lty = 1) text( 1973, 5.2, labels=(text="Designated hitter\nrule took effect."), cex=.75, offset=11, pos=1,col="gray") segments( 1973, 4.8, 1973, 1.8, col = "gray", lwd = 1, lty = 1) text( 2008, 6.8, labels=(text="Mitchell Report\non steroids."), cex=.75, offset=10, pos=1,col="gray") segments( 2008, 6.4, 2008, 3.8, col = "gray", lwd = 1, lty = 1) text( 2012, 7.5, labels=(text="7.5"), cex=1.5, offset=1, pos=3, col="Dodgerblue4", font=2) text( 2012, 7.5, labels=(text="2012\nLeague average"), offset=2.5, pos=3,col="black",font=2 ) })

JasonSills commented 6 months ago

@bbenall4

Are you running the chunk or are you running the document/ knitting?

bbenall4 commented 6 months ago

@JasonSills im only running the chunk for each section but i keep getting that error back

JasonSills commented 6 months ago

@bbenall4

you need to run the full document for Shiny.

bbenall4 commented 6 months ago

@JasonSills okay so i took out everything i put in and tried running just the template and it gives me these 2 errors

Error in selectInput(inputId = "my_team", label = "Select a team:", choices = c("New York Yankees", : could not find function "selectInput"

Error in renderPlot({ : could not find function "renderPlot"

bbenall4 commented 6 months ago

@JasonSills sorry i had to re read that again and now it finally ran the document