I am new to Shiny and trying to build a more accessible input and output for the function I created. I give this to people who don't run R, trying to build something that performs my functions in the background, and then spits out the answer.
I am having problems with what I want, unfortunately, with a bunch of errors. However, here is my sharper question:
The actual function that I want to run accepts a name (in quotes "Last, First") and a number.
PredH("Last,First",650)
So, I want a brilliant application that takes a name input and a quantity input, which then launches this program, and then returns a data table with my answer back. So a couple of questions.
How do I get it in the correct form for input into my equation on the server side of the script, do I need to return it to a function so that it can be accessed using the $ table type access function? (Now I just print using the cat () function in the console for the function, but I know that this cannot be used for this type of application.
I want to return the data that can be obtained in the PredH14 $ table. How can I make it shiny?
Here is my code:
interface:
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Miles Per Gallon"),
sidebarPanel(
textInput("playername", "Player Name (Last,First):", "Patch,Trevor"),
radioButtons("type", "Type:",
list("Pitcher" = "P",
"Hitter" = "H"
)),
numericInput("PAIP", "PA/IP:", 550),
submitButton("Run Comparables")
),
mainPanel(
textOutput("name")
)
Server:
library(shiny)
shinyServer(function(input, output) {
sliderValues <- reactive({
data.frame(
Name = c("name", "PA"),
Value = c(as.character(playername),
PAIP),
stringsAsFactors=FALSE)
})
name=input[1,2]
PAIP=input[2,2]
testing <- function(name,PAIP){
a=paste(name,PAIP)
return(a) }
output$name=renderText(testing$a)
})